-
Notifications
You must be signed in to change notification settings - Fork 320
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
Update CryogenicSMS driver #1346
Update CryogenicSMS driver #1346
Conversation
Remove typos, hardcode terminator, properly raise exceptions when attempting to measure the field in 'AMPS' mode. The commit also makes the driver compatible with SMS60C by removing an incorrect value at the start of some replies.
Codecov Report
@@ Coverage Diff @@
## master #1346 +/- ##
=======================================
Coverage 73.34% 73.34%
=======================================
Files 79 79
Lines 9098 9098
=======================================
Hits 6673 6673
Misses 2425 2425 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I left a few suggestions inline
|
||
This magnet PS driver has been tested with: | ||
FTDI chip drivers (USB to serial), D2XX version installed. | ||
Cryogenic SMS120C and SMS60C (though the default init arguments are not correct for the latter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document what needs to change?
|
||
log.debug('Initializing instrument') | ||
super().__init__(name, address, terminator=terminator, **kwargs) | ||
super().__init__(name, address, terminator='\r\n', **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly dangerous. Even if you were passing the default value this will now result in a TypeError: __init__() got multiple values for keyword argument 'terminator'
I would add some lines like the following to the start of the function above
if 'terminator' in kwargs.keys():
kwargs.pop('terminator')
warnings.warn('Passing terminator to CryogenicSMS is no longer supported and has no effect')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great way of retaining backwards compatibility (when named arguments are used)!
Co-Authored-By: lukabavdaz <[email protected]>
Also makes terminator more backwards compatible (when named arguments are used).
Merge: 94acf12 a0185fd Author: Jens Hedegaard Nielsen <[email protected]> Merge pull request #1346 from lukabavdaz/feature/CryogenicSMS-update
Changes proposed in this pull request:
@jenshnielsen