Skip to content

Commit

Permalink
Various transient curve bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
rajgiriUW committed Mar 25, 2021
1 parent d176691 commit 528691d
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 54 deletions.
27 changes: 15 additions & 12 deletions src/main/python/general_curve_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ def create_settings(self):
# This setting allows the option to save data to an h5 data file during a run
# All settings are automatically added to the Microscope user interface

self.settings.New('V_%s_start' % self.SWEEP, unit = 'V', si = True, initial = -0.7)
self.settings.New('V_%s_finish' % self.SWEEP, unit = 'V', si = True, initial = 0.0)
self.settings.New('V_%s_step_size' % self.SWEEP, unit = 'V', si = True, initial = 0.1)
self.settings.New('V_%s_start' % self.SWEEP, unit = 'V', si = True, initial = -0.7, spinbox_decimals = 3, spinbox_step=0.025)
self.settings.New('V_%s_finish' % self.SWEEP, unit = 'V', si = True, initial = 0.0, spinbox_decimals = 3, spinbox_step=0.025)
self.settings.New('V_%s_step_size' % self.SWEEP, unit = 'V', si = True, initial = 0.025, spinbox_decimals = 3, spinbox_step=0.025)
self.settings.New('%s_sweep_preread_delay' % self.SWEEP, unit = 'ms', si = True, initial = 5000)
self.settings.New('%s_sweep_delay_between_averages' % self.SWEEP, unit = 'ms', si = True, initial = 200)
self.settings.New('%s_sweep_software_averages' % self.SWEEP, int, initial = 5, vmin = 1)
self.settings.New('%s_sweep_first_bias_settle' % self.SWEEP, unit = 'ms', si = True, initial = 2000)

self.settings.New('%s_sweep_return_sweep' % self.SWEEP, bool, initial = True)
self.settings.New('V_%s' % self.CONSTANT, unit = 'V', si = True, initial = -0.6)
self.settings.New('V_%s' % self.CONSTANT, unit = 'V', si = True, initial = -0.6, spinbox_decimals = 3, spinbox_step=0.025)

# Define how often to update display during a run
self.display_update_period = 0.1
Expand Down Expand Up @@ -217,9 +217,10 @@ def pre_run(self):
#prepare hardware for read
self.sweep_device.write_output_on()
self.constant_device.write_output_on()
self.source_voltage = self.v_sweep_start - self.v_sweep_step_size
self.source_voltage = self.v_sweep_start
self.sweep_device.source_V(self.source_voltage)
self.constant_device.source_V(self.v_constant)

time.sleep(self.first_bias_settle * .001)
self.doing_return_sweep = False

Expand All @@ -236,14 +237,13 @@ def run(self):
self.finished = False # flag for post-run

if self.is_test_wrapper:

# Avoids the cycles parameter
self.do_sweep()
if self.return_sweep:
self.doing_return_sweep = True

else:
self.num_cycles = self.settings['num_cycles']
print(self.num_cycles)

for cycle in range(self.num_cycles):
self.do_sweep()
Expand All @@ -265,7 +265,7 @@ def do_sweep(self):
num_steps -= 1

for i, v in enumerate(self.voltages):

self.sweep_device.source_V(v)
time.sleep(self.preread_delay * .001)
current_readings = self.read_currents()
Expand All @@ -283,8 +283,6 @@ def do_sweep(self):
if self.interrupt_measurement_called:
break



