Tidy up PinTipDetection#1880
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1880 +/- ##
=======================================
Coverage 99.03% 99.03%
=======================================
Files 305 305
Lines 11519 11522 +3
=======================================
+ Hits 11408 11411 +3
Misses 111 111 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
DominicOram
left a comment
There was a problem hiding this comment.
Thanks, some suggestions. Basically this goes half way to decoupling it but not finishing the job, which sort of feels worse
| @@ -235,22 +235,24 @@ def _locate_sample(self, edge_arr: np.ndarray) -> SampleLocation: | |||
|
|
|||
| # Choose our starting point - i.e. first column with non-narrow width for positive scan, last one for negative scan. | |||
| if self.scan_direction == ScanDirections.FORWARD: | |||
There was a problem hiding this comment.
Could: If we're going to do this then we might as well decouple it entirely and set the enum to be:
class ScanDirections(Enum):
FORWARD = auto()
REVERSE = auto()There was a problem hiding this comment.
Could: You can just set the type of this to be ScanDirections then you don't need to do the cast below
There was a problem hiding this comment.
I tried that in the first instance and got turned around by various typing issues - which is also how a random #type: ignore appeared and was forgotten. Trying again after I address the rest of the comments
There was a problem hiding this comment.
Should: This is still relying on the value of the enum so if we want to decouple them it should be if self.scan_direction == ScanDirections.FORWARD
| def setup_pin_tip_detection_params( | ||
| pin_tip_detect_device: PinTipDetection, | ||
| parameters: OAVParameters, | ||
| scan_direction: ScanDirections = ScanDirections.FORWARD, # type: ignore |
There was a problem hiding this comment.
Should: Why the type ignore here?
Part of i19-bluesky#116
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}