keithley6500

Keithley6500 class for Keithley 6500 multimeter running in emulation mode.

Classes

Keithley6500(*args, **kwargs)

SCPIInstrument implementation for Keithley6500 multimeter.

Keithley6500

class icicle.keithley6500.Keithley6500(*args, **kwargs)

Bases: SCPIInstrument

SCPIInstrument implementation for Keithley6500 multimeter.

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

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

COM_CLEAR_TRACE = ':TRAC:CLE'

Clear trace SCPI command.

COM_IMMEDIATE_TRIGGER = 'INIT:IMM'

Immediate Trigger SCPI command.

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

Instrument Reset SCPI command.

COM_SELFTEST = '*TST?'

Selftest SCPI command.

MEASURE_TYPES = {'CURR:AC': 'AC Current (A)', 'CURR:DC': 'DC Current (A)', 'FREQ': 'Frequency (Hz)', 'FRES': 'Four-Wire Resistance (Ohm)', 'PER': 'Period (s)', 'RES': 'Resistance (Ohm)', 'VOLT:AC': 'AC Voltage (V)', 'VOLT:DC': 'DC Voltage (V)'}

Measurement types for this instrument.

class MeasureChannel(instrument, channel, measure_type, unit='')

Bases: MeasureChannel

MeasureChannel implementation for Keithley 6500.

property status
Returns:

Status Byte value.

property value

Performs measurement and returns value.

Returns:

measured value.

Return type:

float

