keithley2410

Keithley2410 class for Keithley 2410 source-measure unit.

Classes

Keithley2410(*args, **kwargs)

SCPIInstrument implementation for Keithley2410 source-measure unit.

Keithley2410

class icicle.keithley2410.Keithley2410(*args, **kwargs)

Bases: SCPIInstrument

SCPIInstrument implementation for Keithley2410 source-measure unit.

__init__(resource='ASRL1::INSTR', sim=False)
Parameters:

resource – VISA Resource address. See VISA docs for more info.

BAUD_RATE = 9600

Serial link Baud rate.

COM_CLEAR_TRACE = ':TRAC:CLE'

Clear trace SCPI command.

COM_DEVICE_CLEAR = 'DCL'

Device Clear SCPI command.

COM_RESET = '*RST; STATUS:PRESET; *CLS'

Instrument Reset SCPI command.

COM_SELFTEST = '*TST?'

Selftest SCPI command.

MEASURE_TYPES = {'CURR:DC': 'DC Current (A)', 'RES': 'Resistance (Ohm)', 'VOLT:DC': 'DC Voltage (V)'}

Measurement types for this instrument.

MEASURE_TYPE_MAP = {'CURR:DC': 1, 'RES': 2, 'VOLT:DC': 0}
class MeasureChannel(instrument, channel, measure_type, unit='')

Bases: MeasureChannel

MeasureChannel implementation for Keithley2410.

property status
Returns:

Measurement Status Register value.

property value

Performs measurement and returns value.

Returns:

measured value.

Return type:

float

OUTPUTS = 1
class PowerChannel(instrument, channel, measure_voltage, measure_current)

Bases: PowerChannel

PowerChannel implementation for Keithley2410.

property current
Returns:

currently set channel current.

Return type:

float

property current_limit
Returns:

currently set channel current limit.

Return type:

float

property current_trip
Returns:

whether current limit has been tripped on this channel.

Return type:

bool

reset_current_trip()

Attempts to reset current trip condition.

Returns:

success/failure of operation.

Return type:

bool

reset_voltage_trip()

Attempts to reset voltage trip condition.

Returns:

success/failure of operation.

Return type:

bool

property source_mode
property state
Returns:

whether this power channel is on or off (True/False).

Return type:

bool

property status
Returns:

Measurement Status Register value.

property voltage
Returns:

currently set channel voltage.

Return type:

float

property voltage_limit
Returns:

currently set channel voltage limit.

Return type:

float

property voltage_trip
Returns:

whether voltage limit has been tripped on this channel.

Return type:

bool

