Skip to content
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

Add device support for SRS570 from synApps #543

Merged
merged 17 commits into from
Oct 8, 2021
Merged

Add device support for SRS570 from synApps #543

merged 17 commits into from
Oct 8, 2021

Conversation

prjemian
Copy link
Contributor

@prjemian prjemian commented Oct 1, 2021

@prjemian prjemian added this to the 1.5.3 milestone Oct 1, 2021
@prjemian prjemian self-assigned this Oct 1, 2021
@prjemian prjemian marked this pull request as draft October 1, 2021 21:43
@prjemian
Copy link
Contributor Author

prjemian commented Oct 1, 2021

Compare with other preamplifiers and generalize: Keithley 428 and Femto (USAXS has both).

Might be suitable as ophyd.PVPositioner if we can control the values for the setpoint to match the values the readback can provide. This is controller-dependent.

@gfabbris
Copy link
Collaborator

gfabbris commented Oct 4, 2021

@prjemian: I double checked all the "value" PVs in the SRS570, and you either get the state number or a string with the value.

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

I'm seeing the same, thinking that is a legacy misdirection. Numerical values should be numbers, not strings. Can they be forced into numbers? Not directly, as shown:

(bluesky_2021_2) prjemian@zap:~/.../BCDA-APS/apstools$ ipython
Python 3.8.10 (default, May 19 2021, 18:05:58) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import ophyd

In [2]: !caput gp:gp:text1 "1.0"
Old : gp:gp:text1                    
New : gp:gp:text1                    1.0

In [3]: sens = ophyd.EpicsSignal("gp:gp:text1", name="sens", string=False)

In [4]: type(sens.get())
Out[4]: str

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

Can we subclass to force these to numbers? thinking: EpicsSignalNumber()

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

On closer examination, sens_num is defined as a mbbo EPICS record type. There is a confusing overlap between the enumeration value and the sensitivity number which can take these values: 1 2 5 10 20 50 100 200 500

The mapping between mbbo index of 5 (sensitivity value of 50) and a sensitivity value of 5 (index of 2) is an ambiguity that cannot be resolved unless string values for the sensitivity are defined.

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

Conclusion

To make this a subclass of ophyd.PVPositioner, would need to have gain (for setpoint and readback) be a number, not a string. Is it really worth it?

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

Since other synApps hardware device support is located under _devices, relocate this new support with the others.

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

Also, let pint handle the units conversions. Example:

In [57]: for units in amp.sensitivity_unit.enum_strs:
    ...:     print(units, pint.Quantity(200, units).to("A/V").magnitude)
    ...:
pA/V 2e-10
nA/V 2.0000000000000002e-07
uA/V 0.00019999999999999998

Note: this will make pint a new requirement for apstools

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

Example:

In [59]: amp = SRS570_PreAmplifier("8idi:A1", name="amp")

In [60]: amp.gain
Out[60]: 0.00019999999999999998

@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

If the gain was an ophyd.Signal (or subclass), then it could be recorded in a run's baseline.

@prjemian prjemian marked this pull request as ready for review October 4, 2021 17:32
@prjemian
Copy link
Contributor Author

prjemian commented Oct 4, 2021

Setting a precedent for current amplifiers (pre-amps) here that gain is a Component (either RO or R/W) with name shortcut to the parent Device. Per #544

@prjemian prjemian requested review from gfabbris and mdwyman October 4, 2021 17:53
@prjemian prjemian added the hacktoberfest-accepted https://hacktoberfest.com/ label Oct 7, 2021
@prjemian
Copy link
Contributor Author

prjemian commented Oct 7, 2021

@gfabbris @mdwyman This is ready for review. Merge this week unless there are objections?

@prjemian prjemian merged commit 4339c00 into main Oct 8, 2021
@prjemian prjemian deleted the 541-SRS570 branch October 8, 2021 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement hacktoberfest-accepted https://hacktoberfest.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generalize preamplifier Devices SRS570 amplifier
2 participants