pcdshub / pcdsdevices

Collection of Ophyd device subclasses for IOCs unique to LCLS PCDS.
https://pcdshub.github.io/pcdsdevices/
Other
5 stars 58 forks source link

ENH: The set_many utility now works with Ophyd positioners as well as… #1227

Closed canismarko closed 4 months ago

canismarko commented 4 months ago

… signals.

Description

Previously, the function pcdsdevices.util.set_many() worked with Signal objects, but failed with Positioner objects. This is because Positioner.set() does not accept a settle_time argument. This change inspects each object's set() method to determine which keyword arguments it should provide.

Motivation and Context

I like the MultiDerivedSignal that depends on set_many, but it is limited to being derived from signals. With this change it can alse derive from positioners.

How Has This Been Tested?

I added a test for the set_many function. The set_many() call used in this test includes both a positioner and a regular Ophyd Signal.

I still need to test this in my client library, so for now it's a draft PR for feedback and discussion.

Where Has This Been Documented?

The interface has not changed, so some comments are included in the code and the test. Client code should not notice a difference.

Pre-merge checklist

canismarko commented 4 months ago

I just realized I ran black on this before commiting, so there's some auto-formatter changes mixed in. Happy to roll those back if needed.