Keithley 2400 SourceMeter

class pymeasure.instruments.keithley.Keithley2400(adapter, name='Keithley 2400 SourceMeter', **kwargs)

Bases: KeithleyBuffer, SCPIMixin, Instrument

Represent the Keithley 2400 SourceMeter and provide a high-level interface for interacting with the instrument.

smu = Keithley2400("GPIB::1")
smu.reset()                        # Resets the instrument

smu.source_mode = "current"        # Sets up to source current
smu.source_enabled = True          # Enables the source output

smu.ramp_to_current(5e-3)          # Ramps the current to 5 mA
print(smu.voltage)                 # Prints the voltage in Volts

smu.reset()                        # Resets the instrument
apply_current(current_range=None, compliance_voltage=0.1)

Configure the instrument to apply a source current, and uses an auto range unless a current range is specified. The compliance voltage is also set.

Parameters:
  • compliance_voltage – A float in the correct range for a compliance_voltage (default: 0.1)

  • current_range – A current_range value or None (default: None)

Deprecated since version 0.16: Instead control - source mode via source_mode. - source current range via source_current_range or source_current_range_auto_enabled. - compliance voltage via compliance_voltage

apply_voltage(voltage_range=None, compliance_current=0.1)

Configure the instrument to apply a source voltage, and uses an auto range unless a voltage range is specified. The compliance current is also set.

Parameters:
  • compliance_current – A float in the correct range for a compliance_current (default: 0.1)

  • voltage_range – A voltage_range value or None (default: None)

Deprecated since version 0.16: Recommended to control - source mode via source_mode. - source voltage range via source_voltage_range or source_voltage_range_auto_enabled. - compliance current via compliance_current

property arm_count

Control the arm layer count (int strictly in range 1 to 2500). The product of trigger_count and arm_count cannot exceed 2500.

property arm_input_line: Any

Control the arm layer input line (int, strictly in range 1 to 4).

For normal operation, arm_input_line should not share its value with trigger_output_line or arm_output_line.

property arm_output_event: Any

Control when the trigger pulse occurs on the arm layer output trigger line (str, strictly ‘trigger_enter’, ‘trigger_exit’, or ‘none’).

property arm_output_line: Any

Control the arm layer output line (int, strictly in range 1 to 4).

For normal operation, arm_output_line should not share its value with trigger_input_line or arm_input_line.

property arm_source: Any

Control the arm layer event control source (str, strictly ‘immediate’, ‘trigger_link’, ‘timer’, ‘manual’, or ‘bus’).

property arm_timer: Any

Control the arm layer timer in seconds (float, strictly in range 0.001 to 99999.99).

property auto_output_off: Any

Control whether auto output-off is activated. Valid values are True (output off after measurement) and False (output stays on after measurement).

Deprecated since version 0.16: Instead use auto_output_off_enabled.

property auto_output_off_enabled: Any

Control whether auto output-off is activated (bool).

Warning

With auto output-off disabled (False), the output will remain on after a source-measure operation is performed.

auto_range_source()

Configure the source to use an automatic range.

Deprecated since version 0.16: Instead control auto ranging for the desired source using source_current_range_auto_enabled or source_voltage_range_auto_enabled.

property auto_zero: Any

Control whether the auto zero option is enabled. Valid values are True (enabled) and False (disabled) and ‘ONCE’ (force immediate).

Deprecated since version 0.16: Instead use auto_zero_enabled or auto_zero_once().

property auto_zero_enabled: Any

Control whether auto zeroing is enabled (bool)

beep(frequency, duration)

Sound a system beep.

Parameters:
  • frequency – A frequency in Hz between 65 Hz and 2 MHz

  • duration – A time in seconds between 0 and 7.9 seconds

property buffer_data

Get a numpy array of values from the buffer.

property buffer_points: Any

Control the number of buffer points. This does not represent actual points in the buffer, but the configuration value instead.

check_errors()

Read all errors from the instrument.

Returns:

List of error entries.

check_get_errors()

Check for errors after having gotten a property and log them.

Called if check_get_errors=True is set for that property.

