-
Notifications
You must be signed in to change notification settings - Fork 13
LS372: query sample heater output #505
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 all commits
3942837
0139fe8
f977536
539fd8f
25e124b
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 |
---|---|---|
|
@@ -14,6 +14,9 @@ | |
|
||
from socs.Lakeshore.Lakeshore372 import LS372 | ||
|
||
heater_display_key = {'1': 'current', | ||
'2': 'power'} | ||
|
||
|
||
def still_power_to_perc(power, res, lead, max_volts): | ||
cur = np.sqrt(power / res) | ||
|
@@ -461,6 +464,42 @@ def set_heater_range(self, session, params): | |
|
||
return True, f'Set {heater_string} heater range to {params["range"]}' | ||
|
||
@ocs_agent.param('_') | ||
def get_sample_output(self, session, params): | ||
"""get_sample_output() | ||
|
||
**Task** - Query sample heater ouput (res, display mode, output in %) | ||
for servoing cryostat. | ||
|
||
Notes: | ||
The sample heater output is stored in the session data | ||
object in the format:: | ||
|
||
>>> response.session['data'] | ||
{'sample_resistance': 1020.0, | ||
'display_mode': 'current', | ||
'heater_power_percent': 0.0005} | ||
|
||
""" | ||
with self._lock.acquire_timeout(job='get_sample_output') as acquired: | ||
if not acquired: | ||
self.log.warn(f"Could not start Task because " | ||
f"{self._lock.job} is already running") | ||
return False, "Could not acquire lock" | ||
|
||
session.set_status('running') | ||
|
||
heater_perc = self.module.sample_heater.get_sample_heater_output() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe this necessarily always return a percentage. Whether this is a percentage of the current set for the heater range or in power depends on heater output selection (aka "display mode") of either "current" or "power". We should generalize the field you have as 'heater_power_percent' to 'heater_value'. Adding a "units" field would be reasonable. ocs-web could use that for a good display of heater output. |
||
heater_settings = self.module.sample_heater.get_heater_setup() | ||
res = float(heater_settings[0]) | ||
display_mode = heater_display_key[heater_settings[3]] | ||
sanahabhimani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
session.data = {"sample_resistance": res, | ||
"display_mode": display_mode, | ||
"heater_power_percent": heater_perc} | ||
|
||
return True, 'Sample heater res {} ohms, display mode set to {} at {}%'.format(res, display_mode, heater_perc) | ||
|
||
@ocs_agent.param('channel', type=int, check=lambda x: 1 <= x <= 16) | ||
@ocs_agent.param('mode', type=str, choices=['current', 'voltage']) | ||
def set_excitation_mode(self, session, params): | ||
|
@@ -1442,6 +1481,7 @@ def main(args=None): | |
agent.register_task('set_heater_output', lake_agent.set_heater_output) | ||
agent.register_task('set_still_output', lake_agent.set_still_output) | ||
agent.register_task('get_still_output', lake_agent.get_still_output) | ||
agent.register_task('get_sample_output', lake_agent.get_sample_output) | ||
agent.register_process('acq', lake_agent.acq, lake_agent._stop_acq) | ||
agent.register_process('custom_pid', lake_agent.custom_pid, lake_agent._stop_custom_pid) | ||
agent.register_task('enable_control_chan', lake_agent.enable_control_chan) | ||
|
Uh oh!
There was an error while loading. Please reload this page.