def read_currents(self):
'''
Read both sourcemeters, taking software averages.
Expand Down Expand Up @@ -338,4 +336,9 @@ def check_filename(self, append):
if samplename == "":
self.app.settings['sample'] = int(time.time())
if (os.path.exists(directory+"/"+filename)):
self.app.settings['sample'] = samplename + str(int(time.time()))

for i in range(100): #hard limit of 100 checks

if not (os.path.exists(directory+"/"+samplename + '_' + str(i) + '_' + append)):
self.app.settings['sample'] = samplename + '_' + str(i) + '_'
break
4 changes: 2 additions & 2 deletions src/main/python/keithley2400_sourcemeter_hc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def setup(self):
self.autorange = self.settings.New('autorange', bool, initial = self.AUTORANGE_DEFAULT)
self.source_mode = self.settings.New('source_mode', str, choices = {'VOLT', 'CURR'}, initial = self.SOURCE_MODE_DEFAULT)
self.manual_range = self.settings.New('manual_range', str, choices = self.i_ranges.keys(), initial = self.MANUAL_RANGE_DEFAULT)
self.current_compliance = self.settings.New('current_compliance', unit='A', initial = self.CURRENT_COMPLIANCE_DEFAULT)
self.voltage_compliance = self.settings.New('voltage_compliance', unit='V', initial = self.VOLTAGE_COMPLIANCE_DEFAULT)
self.current_compliance = self.settings.New('current_compliance', unit='A', initial = self.CURRENT_COMPLIANCE_DEFAULT, spinbox_decimals = 7, spinbox_step=0.000001)
self.voltage_compliance = self.settings.New('voltage_compliance', unit='V', initial = self.VOLTAGE_COMPLIANCE_DEFAULT, spinbox_decimals = 3, spinbox_step=0.001)
self.NPLC = self.settings.New('NPLC', initial = self.NPLC_DEFAULT)

def connect(self):
Expand Down
18 changes: 9 additions & 9 deletions src/main/python/test_device_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ def switch_setting(self):
'''
Switch class variables and sweep/constant hardware references. Used for going between handling transfer and output measurements.
'''
sweep_temp = self.SWEEP
constant_temp = self.CONSTANT
self.SWEEP = constant_temp
self.CONSTANT = sweep_temp
self.SWEEP, self.CONSTANT = self.CONSTANT, self.SWEEP
if (hasattr(self, 'constant_hw') and hasattr(self, 'sweep_hw')):
sweep_hw_temp = self.sweep_hw
constant_hw_temp = self.constant_hw
self.sweep_hw = constant_hw_temp
self.constant_hw = sweep_hw_temp
self.sweep_hw, self.constant_hw = self.constant_hw, self.sweep_hw

def setup(self):
self.name = "TestDevice"
Expand Down Expand Up @@ -126,8 +120,13 @@ def run(self):
self.read_settings = self.output_read_from_settings
self.num_output_curves = self.settings['number_of_output_curves'] = int(self.ui.num_output_curves_doubleSpinBox.value())
self.output_v_g_values = self.read_output_v_g_spinboxes()

if self.interrupt_measurement_called:
self.interrupt_measurement_called = False

print(self.output_v_g_values)
for v_g_value in self.output_v_g_values:

GeneralCurveMeasure.pre_run(self)
self.ui.v_g_doubleSpinBox.setValue(v_g_value)
self.v_constant = self.settings['V_G'] = v_g_value
Expand All @@ -136,7 +135,7 @@ def run(self):
GeneralCurveMeasure.post_run(self)
self.sweep_device.source_V(self.v_sweep_start)
time.sleep(self.preread_delay * .001)
self.source_voltage = self.v_sweep_start - self.v_sweep_step_size
self.source_voltage = self.v_sweep_start
self.READ_NUMBER += 1
self.READ_NUMBER = 1 #reset file numbering
self.switch_setting() #configure variables for transfer curve again
Expand Down Expand Up @@ -193,6 +192,7 @@ def output_read_from_settings(self):
self.output_preread = self.preread_delay # for config file
self.output_first_bias_settle = self.first_bias_settle


def read_output_v_g_spinboxes(self):
output_v_g_values = np.zeros(self.num_output_curves)
for i in range(self.num_output_curves):
Expand Down
21 changes: 13 additions & 8 deletions src/main/python/transient_step_response_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def setup(self):
self.ui_filename = self.app.appctxt.get_resource("transient_step_response.ui")
self.ui = load_qt_ui_file(self.ui_filename)

self.settings.New('drain_bias', unit = 'V', initial = -.6)
self.settings.New('drain_bias', unit = 'V', initial = -0.6)
self.settings.New('first_bias_settle', unit = 'ms', initial = 2000)
self.settings.New('initial_gate_setting', unit = 'V', initial = 0)
self.settings.New('initial_gate_setting', unit = 'V/A', initial = 0, spinbox_decimals = 8, spinbox_step=0.000001)
self.settings.New('delay_gate', unit = 's', initial = 10)
self.settings.New('setpoint', unit = 'V', initial = .5)
self.settings.New('gate_time', unit = 's', initial = 10)
self.settings.New('setpoint', unit = 'V/A', initial = -0.5, spinbox_decimals = 8, spinbox_step=0.000001)
self.settings.New('gate_time', unit = 's', initial = 10, spinbox_decimals = 1, spinbox_step=1)
self.settings.New('software_averages', int, initial = 1)
self.settings.New('delay_between_averages', unit = 'ms', initial = 100)
self.settings.New('total_measurement_time', unit = 's', initial = 30)
Expand Down Expand Up @@ -276,16 +276,16 @@ def post_run(self):
'''
self.g_device.reset()
self.ds_device.reset()
append = '_new_current_vs_time.txt'
append = '_current_vs_time.txt'
self.check_filename(append)