REGISTERS = {'EVENT_STATUS_REGISTER': 'Event Status Register', 'QUESTIONABLE_STATUS_REGISTER': 'Questionable Status Register', 'STATUS_BYTE': 'Status Byte'}
SETTINGS = {'AUTODELAY': {'QUERY': ':SOUR:DEL:AUTO?', 'SET': ':SOUR:DEL:AUTO {}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'AUTOZERO': {'QUERY': ':SYS:AZER:STAT?', 'SET': ':SYST:AZER:STAT {}', 'verifier': <function is_in.<locals>._is_in>}, 'AVERAGING_COUNT': {'QUERY': ':SENS:AVER:COUN?', 'SET': ':SENS:AVER:COUN {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'AVERAGING_FUNCTION': {'QUERY': ':SENS:AVER:TCON?', 'SET': ':SENS:AVER:TCON {}', 'verifier': <function is_in.<locals>._is_in>}, 'COMPLIANCE_CURRENT': {'QUERY': ':SENS:CURR:PROT?', 'SET': ':SENS:CURR:PROT {}', 'parser': <function numeric_float>, 'verifier': <function verifier_or.<locals>._verifier_or>}, 'COMPLIANCE_CURRENT_TRIPPED': {'QUERY': ':SENS:CURR:PROT:TRIP?', 'parser': <function numeric_bool>}, 'COMPLIANCE_VOLTAGE': {'QUERY': ':SENS:VOLT:PROT?', 'SET': ':SENS:VOLT:PROT {}', 'parser': <function numeric_float>, 'verifier': <function verifier_or.<locals>._verifier_or>}, 'COMPLIANCE_VOLTAGE_TRIPPED': {'QUERY': ':SENS:VOLT:PROT:TRIP?', 'parser': <function numeric_bool>}, 'CURRENT': {'QUERY': ':SOUR:CURR:LEV?', 'SET': ':SOUR:CURR:LEV {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT_RANGE': {'QUERY': ':SOUR:CURR:RANG?', 'SET': ':SOUR:CURR:RANG {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURRENT_RANGE_AUTO': {'QUERY': ':SOUR:CURR:RANG:AUTO?', 'SET': ':SOUR:CURR:RANG:AUTO {}', 'verifier': <function truthy.<locals>._truthy>}, 'CURR_MODE': {'QUERY': ':SOUR:CURR:MODE?', 'SET': ':SOUR:CURR:MODE {}', 'verifier': <function is_in.<locals>._is_in>}, 'CURR_SWEEP_END': {'QUERY': ':SOUR:CURR:END?', 'SET': ':SOUR:CURR:END {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURR_SWEEP_START': {'QUERY': ':SOUR:CURR:START?', 'SET': ':SOUR:CURR:START {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'CURR_SWEEP_STEP': {'QUERY': ':SOUR:CURR:STEP?', 'SET': ':SOUR:CURR:STEP {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'DELAY': {'QUERY': ':SOUR:DEL?', 'SET': ':SOUR:DEL {}', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'ENABLE_AVERAGING': {'QUERY': ':SENS:AVER?', 'SET': ':SENS:AVER {}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'EVENT_STATUS_REGISTER': {'QUERY': '*ESR?', 'parser': <function numeric_int>}, 'EVENT_STATUS_REGISTER_ENABLE': {'QUERY': '*ESE?', 'SET': '*ESE {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'IDENTIFIER': {'QUERY': '*IDN?'}, 'LINE_INTEGRATION_CYCLES': {'QUERY': ':SENS:{}:NPLC?', 'SET': ':SENS:{}:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': (<function is_in.<locals>._is_in>, <function is_numeric.<locals>._is_numeric>)}, 'MEASURE': {'QUERY': ':MEAS{}?', 'parser': <function float_list.<locals>.float_list_>, 'verifier': <function is_in.<locals>._is_in>}, 'MEASUREMENT_STATUS_REGISTER': {'QUERY': ':STAT:MEAS:EVEN?', 'parser': <function numeric_int>}, 'MEASUREMENT_STATUS_REGISTER_ENABLE': {'QUERY': ':STAT:MEAS:ENAB?', 'SET': ':STAT:MEAS:ENAB {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'OCP': {'QUERY': ':SENS:CURR:PROT?', 'SET': ':SENS:CURR:PROT {}', 'parser': <function numeric_float>, 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OCP_TRIPPED': {'QUERY': ':SENS:CURR:PROT:TRIP?', 'parser': <function numeric_bool>}, 'OUTPUT': {'QUERY': ':OUTP?', 'SET': ':OUTP {}', 'verifier': <function truthy.<locals>._truthy>}, 'OVP': {'QUERY': ':SENS:VOLT:PROT?', 'SET': ':SENS:VOLT:PROT {}', 'parser': <function numeric_float>, 'verifier': <function verifier_or.<locals>._verifier_or>}, 'OVP_TRIPPED': {'QUERY': ':SENS:VOLT:PROT:TRIP?', 'parser': <function numeric_bool>}, 'PANEL': {'QUERY': ':ROUT:TERM?', 'SET': ':ROUT:TERM {}', 'verifier': <function is_in.<locals>._is_in>}, 'QUESTIONABLE_DATA_REGISTER': {'QUERY': ':STAT:QUES:EVEN?', 'parser': <function numeric_int>}, 'QUESTIONABLE_DATA_REGISTER_ENABLE': {'QUERY': ':STAT:QUES:ENAB?', 'SET': ':STAT:QUES:ENAB {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'READ': {'QUERY': ':READ?', 'parser': <function float_list.<locals>.float_list_>}, 'SENSE_AVERAGING': {'QUERY': ':SENS:AVER?', 'SET': ':SENS:AVER {}', 'parser': <function numeric_bool>, 'verifier': <function truthy.<locals>._truthy>}, 'SENSE_AVERAGING_COUNT': {'QUERY': ':SENS:AVER:COUN?', 'SET': ':SENS:AVER:COUN {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'SENSE_AVERAGING_TYPE': {'QUERY': ':SENS:AVER:TCON?', 'SET': ':SENS:AVER:TCON {}', 'verifier': <function is_in.<locals>._is_in>}, 'SENSE_CURRENT_INTEGRATION': {'QUERY': ':SENS:CURR:DC:NPLC?', 'SET': ':SENS:CURR:DC:NPLC {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_CURRENT_RANGE': {'QUERY': ':SENS:CURR:RANG?', 'SET': ':SENS:CURR:RANG {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_CURRENT_RANGE_AUTO': {'QUERY': ':SENS:CURR:RANG:AUTO?', 'SET': ':SENS:CURR:RANG:AUTO {}', 'verifier': <function truthy.<locals>._truthy>}, 'SENSE_FUNCTION': {'QUERY': ':SENS:FUNC?', 'SET': ':SENS:FUNC "{}"', 'parser': <function strip_str.<locals>._strip_str>, 'verifier': <function is_in.<locals>._is_in>}, 'SENSE_RESISTANCE_INTEGRATION': {'QUERY': ':SENS:RES:NPLC?', 'SET': ':SENS:RES:NPLC {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_VOLTAGE_INTEGRATION': {'QUERY': ':SENS:VOLT:DC:NPLC?', 'SET': ':SENS:VOLT:DC:NPLC {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_VOLTAGE_RANGE': {'QUERY': ':SENS:VOLT:RANG?', 'SET': ':SENS:VOLT:RANG {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_VOLTAGE_RANGE_AUTO': {'QUERY': ':SENS:VOLT:RANG:AUTO?', 'SET': ':SENS:VOLT:RANG:AUTO {}', 'verifier': <function truthy.<locals>._truthy>}, 'SOURCE': {'QUERY': ':SOUR:FUNC?', 'SET': ':SOUR:FUNC {}', 'parser': <function str_map.<locals>.str_map_>, 'verifier': <function map_to.<locals>._is_in>}, 'SOURCE_FUNCTION': {'QUERY': ':SOUR:FUNC?', 'SET': ':SOUR:FUNC {}', 'parser': <function str_map.<locals>.str_map_>, 'verifier': <function map_to.<locals>._is_in>}, 'STATUS_BYTE': {'QUERY': '*STB?', 'parser': <function numeric_int>}, 'STATUS_BYTE_ENABLE': {'QUERY': '*SRE?', 'SET': '*SRE {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'SWEEP_DIRECTION': {'QUERY': ':SOUR:SWE:DIR?', 'SET': ':SOUR:SWE:DIR {}', 'verifier': <function is_in.<locals>._is_in>}, 'SWEEP_ENABLE': {'QUERY': ':SOUR:{}:MODE?', 'SET': ':SOUR:{}:MODE {}', 'parser': <function truthy_bool.<locals>._truthy>, 'verifier': (<function is_in.<locals>._is_in>, <function truthy.<locals>._truthy>)}, 'SWEEP_END': {'QUERY': ':SOUR:{}:END?', 'SET': ':SOUR:{}:END {}', 'parser': <function numeric_float>, 'verifier': (<function is_in.<locals>._is_in>, <function is_numeric.<locals>._is_numeric>)}, 'SWEEP_POINTS': {'QUERY': ':SOUR:SWE:POIN?', 'SET': ':SOUR:SWE:POINT {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'SWEEP_RANGE': {'QUERY': ':SOUR:SWE:RANG?', 'SET': ':SOUR:SWE:RANG {}', 'verifier': <function is_in.<locals>._is_in>}, 'SWEEP_SPACE': {'QUERY': ':SOUR:SWE:SPAC?', 'SET': ':SOUR:SWE:SPAC {}', 'verifier': <function is_in.<locals>._is_in>}, 'SWEEP_START': {'QUERY': ':SOUR:{}:START?', 'SET': ':SOUR:{}:START {}', 'parser': <function numeric_float>, 'verifier': (<function is_in.<locals>._is_in>, <function is_numeric.<locals>._is_numeric>)}, 'SWEEP_STEP': {'QUERY': ':SOUR:{}:STEP?', 'SET': ':SOUR:{}:STEP {}', 'parser': <function numeric_float>, 'verifier': (<function is_in.<locals>._is_in>, <function is_numeric.<locals>._is_numeric>)}, 'SYSTEM_MODE': {'QUERY': ':SYST:RWL?', 'SET': ':SYST:{}', 'parser': <function int_map.<locals>.int_map_>, 'verifier': <function map_to.<locals>._is_in>}, 'TRIGGER_COUNT': {'QUERY': ':TRIG:COUN?', 'SET': ':TRIG:COUN {}', 'parser': <function numeric_int>, 'verifier': <function verifier_or.<locals>._verifier_or>}, 'TRIGGER_DELAY': {'QUERY': ':TRIG:DEL?', 'SET': ':TRIG:DEL {:.3f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'TRIGGER_SOURCE': {'QUERY': ':TRIG:SOUR?', 'SET': ':TRIG:SOUR {}', 'verifier': <function is_in.<locals>._is_in>}, 'TRIGGER_TIMER': {'QUERY': ':TRIG:TIM?', 'SET': ':TRIG:TIM {:.3f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE': {'QUERY': ':SOUR:VOLT:LEV?', 'SET': ':SOUR:VOLT:LEV {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_MODE': {'QUERY': ':SOUR:VOLT:MODE?', 'SET': ':SOUR:VOLT:MODE {}', 'parser': <function numeric_float>, 'verifier': <function is_in.<locals>._is_in>}, 'VOLTAGE_RANGE': {'QUERY': ':SOUR:VOLT:RANG?', 'SET': ':SOUR:VOLT:RANG {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_RANGE_AUTO': {'QUERY': ':SOUR:VOLT:RANG:AUTO?', 'SET': ':SOUR:VOLT:RANG:AUTO {}', 'verifier': <function truthy.<locals>._truthy>}, 'VOLTAGE_SWEEP_END': {'QUERY': ':SOUR:VOLT:END?', 'SET': ':SOUR:VOLT:END {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_SWEEP_START': {'QUERY': ':SOUR:VOLT:START?', 'SET': ':SOUR:VOLT:START {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_SWEEP_STEP': {'QUERY': ':SOUR:VOLT:STEP?', 'SET': ':SOUR:VOLT:STEP {}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}}

Settings dictionary with all Set/Query SCPI combinations.

SOURCE_TYPES = {'CURR:DC': 'DC Current (A)', 'VOLT:DC': 'DC Voltage (V)'}
TIMEOUT = 10000

Serial link timeout (ms).

change_voltage_range(positive)

Change to predefined software voltage range limit.

Parameters:

positive – If true, limit is set to -1mV < V_set < 1kV. Else, limit is set to -1kV < V_set < 1mV.

clear_trace()

Clears measurement trace.

Parameters:
  • no_lock – override acquire_lock (e.g. if lock already taken by function that set-call is nested within).

  • attempts – how many retries to give set command.

Returns:

result of COM_CLEAR_TRACE SCPI command.

device_clear()

Send Device Clear command.

Parameters:

no_lock – override acquire_lock (e.g. if lock already taken by function that device_clear-call is nested within).

Returns:

result of COM_DCL SCPI command.

measure(repetitions=1, delay=None, clear_trace=True, paste=False, measured_unit=None)

Measure output voltage, current averaged over repetitions measurements.

Parameters:
  • repetitions – how many measurements to make. Defaults to 1.

  • delay – delay between measurements. Only used when repetitions > 1.

  • clear_trace – whether to clear trace after measurements. Defaults to True.

  • no_lock – override acquire_lock (e.g. if lock already taken by function that measure-call is nested within).

Returns:

tuple of (volts, amps, ohms, timestamp, filter), averaged over measurements.

measure_single(clear_trace=True, **kwargs)

Perform single measurement.

Parameters:
  • clear_trace – whether to clear trace after measurements. Defaults to True.

  • no_lock – override acquire_lock (e.g. if lock already taken by function that measure_single-call is nested within).

Returns:

tuple of (volts, amps, ohms, timestamp, filter).

off(**kwargs)

Turn output off.

Parameters:
  • no_lock – override acquire_lock (e.g. if lock already taken by function that off-call is nested within).

  • attempts – how many retries to give set command.

Returns:

result of set(…).

on(**kwargs)

Turn output on.

Parameters:
  • no_lock – override acquire_lock (e.g. if lock already taken by function that on-call is nested within).

  • attempts – how many retries to give set command.

Returns:

result of set(…).

publish(client, line, topic=None)

Publish data line (from Monitoring) to MQTT.

TODO: don’t reparse line here; instead pass/access raw data?

Parameters:
  • client – MQTTClient object.

  • line – logfile line from MonitoringLogger.

reset()

Resets the instrument and clears the queue.

Parameters:
  • no_lock – override acquire_lock (e.g. if lock already taken by function that reset-call is nested within).

  • attempts – how many retries to give set command.

Returns:

result of status:queue:clear;*RST;:stat:pres;:*CLS; SCPI command.

selftest()

Run self-test.

Parameters:

no_lock – override acquire_lock (e.g. if lock already taken by function that set-call is nested within).

Returns:

result of COM_SELFTEST SCPI command.

set_voltage_range(low, high)

Set a voltage range limit on this instrument.

Parameters:
  • low – Low voltage limit in V.

  • high – High voltage limit in V.

status(**kwargs)

Read output status.

Parameters:
  • no_lock – override acquire_lock (e.g. if lock already taken by function that status-call is nested within).

  • attempts – how many retries to give set command.

Returns:

result of query(…).

sweep_print_header(measured_unit=None)

Returns the header for print-outs, when doing a sweep. Helper function of instrument.sweep()

Parameters:

measured_unit – not needed here. Is used in some cases, where a different device does the measurement than the sweep.

validate_channel(channel, raise_exception=True)

Check if a power channel exists on this device. Only successful if channel == 1.

Parameters:

channel – Channel number to validate as an input