If you override this method, you may choose to raise an Exception for certain errors.

Returns:

list – List of error entries.

check_set_errors()

Check for errors after having set a property and log them.

Called if check_set_errors=True is set for that property.

If you override this method, you may choose to raise an Exception for certain errors.

Returns:

list – List of error entries.

clear()

Clear the instrument status byte.

clear_trigger()

Clear any pending input triggers immediately.

property complete: Any

Get the synchronization bit.

This property allows synchronization between a controller and a device. The Operation Complete query places an ASCII character 1 into the device’s Output Queue when all pending selected device operations have been finished.

property compliance_current: Any

Control the compliance current in Amps (float, strictly from -1.05 to 1.05).

property compliance_voltage: Any

Control the compliance voltage in Volts (float, strictly from -210 to 210).

config_buffer(points=64, delay=0)

Configure the measurement buffer for a number of points, to be taken with a specified delay.

Parameters:
  • points – The number of points in the buffer. (default: 64)

  • delay – The delay time in seconds. (default: 0)

property current: Any

Measure the current in Amps (float).

property current_nplc: Any

Control the number of power line cycles (NPLC) (float, strictly from 0.01 to 10).

Note

This is a global command, implicitly setting voltage_nplc and resistance_nplc.

property current_range: Any

Control the measurement current range in Amps (float, strictly from -1.05 to 1.05).

When set, the range selected will be the most sensitive range that will accommodate the set value, and current_range_auto_enabled is implicitly set to False.

property current_range_auto_enabled: Any

Control whether current measurement auto-range is enabled (bool).

disable_buffer()

Disable the connection between measurements and the buffer, but does not abort the measurement process.

disable_output_trigger()

Disable the output trigger for the Trigger layer

Deprecated since version 0.16: Instead set trigger_output_event to “none” to turn off just trigger layer output triggering, or use ~.disable_output_triggers to disable both trigger and arm layer output triggering.

disable_output_triggers()

Disable the output trigger for the Trigger layer

disable_source()

Disable the source.

property display_enabled: Any

Control whether the display of the sourcemeter is enabled (bool).

enable_source()

Enable the source.

property error

Get the next error from the queue.

Deprecated since version 0.15: Use next_error instead.

property filter_count: Any

Control the number of readings that are acquired and stored in the filter buffer (int, strictly from 1 to 100).

property filter_enabled: Any

Control whether the filter is active (bool).

property filter_state: Any

Control if the filter is active (string, strictly ‘ON’ or ‘OFF’).

Deprecated since version 0.16: Instead use filter_enabled.

property filter_type: Any

Control (String) the filter’s type. REP : Repeating filter MOV : Moving filter

Deprecated since version 0.16: Instead use repeat_filter_enabled.

property front_terminals_enabled: Any

Control whether the to route to the front terminals (bool). When True the front terminals are routed to and the rear disconnected, and vice-versa when False.

property id: Any

Get the identification of the instrument.

is_buffer_full()

Return True if the buffer is full of measurements.

property line_frequency: Any

Control the line frequency in Hertz (int, strictly 50 or 60).

property line_frequency_auto: Any

Control the auto line frequency (boolean).

Deprecated since version 0.16: Instead use auto_zero_enabled or auto_zero_once().

property line_frequency_auto_enabled: Any

Control whether the auto line frequency is enabled (bool).

property max_current

Get the maximum current from the buffer (float).

property max_resistance

Get the maximum resistance from the buffer (float).

property max_voltage

Get the maximum voltage from the buffer (float).

property maximums: Any

Get the calculated maximums for voltage, current, and resistance from the buffer data (list of floats).

property mean_current

Get the mean current from the buffer (float).

property mean_resistance

Get the mean resistance from the buffer (float).

property mean_voltage

Get the mean voltage from the buffer (float).

property means: Any

Get the calculated means for voltage, current, and resistance from the buffer data (list of floats).

measure_all()

Measure current (A), voltage (V), resistance (Ohm), time (s), and status concurrently.

Note

Sets resistance_mode_auto to False

Returns

dict

