Ophyd-async #32
Replies: 5 comments 17 replies
-
|
@Sulimankhail Maybe you can add your examples too? I think your examples where using the declarative way of defining devices which is an interesting option since it might simplify configuration if we did something similar for the pyAML devices. Here is a comparison of the declarative vs procedural approach: |
Beta Was this translation helpful? Give feedback.
-
|
In case you want to see more examples there are some in the ophyd-async repository. For beamline elements but still. TANGO: https://github.com/bluesky/ophyd-async/tree/main/src%2Fophyd_async%2Ftango%2Fdemo EPICS: https://github.com/bluesky/ophyd-async/tree/main/src%2Fophyd_async%2Fepics%2Fdemo As I understand it ophyd-async uses this for the signals which can include the TANGO host https://tango-controls.readthedocs.io/projects/rfc/en/latest/16/TangoResourceLocator.html#tango-resource-locator-trl-specification and that's why they don't need a separate step to initialise the control system. Same for the EPICS prefix. |
Beta Was this translation helpful? Give feedback.
-
|
To avoid old_position, units, precision, velocity = await asyncio.gather(
self.setpoint.get_value(),
self.units.get_value(),
self.precision.get_value(),
self.velocity.get_value(),
)I'm wondering if there are some array (list of signal) definitions in ophyd asynch that can gather a list of |
Beta Was this translation helpful? Give feedback.
-
|
Ok
|
Beta Was this translation helpful? Give feedback.
-
|
It would be good to list here what functionality of ophyd-async devices people want to use. This will be a good first step for a discussion. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As discussed on the maintainers' meeting today I will ask around and see if I find someone from the ophyd-async community who are willing to give us a short introduction to the features and how to make devices so we can see what we think.
In the meantime, I have some examples of devices I have written as part of learning how to use this package. I chose some I thought were the most simple ones since I just wanted to test the features.
At the moment I'm trying to figure out how to turn these devices into generic ones where I can have a factory which creates either EPICS or TANGO signals based on the configuration.
Masterclock:
This device implements the status feature when setting the device.
@AsyncStatus.wrapreturns aStatusobject which has the attributesuccessanddone. In my tests I added the functionality that I can specify a ramp rate anddonewill only becomeTrueafter a time based on that. I also added a tolerance check between the readback and setpoint which will raise an exception and makesuccessFalseif the tolerance isn't meet.I think it worked well and was easy to implement after you had understood the documentation because that is quite lacking...
Tune:
Our tune PVs are in frequency so I made a tune device to test the way ophyd-async handles conversions and see if I could get it to convert to physics units.
I think it was very easy to use. Only thing is that you need to define a
rawand aderived. I'm now thinking about how this device could be made generic so depending on if my tune PV/attribute returns frequency or tune there would be a factory which chooses which signal israwand which is derived and also allows you to skip having derived signals in case you don't need them.Ophyd-async also has the feature that you can add a format specifier to signals to specify under which conditions they should be read. For example, if you have signals which are purely for configuration and you want them to only be read once and not for every step during a measurement you could add a format specifier and they will be read by
read_configurationand notread().Here is an example for how I use these devices directly without needing the runengine. I will need an event loop and
awaitvalues since they are doing asynchronous calls. However, some IDEs and jupyter notebooks already provide an event loop so if you run it there you don't need to create it. But you still need to doawait. No way around that without some wrapper.Beta Was this translation helpful? Give feedback.
All reactions