-
Notifications
You must be signed in to change notification settings - Fork 11
Fail the measurement when InstrJob timeout #62
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
ec0e859
585eac0
755e0d0
d1abdb4
177f08a
abe5ed2
ce54d25
5c75205
2c1c96a
b53565f
f53a5b6
55d670f
b032f3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,41 +59,47 @@ def perform(self, target_value=None): | |
|
|
||
| driver = self.driver | ||
| normal_end = True | ||
| if (abs(driver.read_persistent_field() - target_value) > | ||
| driver.output_fluctuations): | ||
| # Only if driver.heater_state == 'Off' otherwise we wait for | ||
| # post_switch_wait no matter what | ||
| if driver.heater_state == 'Off': | ||
| job = driver.sweep_to_persistent_field() | ||
| if job.wait_for_completion(self.check_for_interruption, | ||
| timeout=60, refresh_time=1): | ||
| timeout=60, refresh_time=3): | ||
| driver.heater_state = 'On' | ||
| sleep(self.post_switch_wait) | ||
| else: | ||
| return False | ||
|
|
||
| if (abs(driver.read_persistent_field() - target_value) > | ||
| driver.output_fluctuations): | ||
| # set the magnetic field | ||
| job = driver.sweep_to_field(target_value, self.rate) | ||
| normal_end = job.wait_for_completion(self.check_for_interruption, | ||
| timeout=60, | ||
| refresh_time=10) | ||
| print('field:', driver.read_persistent_field()) | ||
|
||
|
|
||
| # Always close the switch heater when the ramp was interrupted. | ||
| if not normal_end: | ||
| job.cancel() | ||
| driver.heater_state = 'Off' | ||
| sleep(self.post_switch_wait) | ||
| job.cancel() # stops the sweep and turn off the switch heater | ||
|
||
| self.write_in_database('field', driver.read_persistent_field()) | ||
| return False | ||
| # if not normal_end, fail the measurement | ||
| self.root.should_stop.set() | ||
| raise ValueError(cleandoc('''Field source did not set the field to | ||
|
||
| {}'''.format(target_value))) | ||
|
|
||
| # turn off heater | ||
| # turn off heater if required | ||
| if self.auto_stop_heater: | ||
| driver.heater_state = 'Off' | ||
| sleep(self.post_switch_wait) | ||
| job = driver.sweep_to_field(0) | ||
| # sweep down to zero at the fast sweep rate | ||
| job = driver.sweep_to_field(0, driver.fast_sweep_rate) | ||
| job.wait_for_completion(self.check_for_interruption, | ||
| timeout=60, refresh_time=1) | ||
| timeout=60, refresh_time=3) | ||
|
|
||
| self.write_in_database('field', target_value) | ||
|
|
||
|
|
||
| class ApplyMagFieldAndDropTask(InstrumentTask): | ||
| """Use a supraconducting magnet to apply a magnetic field. Parallel task. | ||
|
|
||
|
|
||
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.
Why this change in behavior ?
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.
It was specified in the job after job.cancel() was called (which in turn calls this method), it is more logical to integrate it directly to the method called as cancel()
Uh oh!
There was an error while loading. Please reload this page.
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 disagree, you may stop a sweep but need to run a new one right after in which case automatically closing the switch heater would be a bad idea (this is hypothetical). Also if you wanted to go that way you need to be sure all driver are consistent.