-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
129 edge detection #143
129 edge detection #143
Conversation
Draft at the moment (due to necessary ophyd PR not done yet), but would appreciate any feedback on the approach so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you, mostly quite minor comments in code. Haven't managed to test on a real device yet but looks like it should work. I think we should change the name from pin_tip_detection
, it does more than that in that it detects the bounding edge of the pin too. Maybe something like pin_image_recognition
? Can we also make an artemis issue to switch over i03 to using this?
src/dodal/devices/oav/pin_tip_detection/oav_with_pin_tip_detection.py
Outdated
Show resolved
Hide resolved
src/dodal/devices/oav/pin_tip_detection/oav_with_pin_tip_detection.py
Outdated
Show resolved
Hide resolved
src/dodal/devices/oav/pin_tip_detection/pin_tip_detect_utils.py
Outdated
Show resolved
Hide resolved
tests/devices/unit_tests/oav/pin_tip_detection/test_pin_tip_detect_utils.py
Outdated
Show resolved
Hide resolved
src/dodal/devices/oav/pin_tip_detection/oav_with_pin_tip_detection.py
Outdated
Show resolved
Hide resolved
src/dodal/devices/oav/pin_tip_detection/oav_with_pin_tip_detection.py
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #143 +/- ##
==========================================
- Coverage 89.25% 88.06% -1.20%
==========================================
Files 62 65 +3
Lines 2047 2295 +248
==========================================
+ Hits 1827 2021 +194
- Misses 220 274 +54
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a big change; Most of my comments are to do with minor tweaks to make things more pythonic and questions about where things should live/if we could do things in slightly different ways to have slightly cleaner code.
Importantly, it's clear that this hasn't yet been tested in earlier versions of python, especially as the CI for python3.9 is failing due to type annotation issues.
You have two options in this regard:
- continue to use python3.10 type annotations like
dict
and|
(instead of 'Union') except addfrom future import __annotations__
at the top of all files that use these - Don't use those things, and instead use (e.g.)
Dict
andUnion
. With this option, to get rid of the CI error you'd need to import some things fromtyping_extensions
. TypeDicts are a known example of this.
src/dodal/devices/oav/pin_tip_detection/pin_tip_detect_utils.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, sorry for adding more comments to an already dragging PR. Hopefully just some quick ones now
Note that if the sample is off-screen, this class will return the centre as the "edge" | ||
of the image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should: Is this true? I thought it returned -1 if the sample was completely offscreen and the edge if the sample extended across the whole screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have clarified comment, I think it's just potential ambiguity between "sample is off-screen" and "tip of the sample is off-screen". Hopefully new wording is clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for responding to my comments. They weren't all easy to deal with and I appreciate your responses 👍
I'd still wait for Dom's go ahead because my opinion on this is purely from a code readability standpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just one more comment, promise...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you!
Initial dodal/ophyd device for pin-tip detection on I23:
Notes:
edge_detect_utils.py
is a refactored version of/dls_sw/prod/R3.14.12.7/support/adPython/2-1-11/adPythonApp/scripts/adPythonMxSampleDetect.py
. Main changes:NTNDArray
EPICS PVA datatype, and a minor patch oftimestamp
->timeStamp
(the latter being the EPICS standard).