v_ds_info = 'V_DS =\t%g' % self.drain_bias
info_footer = v_ds_info

if self.g_source_mode == 'VOLT':
info_header = 'Time (ms)\tV_G (V)\tI_DS(A)\tI_DS error(A)\tI_G(A)\tI_G error(A)'
info_header = 'Time (ms)\tV_G (V)\tI_DS (A)\tI_DS error(A)\tI_G (A)\tI_G error(A)'
else:
info_header = 'Time (ms)\tI_G (A)\tI_DS(A)\tI_DS error(A)\tV_G(V)\tI_G error(A)'
info_header = 'Time (ms)\tI_G (A)\tI_DS (A)\tI_DS error(A)\tV_G (V)\tI_G error(A)'
np.savetxt(self.app.settings['save_dir'] + "/" + self.app.settings['sample'] + append,
self.save_array[:self.n_pts,:], fmt = '%.10f', delimiter='\t',
comments='', header = info_header, footer = info_footer)
Expand All @@ -301,4 +301,9 @@ def check_filename(self, append):
if samplename == "":
self.app.settings['sample'] = int(time.time())
if (os.path.exists(directory+"/"+filename)):
self.app.settings['sample'] = samplename + str(int(time.time()))

for i in range(100): #hard limit of 100 checks

if not (os.path.exists(directory+"/"+samplename + '_' + str(i) + '_' + append)):
self.app.settings['sample'] = samplename + '_' + str(i) + '_'
break
27 changes: 24 additions & 3 deletions src/main/resources/base/general_curve.ui
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="v_sweep_start_doubleSpinBox"/>
<widget class="QDoubleSpinBox" name="v_sweep_start_doubleSpinBox">
<property name="decimals">
<number>3</number>
</property>
<property name="singleStep">
<double>0.025000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="v_sweep_finish_label">
Expand All @@ -47,7 +54,14 @@
</widget>
</item>
<item row="0" column="3">
<widget class="QDoubleSpinBox" name="v_sweep_finish_doubleSpinBox"/>
<widget class="QDoubleSpinBox" name="v_sweep_finish_doubleSpinBox">
<property name="decimals">
<number>3</number>
</property>
<property name="singleStep">
<double>0.025000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="v_sweep_step_size_label">
Expand All @@ -60,7 +74,14 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="v_sweep_step_size_doubleSpinBox"/>
<widget class="QDoubleSpinBox" name="v_sweep_step_size_doubleSpinBox">
<property name="decimals">
<number>3</number>
</property>
<property name="singleStep">
<double>0.025000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_10">
Expand Down
60 changes: 40 additions & 20 deletions src/main/resources/base/transient_step_response.ui
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@
<string>Keithley 2400 1 (G)</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QComboBox" name="source_mode_comboBox">
<item>
<property name="text">
<string>VOLT</string>
</property>
</item>
<item>
<property name="text">
<string>CURR</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="voltage_compliance_g_doubleSpinBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
Expand All @@ -63,9 +80,6 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="current_compliance_g_doubleSpinBox"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
Expand All @@ -76,8 +90,15 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="voltage_compliance_g_doubleSpinBox"/>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="current_compliance_g_doubleSpinBox">
<property name="decimals">
<number>11</number>
</property>
<property name="singleStep">
<double>0.000010000000000</double>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
Expand All @@ -89,20 +110,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="source_mode_comboBox">
<item>
<property name="text">
<string>VOLT</string>
</property>
</item>
<item>
<property name="text">
<string>CURR</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -286,7 +293,20 @@
</widget>
</item>
<item row="4" column="2" colspan="2">
<widget class="QDoubleSpinBox" name="gate_time_doubleSpinBox"/>
<widget class="QDoubleSpinBox" name="gate_time_doubleSpinBox">
<property name="prefix">
<string/>
</property>
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>103.989999999999995</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="8" column="2" colspan="2">
<widget class="QDoubleSpinBox" name="delay_between_averages_doubleSpinBox"/>
Expand Down

0 comments on commit 528691d

Please sign in to comment.