BCDA-APS / apstools

various tools for use with Bluesky at the APS
https://bcda-aps.github.io/apstools/latest/
Other
16 stars 9 forks source link

XIA PFCU4 filters and shutters #974

Open canismarko opened 2 months ago

canismarko commented 2 months ago

I recently added support for the XIA PFCU4 filter bank to the haven library.

https://github.com/spc-group/haven/blob/main/src/haven/instrument/xia_pfcu.py

In our configuration, 2 of the 4 filters are actually shutters where one is the top half and the other the bottom half.

To start with I tried to make the shutter with the same interface as the ShutterBase found in apstools. This didn't work with pydm, though, as pydm needs a signal to set for open and close, and to read for its current state, etc., and it needs to device to be subscribable.

I started adding this capabilities to the PSS shutter class, and realized I was re-inventing the PVPositioner class, so I just made my shutter be a PVPositioner instead of an apstools ShutterBase, and used an enum instead of strings for the possible states so it would work with the PyDMByteIndicator widget.

My next step is to re-implement our pss shutter support using this positioner approach.

My question then is what, if anything, is of interest to apstools? I imagine the filter support minus the shutter would be useful. Would the shutter work be useful as well, with the caveat that it might not be backwards compatible?

prjemian commented 2 months ago

I'm starting to like the approach of a shutter as an enumerated positioner. Some shutters have separate open and close PVs and some of those have separate readback and target PVs. So it gets complicated but an enumerated positioner object might be an improvement over the present implementation. As long as we don't break existing installations.

Others also implement the shutter blade option as an X-ray opaque filter (product of $\mu_m(\lambda) \ \rho_m \ t$). Is there anything truly different, other than the exceptionally high absorption?

canismarko commented 2 months ago

When I have permission to control a shutter, I planned to work on the pss shutters. I'm hoping the DerivedSignal and MultiDerivedSignal will be useful there, or maybe subscriptions to a non epics setpoint signal.

Yeah, the existing installations question I'm not sure about. I think it depends on how they use it. If the "open" and "close" values are written into a library somewhere it could be a problem. Otherwise it's on the operator to type a 1 instead of "open".

Im not sure why we have two pieces instead of one. The xia filters i implemented are also positioners, so a single high attenuation filter would be basically the same.

Do you want a PR for what I have so far, and I can unify the shutters once I can test on a real one?

prjemian commented 2 months ago

I think this can wait for beam testing first.