Add the diamond filter and qbpm devices#820
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #820 +/- ##
==========================================
- Coverage 95.03% 95.03% -0.01%
==========================================
Files 117 119 +2
Lines 4771 4810 +39
==========================================
+ Hits 4534 4571 +37
- Misses 237 239 +2 ☔ View full report in Codecov by Sentry. |
| T = TypeVar("T", bound=Filters) | ||
|
|
||
|
|
||
| class DiamondFilter(StandardReadable, Generic[T]): |
There was a problem hiding this comment.
@coretl or @callumforrester. Do we like this pattern for the different enums on each beamline or do you think better to just drop it and leave it as a str?
There was a problem hiding this comment.
Depends, do you in code write filter.thickness.set(I03Filters.FIFTY) anywhere? If so then it's useful to check that the specified filter value exists at connect too. If not then drop to string.
There was a problem hiding this comment.
I'm not sure I understand. We don't write filter.thickness.set(I03Filters.FIFTY) anywhere because there is no 50um filter on I03. The filters are different on each beamline but otherwise the hardware is the same. What I'm trying to do is allow people to write:
i03_filter = i03.filter()
i04_filter = i04.filter()
i03_filter.thickness.set(I03Filters.TWO_HUNDRED) # All good
i03_filter.thickness.set(I04Filters.FIFTY) # Type system gives an error here, there is no 50 on i03My concern with str was that you can then do:
i03_filter.thickness.set("200 um") # All good
i03_filter.thickness.set("50 um") # No warning this is not valid until runtimeI wanted to make sure this pattern wasn't overly complicating things or doing something unexpected for ophyd_async though
There was a problem hiding this comment.
The procedural case will remain compatible with this, but making the declarative approach work for this would be overkill. I'd say it makes sense for the usecase you mention.
olliesilvester
left a comment
There was a problem hiding this comment.
Looks good, and devices behaved on i03. I think what you've done with generics is good too
| self.y_motor = Motor(prefix + "Y") | ||
| self.thickness = epics_signal_rw(data_type, f"{prefix}Y:MP:SELECT") |
There was a problem hiding this comment.
Nit: It's not immediately obvious (to me) that selecting a thickness is just selecting a motor value
There was a problem hiding this comment.
Added a bit more in the docstring
Part of DiamondLightSource/mx-bluesky#544
Instructions to reviewer on how to test:
dodal connect i03anddodal connect i04and confirm they passChecks for reviewer
dodal connect ${BEAMLINE}