REGISTERS = {'EVENT_STATUS_REGISTER': 'Event Status Register', 'MEASUREMENT_STATUS_REGISTER': 'Measurement Status Register', 'QUESTIONABLE_STATUS_REGISTER': 'Questionable Status Register', 'STATUS_BYTE': 'Status Byte'}
SETTINGS = {'AUTODELAY_SWITCH': {'QUERY': ':TRIG:DEL:AUTO?', 'SET': ':TRIG:DEL:AUTO {}', 'parser': <function truthy_bool.<locals>._truthy>, 'verifier': <function truthy.<locals>._truthy>}, 'AUTOZERO': {'QUERY': ':SYS:AZER:STAT?', 'SET': ':SYST:AZER:STAT {}', 'parser': <function truthy_bool.<locals>._truthy>, 'verifier': <function truthy.<locals>._truthy>}, '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>}, 'CONFIGURE': {'QUERY': ':CONF?', 'SET': ':CONF:{}', 'parser': <function strip_str.<locals>._strip_str>, 'verifier': <function is_in.<locals>._is_in>}, 'DELAY': {'QUERY': ':TRIG:DEL?', 'SET': ':TRIG:DEL {:.3f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'ENABLE_AVERAGING': {'QUERY': ':SENS:AVER?', 'SET': ':SENS:AVER {}', 'verifier': <function is_in.<locals>._is_in>}, '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?'}, 'INITIALISE_CONTINUOUS': {'QUERY': ':INIT:CONT?', 'SET': ':INIT:CONT {}', 'parser': <function truthy_bool.<locals>._truthy>, 'verifier': <function truthy.<locals>._truthy>}, '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>)}, 'MEASUREMENT_EVENT_REGISTER': {'QUERY': ':STAT:QUES:ENAB?', 'SET': ':STAT:QUES:ENAB {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'MEASUREMENT_REGISTER': {'QUERY': ':STAT:QUES:EVEN?', 'parser': <function numeric_int>}, '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>}, '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 numeric_float>}, 'SAMPLE_COUNT': {'QUERY': ':SAMP:COUN?', 'SET': ':SAMP:COUN {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'SENSE_AVERAGING': {'QUERY': ':SENS:AVER?', 'SET': ':SENS:AVER {}', 'verifier': <function is_in.<locals>._is_in>}, '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_AC_INTEGRATION': {'QUERY': ':SENS:CURR:AC:NPLC?', 'SET': ':SENS:CURR:AC:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_CURRENT_INTEGRATION': {'QUERY': ':SENS:CURR:NPLC?', 'SET': ':SENS:CURR:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_DATA': {'QUERY': ':SENS:DATA?', 'parser': <function float_list.<locals>.float_list_>}, 'SENSE_FRESISTANCE_INTEGRATION': {'QUERY': ':SENS:FRES:NPLC?', 'SET': ':SENS:FRES:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_FUNCTION': {'QUERY': ':SENS:FUNC?', 'SET': ':SENS:FUNC "{}"', 'verifier': <function is_in.<locals>._is_in>}, 'SENSE_RESISTANCE_INTEGRATION': {'QUERY': ':SENS:RES:NPLC?', 'SET': ':SENS:RES:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_VOLTAGE_AC_INTEGRATION': {'QUERY': ':SENS:VOLT:AC:NPLC?', 'SET': ':SENS:VOLT:AC:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SENSE_VOLTAGE_INTEGRATION': {'QUERY': ':SENS:VOLT:NPLC?', 'SET': ':SENS:VOLT:NPLC {:.2f}', 'parser': <function numeric_float>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'SERVICE_REQUEST_ENABLE': {'QUERY': '*SRE?', 'SET': '*SRE {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, '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>}, 'SYSTEM_MODE': {'SET': ':SYST:{}', 'verifier': <function is_in.<locals>._is_in>}, 'TRACE_BUFFER_CONTROL_MODE': {'QUERY': ':TRAC:FEED:CONT?', 'SET': ':TRAC:FEED:CONT {}', 'verifier': <function is_in.<locals>._is_in>}, 'TRACE_BUFFER_SIZE': {'QUERY': ':TRAC:POIN?', 'SET': ':TRAC:POIN {}', 'parser': <function numeric_int>, 'verifier': <function is_integer.<locals>._is_integer>}, 'TRACE_BUFFER_SOURCE': {'QUERY': ':TRAC:FEED?', 'SET': ':TRAC:FEED {}', 'verifier': <function is_in.<locals>._is_in>}, 'TRACE_DATA': {'QUERY': ':TRAC:DATA?', 'parser': <function float_list.<locals>.float_list_>}, '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_DELAY_AUTO': {'QUERY': ':TRIG:DEL:AUTO?', 'SET': ':TRIG:DEL:AUTO {}', 'parser': <function truthy_bool.<locals>._truthy>, 'verifier': <function truthy.<locals>._truthy>}, '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>}}

Settings dictionary with all Set/Query SCPI combinations.

TIMEOUT = 10000

Serial link timeout (ms).

clear_trace()

Clears measurement trace.

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

  • attempts – how many retries to give set command.

Returns:

result of COM_CLEAR_TRACE SCPI command.

enable_register()

Enables measurement register.

Parameters:

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

Returns:

True-ish value on success.

immediate_trigger()

Send immediate trigger.

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

  • attempts – how many retries to give set command.

Returns:

number of bytes written to serial interface.

measure(what, repetitions=1, delay=None, cycles=1.0, clear_trace=True)

Performs measurement of requested type.

Parameters:
  • what – one of ‘VOLT:DC’, ‘VOLT:AC’, ‘CURR:DC’, ‘CURR:AC’, ‘RES’, ‘FRES’.

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

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

  • cycles – number of line integration cycles for this measurment type. Defaults to 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:

list of measurement values (as floats).

measure_old(what, repetitions=1, delay=None, cycles=1.0, clear_trace=True)

Old implementation of measure().

Doesn’t work reliably - do not use.

measure_single(what, clear_trace=True, **kwargs)

Perform single measurement.

Parameters:
  • what – one of ‘VOLT:DC’, ‘VOLT:AC’, ‘CURR:DC’, ‘CURR:AC’, ‘RES’, ‘FRES’.

  • 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:

measured value (float).

publish(client, line, what, topic=None)

Publish data line (from Monitoring) to MQTT.

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

Parameters:
  • client – MQTTClient object to publish with.

  • line – MonitoringLogger line to publish.

  • channel – which channel the data has been measured for. May be ‘ALL’.

selftest()

Run self-test.

Parameters:

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

Returns:

result of COM_SELFTEST SCPI command.

set_all_line_integrations(line_integration_cycles=1)

Set line integration cycles for all measurement types.

Parameters:
  • line_integration_cycles – number of line integration cycles.

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

Returns:

read-back value from set(…).

set_line_integration(what, line_integration_cycles=1, **kwargs)

Set line integration cycles for given measurement type.

Parameters:
  • what – one of ‘VOLT:DC’, ‘VOLT:AC’, ‘CURR:DC’, ‘CURR:AC’, ‘RES’, ‘FRES’.

  • line_integration_cycles – number of line integration cycles.

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

  • attempts – how many retries to give set command.

Returns:

read-back value from set(…).

sweep_print_header(measured_unit)

Returns the header for print-outs, when doing a sweep.

Helper function of instrument.sweep() @param: measured_unit: not needed here. Is required in some cases, where sweep and measurement are performed by different devices.

validate_channel(channel, raise_exception=True)

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

Parameters:

channel – Channel number to validate as an input