Dictionary with the following keys: - ‘current’ (float): Measured current in A. - ‘voltage’ (float): Measured voltage in V. - ‘resistance’ (float): Measured resistance in Ohms. - ‘time’ (float): Measurement time in s. - ‘status’ (int): Instrument status flag.

measure_current(nplc=1, current=0.000105, auto_range=True)

Configure the measurement of current.

Parameters:
  • nplc – Number of power line cycles (NPLC) from 0.01 to 10 (default: 1)

  • current – Upper limit of current in Amps, from -1.05 A to 1.05 A (default: 0.000105)

  • auto_range – Enables auto_range if True, else uses the set current (default: True)

Deprecated since version 0.16: Configuration to measure current is performed implicitly by current. Recommended to control - current nplc via current_nplc. - current range via current_range or current_range_auto_enabled.

measure_resistance(nplc=1, resistance=210000.0, auto_range=True)

Configure the measurement of resistance.

Parameters:
  • nplc – Number of power line cycles (NPLC) from 0.01 to 10 (default: 1)

  • resistance – Upper limit of resistance in Ohms, from -210 MOhms to 210 MOhms (default: 210000.0)

  • auto_range – Enables auto_range if True, else uses the set resistance (default: True)

Deprecated since version 0.16: Configuration to measure resistance is performed implicitly by resistance. Instead: - control resistance nplc via resistance_nplc. - control resistance range via resistance_range or resistance_range_auto_enabled.

measure_voltage(nplc=1, voltage=21.0, auto_range=True)

Configure the measurement of voltage.

Parameters:
  • nplc – Number of power line cycles (NPLC) from 0.01 to 10 (default: 1)

  • voltage – Upper limit of voltage in Volts, from -210 V to 210 V (default: 21.0)

  • auto_range – Enables auto_range if True, else uses the set voltage (default: True)

Deprecated since version 0.16: Configuration to measure voltage is performed implicitly by voltage. Recommended to control - voltage nplc via voltage_nplc. - voltage range via voltage_range or voltage_range_auto_enabled.

property min_current

Get the minimum current from the buffer (float).

property min_resistance

Get the minimum resistance from the buffer (float).

property min_voltage

Get the minimum voltage from the buffer (float).

property minimums: Any

Get the calculated minimums for voltage, current, and resistance from the buffer data (list of floats).

property next_error: Any

Get the next error in the queue. If you want to read and log all errors, use check_errors() instead.

property options: Any

Get the device options installed.

property output_off_state: Any

Control the output-off state.

str:
  • ‘disconnected’: Output relay opens (do not use this state if output is turned on and off frequently to prevent excess wear on the relay).

  • ‘normal’: V-source is selected and set to 0V.

  • ‘zero’: Allows the sourcemeter to be used to measure current while off.

  • ‘guard’: I-source is selected and set to 0A.

Deprecated since version 0.16: Deprecated to use ‘HIMP’, ‘NORM’, ‘ZERO’, or ‘GUAR’ with output_off_state.

output_trigger_on_external(line=1, after='DEL')

Configure the output trigger on the specified trigger link line number, with the option of supplying the part of the measurement after which the trigger should be generated (default to delay, which is right before the measurement)

Parameters:
  • line – A trigger line from 1 to 4 (default: 1)

  • after – An event string that determines when to trigger (default: 'DEL')

Deprecated since version 0.16: Instead use trigger_output_event and trigger_output_line.

ramp_to_current(target_current, steps=30, pause=0.02)

Ramp to a target current from the set current value over a certain number of linear steps, each separated by a pause duration.

Parameters:
  • target_current – A current in Amps

  • steps – An integer number of steps (default: 30)

  • pause – A pause duration in seconds to wait between steps (default: 0.02)

ramp_to_voltage(target_voltage, steps=30, pause=0.02)

Ramp to a target voltage from the present voltage value over a certain number of linear steps, each separated by a pause duration.

Parameters:
  • target_voltage – A voltage in Amps

  • steps – An integer number of steps (default: 30)

  • pause – A pause duration in seconds to wait between steps (default: 0.02)

read(**kwargs)

Read up to (excluding) read_termination or the whole read buffer.

