NSLS-II / nslsii

NSLS-II related devices
BSD 3-Clause "New" or "Revised" License
11 stars 22 forks source link

ENH: parametrize TwoButtonShutter #26

Closed mrakitin closed 5 years ago

mrakitin commented 6 years ago

Currently, the TwoButtonShutter class has hard-coded string values for opening/closing the shutter (open_str = 'Open' and close_str = 'Close'): https://github.com/NSLS-II/nslsii/blob/575b21c1d16dc4af4317c35c284e41e8cd9a35fb/nslsii/devices.py#L9-L25

SMI needs Insert/Retract combinations.

Some other beamlines may have the same. Maybe SMI can use the same approach as PDF and standardize Open/Close user-facing commands.

tacaswell commented 6 years ago

The idea was to paramterize this by sub-classing the it as

class SMITwoButtonShutter(TwoButtonShutter):
    open_val = 'Inserted'
    close_val = 'Retracted'

As this is a property of the server so it should be a class level attribute (at least that was the thinking).

mrakitin commented 6 years ago

Thanks @tacaswell! That seems to be a good solution. Just one question - should it be open_val/close_val, or open_str/close_str?

tacaswell commented 6 years ago

Check the code, but iirc *_val is the enum string we are watching to make sure it did the thing we told it to and *_str is the input that we accept through set.

mrakitin commented 6 years ago

Yes, that's exactly what's implemented in the code. SMI's case uses different inputs for set:

    # user facing commands
    open_str = 'Insert'
    close_str = 'Retract'

The rest seems identical. I'll update it at SMI next week.

awalter-bnl commented 5 years ago

This will also be resolved with the new version, called EPS_Two_State_device in nslsii. the PR is here. In addition a temporary workaround is implemented as described above.