-
Notifications
You must be signed in to change notification settings - Fork 319
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
Driver/ami430 allow all units & fix warnings as exceptions #954
Conversation
- The driver now supports both kGuass and Tesla, which are both units that are supported by the controller, and allows switching between the two. - In addition, warnings about ramp rate are now just warnings as opposed to exceptions that prevent the driver from initializing.
- Adds new parameters into the test framework
Codecov Report
@@ Coverage Diff @@
## master #954 +/- ##
==========================================
+ Coverage 77.05% 77.08% +0.03%
==========================================
Files 37 37
Lines 5182 5233 +51
==========================================
+ Hits 3993 4034 +41
- Misses 1189 1199 +10 |
|
||
log = logging.getLogger(__name__) | ||
|
||
class AMI430Exception(Exception): |
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.
I do not quite understand why we need to make a custom exception. Can you explain?
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.
Just so that errors that are specific to the instrument state are differentiated from user errors (like ValueError
s) or python errors. I suppose they can be replaced by RuntimeError
s, but this seems like a poor fit given that they are used everywhere, and the error type suggests the error occured within python.
In particular, I imagined using it to detect a failure to sweep field in my own code, then automatically taking action.
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.
Yeah I see your point.
This seems like a good modification to me. I have one comment if you can address that, please. Other than that, good job |
Awesome :) I can't merge, but if you guys are happy can we merge this? |
I think before we can merge we need to make sure all checks pass. It should be quite trivial to make this happen :-) |
@sohailc But the tests are passing? The few issues from Codacy are actually non-issues. See here: pylint-dev/pylint#1609. The |
Even though the lambda's are from before this PR, I think we should take every chance we get to improve code quality. @spauka can you please review the code quality suggestions and make improvements accordingly? They won't take more than a couple of minutes. @WilliamHPNielsen Lets ignore the Codacy issues. |
Oh and obviously please make sure that this branch is up to date with the base branch. |
Hey @sohailc. Regarding Codacy issues:
Regarding code coverage, I guess this refers to the new SwitchHeater class. I can add tests tomorrow. |
@spauka I don't understand. Why can you not change this:
to
? Since "current_ramp_limit" is a class method and not a parameter, this should be fine. |
@sohailc See the above comment. |
You are right. I will merge this branch now after updating it |
Hang on, the CI tests have failed this time. @spauka can you re-run the test by making a trivial change and pushing your code again? |
@sohailc Should be all good :) |
Merged :-) |
@sohailc When the tests fail, you (unfortunately) have to examine why. Travis is very slow at running tests, and a test counts as failed if it exceeds the hypothesis deadline. That puts us in a situation where tests fail not due to problems with the code, but due to heavy load on Travis' servers. It should be pretty easy to deduce from the Travis log what happened. It is not optimal this way, and we should probably increase/disable deadlines if this keeps happening. @jenshnielsen already did this a few times, see #912 and #905. |
We should probably just disable the hypothesis deadline on those tests |
Fixes #952, #953.
In addition, adds a switch heater submodule that allows for setting of SwitchHeater parameters.
Changes proposed in this pull request:
field_ramp_limit
,field_rating
in instrument units, rather than having to convert to Amps.AMI430_SwitchHeater
submodule that allows configuration of switch heater parameters.set_field
,_set_field
andramp_to
. Makesblock
a named parameter.API changes
There are no changes to the public facing API apart from the addition of new features and the deprecation warning on ramp_to.
@sohailc I notice that you're also working on changes to how 3D works in this driver, in PR #910. None of the changes as far as I can tell intersect with yours, but as a result I haven't spent much time adding documentation or extending 3D functionality. Can we chat and discuss how best to add docs and type hints such that we don't conflict?
@jenshnielsen @sohailc