Return type:

str

read_binary_values(**kwargs)

Read binary values from the device.

read_bytes(count, **kwargs)

Read a certain number of bytes from the instrument.

Parameters:
  • count (int) – Number of bytes to read. A value of -1 indicates to read the whole read buffer.

  • kwargs – Keyword arguments for the adapter.

Returns bytes:

Bytes response of the instrument (including termination).

Return type:

bytes

property repeat_filter_enabled: Any

Control whether repeat filter is enabled (bool). If False, moving filter is used.

reset()

Reset the instrument.

reset_buffer()

Reset the buffer.

reset_data_format()

Reset the data format to the format expected by Keithley2400.

The expected data format is [<current>, <voltage>, <resistance>, <time>, <status>].

Caution

Changing the data format with the “:FORMAT:ELEMENTS” command after initialization may break parts of Keithley2400.

reset_trigger()

Reset the trigger system and return to an idle state.

property resistance: Any

Measure the resistance in Ohms (float).

property resistance_mode_auto_enabled: Any

Control the resistance mode auto status (bool).

When True, source_current and voltage_range depends on the resistance_range selected. When False, source_current and voltage_range are controlled manually.

property resistance_nplc: Any

Control the number of power line cycles (NPLC) (float, strictly from 0.01 to 10).

Note

This is a global command, implicitly setting current_nplc and voltage_nplc.

property resistance_range: Any

Control the resistance range in Ohms (float, strictly from 0 to 210e6).

When set, the range selected will be the most sensitive range that will accommodate the set value, and resistance_range_auto_enabled is implicitly set to False.

property resistance_range_auto_enabled: Any

Control whether resistance measurement auto-range is enabled (bool).

sample_continuously()

Cause the instrument to continuously read samples and turns off any buffer or output triggering.

set_timed_arm(interval)

Set up the measurement to be taken with the internal trigger at a variable sampling rate defined by the interval in seconds between sampling points

Deprecated since version 0.16: Instead set arm_source to “time” and control the interval using arm_timer.

set_trigger_counts(arm, trigger)

Set the number of counts for both the sweeps (arm) and the points in those sweeps (trigger), where the total number of points can not exceed 2500

Deprecated since version 0.16: Instead use trigger_count and/or arm_count

shutdown()

Ensure that the current or voltage is turned to zero and disable the output.

property source_current: Any

Control the source current in Amps (float, strictly from -1.05 to 1.05).

property source_current_range: Any

Control the source current range in Amps (float, strictly from -1.05 to 1.05).

When set, the range selected will be the most sensitive range that will accommodate the set value, and Auto-range is disabled.

property source_current_range_auto_enabled: Any

Control whether souce current auto-range is enabled (bool).

property source_delay: Any

Control the manual delay in seconds for the source after the output is turned on before a measurement is taken (float strictly from 0 to 999.9999).

When this property is set, source_delay_auto_enabled is implicitly set to False.

property source_delay_auto: Any

Control the auto delay (boolean).

Deprecated since version 0.16: Instead use source_delay_auto_enabled.

property source_delay_auto_enabled: Any

Control whether the source auto delay is enabled (bool).

property source_enabled: Any

Control whether the source is enabled (bool).

property source_mode: Any

Control the source mode (str, strictly ‘current’ or ‘voltage’).

property source_voltage: Any

Control the source voltage in Volts (float, strictly from -210 to 210).

property source_voltage_range: Any

Control the source voltage range in Volts (float, strictly from -210 to 210).

When set, the range selected will be the most sensitive range that will accommodate the set value, and Auto-range is disabled.

property source_voltage_range_auto_enabled: Any

Control whether source voltage auto-range is enabled (bool).

property standard_devs: Any

Get the calculated standard deviations for voltage, current, and resistance from the buffer data (list of floats).

start_buffer()

Starts the buffer.

property status: Any

Get the status byte and Master Summary Status bit.

property std_current

Get the current standard deviation from the buffer (float).

property std_resistance

Get the resistance standard deviation from the buffer (float).

property std_voltage

Get the voltage standard deviation from the bufferv.

stop_buffer()

