From cad61d714ad1210a36b434e8014cb997ecd4ea79 Mon Sep 17 00:00:00 2001 From: sanahabhimani <47642420+sanahabhimani@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:18:37 -0400 Subject: [PATCH] LS372 Agent: Add ability in config file to set channel resistance range (#500) * add resistance range ability to config file task * change resistance range of channel iff autorange off * move log statement up to elif condition * add the closest valid range set in the log statement * add resistance_range to config file example * fix for not adding resistance range line for all channels in config file ex * fix calibration_curve_num type in docs * add note about float and fix example accordingly --- docs/agents/lakeshore372.rst | 20 +++++++++++++++++--- socs/agents/lakeshore372/agent.py | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/agents/lakeshore372.rst b/docs/agents/lakeshore372.rst index cb44cd89b..80e6d4f6f 100644 --- a/docs/agents/lakeshore372.rst +++ b/docs/agents/lakeshore372.rst @@ -59,6 +59,7 @@ Lakeshore 372 configuration file:: excitation_mode: 'voltage' excitation_value: 2.0e-6 autorange: 'on' + resistance_range: 2e3 dwell: 15 # seconds pause: 10 # seconds calibration_curve_num: 23 @@ -68,9 +69,10 @@ Lakeshore 372 configuration file:: excitation_mode: 'voltage' excitation_value: 2.0e-6 autorange: 'off' + resistance_range: 2.0e+3 dwell: 10 # seconds pause: 3 # seconds - calibruation_curve_num: 28 + calibration_curve_num: 28 temperature_coeff: 'negative' LSA2761: device_settings: @@ -81,6 +83,7 @@ Lakeshore 372 configuration file:: excitation_mode: 'voltage' excitation_value: 2.0e-6 autorange: 'on' + resistance_range: 2.0e+3 dwell: 15 # seconds pause: 10 # seconds calibration_curve_num: 33 @@ -90,15 +93,17 @@ Lakeshore 372 configuration file:: excitation_mode: 'voltage' excitation_value: 2.0e-6 autorange: 'off' + resistance_range: 2.0e+3 dwell: 10 # seconds pause: 3 # seconds - calibruation_curve_num: 36 + calibration_curve_num: 36 temperature_coeff: 'negative' 3: enable: 'on' excitation_mode: 'voltage' excitation_value: 2.0e-6 autorange: 'on' + resistance_range: 2.0e+3 dwell: 15 # seconds pause: 10 # seconds calibration_curve_num: 34 @@ -108,11 +113,20 @@ Lakeshore 372 configuration file:: excitation_mode: 'voltage' excitation_value: 2.0e-6 autorange: 'off' + resistance_range: 2.0e+3 dwell: 10 # seconds pause: 3 # seconds - calibruation_curve_num: 35 + calibration_curve_num: 35 temperature_coeff: 'negative' +.. note:: + For setting a 372 channel to a specific resistance range, be sure to check + that autorange is set to 'off'. Else, the autorange setting will persist + over your desired resistance range. + +.. note:: + Make sure values like excitation and resistance are in float form as shown + in the example. Ex: always 2.0e+3, never 2e3 Docker Compose `````````````` diff --git a/socs/agents/lakeshore372/agent.py b/socs/agents/lakeshore372/agent.py index 23de66649..b83ec080c 100644 --- a/socs/agents/lakeshore372/agent.py +++ b/socs/agents/lakeshore372/agent.py @@ -1366,6 +1366,10 @@ def input_configfile(self, session, params=None): elif ls_chann_settings[i]['autorange'] == 'off': ls.channels[i].disable_autorange() self.log.info("autorange off") + # set to desired resistance range after disabling autorange + resistance_range = ls_chann_settings[i]['resistance_range'] + ls.channels[i].set_resistance_range(resistance_range) + self.log.info("resistance range for CH.{channel} set to {get_res}, the closest valid range to {res}".format(channel=i, get_res=ls.channels[i].get_resistance_range(), res=resistance_range)) excitation_mode = ls_chann_settings[i]['excitation_mode'] ls.channels[i].set_excitation_mode(excitation_mode)