-
Notifications
You must be signed in to change notification settings - Fork 30
Allow constants in kwargs of derived_signal #859
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
base: main
Are you sure you want to change the base?
Conversation
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.
The typing is all a bit messy but I'm not sure if there's a better way to do it. Functionally works great, just the one comment. Also, could you add something to https://blueskyproject.io/ophyd-async/main/how-to/derive-one-signal-from-others.html?
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.
Neat! A couple of suggestions to tidy...
If we have a multi derived signals using transforms, we still need to pass a signal as a parameter, as this will be a
Then when we collect our derived readings we can: raw_values = {
**{
k: raw_and_transform_readings[sig.name]["value"]
for k, sig in self._raw_devices.items()
},
**self._raw_constants,
} and return self._transform_cls(**(transform_args | self._transform_constants)) in |
Fixes #857
This PR should allow literals of type
int | bool | str | float
to be passed in as raw_devices. The approach that I've taken is filtering out these constants inSignalTransformer
, then passing them back in when a derived reading is made. There are probably more streamlined ways of doing this, so this is an initial pass to check that this is the intended functionality.