Abort the buffering measurement, by stopping the measurement arming and triggering sequence. If possible, a Selected Device Clear (SDC) is used.

triad(base_frequency, duration)

Sound a musical triad using the system beep.

Parameters:
  • base_frequency – A frequency in Hz between 65 Hz and 1.3 MHz

  • duration – A time in seconds between 0 and 7.9 seconds

trigger()

Execute a bus trigger, which can be used when trigger_on_bus() is configured.

property trigger_count

Control the trigger layer count (int strictly in range 1 to 2500). The product of trigger_count and arm_count cannot exceed 2500.

property trigger_delay: Any

Control the trigger layer delay in seconds (float, strictly in range 0 to 999.9999).

trigger_immediately()

Configure measurements to be taken with the internal trigger at the maximum sampling rate.

property trigger_input_line: Any

Control the trigger layer input line (int, strictly in range 1 to 4).

For normal operation, trigger_input_line should not share its value with trigger_output_line or arm_output_line.

trigger_on_bus()

Configure the trigger to detect events based on the bus trigger, which can be activated by trigger().

trigger_on_external(line=1)

Configure the measurement trigger to be taken from a specific line of an external trigger

Parameters:

line – A trigger line from 1 to 4 (default: 1)

property trigger_output_event: Any

Control when the trigger pulse occurs on the trigger layer output trigger line (str, strictly ‘source’, ‘delay’, ‘sense’, or ‘none’).

property trigger_output_line: Any

Control the trigger layer output line (int, strictly in range 1 to 4).

For normal operation, trigger_output_line should not share its value with trigger_input_line or arm_input_line.

property trigger_source: Any

Control the trigger layer event control source (str, strictly ‘immediate’ or ‘trigger_link’).

use_front_terminals()

Enable the front terminals for measurement, and disable the rear terminals.

Deprecated since version 0.16: Instead set front_terminals_enabled to True.

use_rear_terminals()

Enable the rear terminals for measurement, and disable the front terminals.

Deprecated since version 0.16: Instead set front_terminals_enabled to False.

property voltage: Any

Measure the voltage in Volts (float).

property voltage_nplc: Any

Control the number of power line cycles (NPLC) (float, strictly from 0.01 to 10).

Note

This is a global command, implicitly setting current_nplc and resistance_nplc.

property voltage_range: Any

Control the measurement voltage range in Volts (float, strictly from -210 to 210).

When set, the range selected will be the most sensitive range that will accommodate the set value, and voltage_range_auto_enabled is implicitly set to False.

property voltage_range_auto_enabled: Any

Control whether voltage measurement auto-range is enabled (bool).

wait_for(query_delay=None)

Wait for some time. Used by ‘ask’ to wait before reading.

Parameters:

query_delay (Optional[float]) – Delay between writing and reading in seconds. None is default delay. (default: None)

Return type:

None

wait_for_buffer(should_stop=<function KeithleyBuffer.<lambda>>, timeout=60, interval=0.1)

Block the program, waiting for a full buffer. This function returns early if the should_stop function returns True or the timeout is reached before the buffer is full.

Parameters:
  • should_stop – A function that returns True when this function should return early (default: <function KeithleyBuffer.<lambda> at 0x76f1f4519800>)

  • timeout – A time in seconds after which this function should return early (default: 60)

  • interval – A time in seconds for how often to check if the buffer is full (default: 0.1)

property wires: Any

Control the number of wires in use for sourcing voltage, measuring voltage, or measuring resistance (int, strictly 2 or 4).

write(command, **kwargs)

Write a string command to the instrument appending write_termination.

Parameters:
  • command (str) – command string to be sent to the instrument

  • kwargs – Keyword arguments for the adapter.

Return type:

None

write_binary_values(command, values, *args, **kwargs)

Write binary values to the device.

Parameters:
  • command (str) – Command to send.

  • values (Sequence[Union[int, float]]) – The values to transmit.

  • **kwargs (*args,) – Further arguments to hand to the Adapter.

Return type:

None

write_bytes(content, **kwargs)

Write the bytes content to the instrument.

Return type:

None