stoner_measurement.instruments.keithley.k2182.Keithley2182A

class stoner_measurement.instruments.keithley.k2182.Keithley2182A(transport: BaseTransport, protocol: BaseProtocol | None = None)[source]

Bases: KeithleyScpiDataFormatMixin, Nanovoltmeter

Driver for the Keithley 2182A nanovoltmeter.

Variables:
  • transport (BaseTransport) – Transport layer (serial, GPIB, or Ethernet).

  • protocol (BaseProtocol) – Protocol instance (defaults to ScpiProtocol).

CAPABILITIES: ClassVar[NanovoltmeterCapabilities] = NanovoltmeterCapabilities(has_function_selection=True, has_filter=True, has_trigger=True, has_buffer=True, has_data_format=True, has_byte_order=True, supported_functions=(<NanovoltmeterFunction.VOLT: 'VOLT'>, <NanovoltmeterFunction.TEMP: 'TEMP'>), fixed_voltage_ranges=(0.01, 0.1, 1.0, 10.0, 100.0, 120.0), nplc_values=(0.1, 1.0, 10.0), digit_values=(4, 5, 6, 7, 8), filter_types=('OFF', 'REPEAT', 'WINDOW'), default_nplc=1.0, default_digits=8, default_filter_type='OFF', counted_filter_types=('REPEAT',), analog_filter_time_multiplier=2.0, supports_filter_count=True, supports_analog_filter=True, supports_relative=True, supports_line_sync=True, supports_autozero=True, supports_safe_reset=True, relative_limits=(-120.0, 120.0), max_buffer_points=None)
abort() → None[source]

Abort a running measurement sequence and return to idle.

clear_buffer() → None[source]

Clear all readings from the instrument trace buffer.

connect() → None[source]

Open the transport connection to the instrument.

After opening the transport, any data accumulated in the transport buffer since the last session is discarded via flush() so that stale responses from previous commands cannot be misread as replies to new queries. The instrument is then cleared and reset to its IEEE-488.2 defaults, with reset completion confirmed before normal status checking resumes.

Raises:

ConnectionError – If the underlying transport cannot be opened.

Examples

>>> from stoner_measurement.instruments.transport import NullTransport
>>> from stoner_measurement.instruments.protocol import ScpiProtocol
>>> from stoner_measurement.instruments.base_instrument import BaseInstrument
>>> instr = BaseInstrument(NullTransport(), ScpiProtocol())
>>> instr.connect()
>>> instr.is_connected
True
>>> instr.disconnect()
get_autorange() → bool[source]

Return True if autorange is enabled.

Returns:

True when autorange is active.

Return type:

(bool)

get_autozero_enabled() → bool[source]

Return whether automatic zero-reference measurements are enabled.

get_buffer_count() → int[source]

Return the number of readings currently stored in the trace buffer.

get_buffer_size() → int[source]

Return the configured trace capacity, querying only if it is not cached.

get_capabilities() → NanovoltmeterCapabilities[source]

Return static capability metadata for the Keithley 2182A.

Returns:

Capability descriptor.

Return type:

(NanovoltmeterCapabilities)

get_filter_count() → int[source]

Return the digital filter averaging count.

Returns:

Number of readings averaged per sample.

Return type:

(int)

get_filter_enabled() → bool[source]

Return True if the digital filter is enabled.

Returns:

True when the digital filter is active.

Return type:

(bool)

get_line_sync_enabled() → bool[source]

Return whether A/D conversions are synchronized to the power line.

get_measure_function() → NanovoltmeterFunction[source]

Return the active measurement function.

Returns:

Active measurement function.

Return type:

(NanovoltmeterFunction)

get_nplc() → float[source]

Return the integration time in power-line cycles.

Returns:

Integration time in power-line cycles.

Return type:

(float)

get_range() → float[source]

Return the active voltage measurement range in volts.

Returns:

Active measurement range in volts.

Return type:

(float)

get_relative_value() → float[source]

Return the channel-one voltage reference used by relative mode.

get_trigger_count() → int[source]

Return the configured trigger count.

Returns:

Number of triggers configured.

Return type:

(int)

get_trigger_delay() → float[source]

Return the trigger delay in seconds.

get_trigger_source() → NanovoltmeterTriggerSource[source]

Return the trigger source selection.

Returns:

Active trigger source.

Return type:

(NanovoltmeterTriggerSource)

initiate() → None[source]

Arm the trigger system and begin a measurement sequence.

measure_voltage() → float[source]

Trigger a voltage measurement and return the result in volts.

Returns:

Measured voltage in volts.

Return type:

(float)

static parse_csv_floats(values: str) → tuple[float, ...][source]

Parse a comma-separated numeric payload.

Parameters:

values (str) – Raw comma-separated numeric response string.

Returns:

Parsed floating-point values.

Return type:

(tuple[float, …])

Raises:

ValueError – If values contains malformed numeric tokens.

read_buffer(count: int | None = None) → tuple[float, ...] | ndarray[source]

Read values from the instrument trace buffer.

Keyword Parameters:

count (int | None) – Number of points to read from the start of the buffer. If None, read all available points.

Returns:

Parsed ASCII readings, or a zero-copy NumPy view for binary formats.

Return type:

(tuple[float, …] | numpy.ndarray)

Raises:

ValueError – If count is not positive.

reset() → None[source]

Clear and reset the 2182A, waiting until reset has completed.

Status-byte and automatic error checks are suspended only for this recovery sequence so that a stale Error Available bit cannot prevent *CLS from clearing the condition. The sequence follows the 2182A manual: clear status, issue *RST;*OPC?, verify completion, and clear any reset-time events before restoring normal error checking.

Raises:

ConnectionError – If the transport is not open.

Examples

>>> from stoner_measurement.instruments.transport import NullTransport
>>> t = NullTransport(responses=[b"1\n"])
>>> t.open()
>>> instr = Keithley2182A(t)
>>> instr.reset()
>>> t.write_log
[b'*CLS\n', b'*RST;*OPC?\n', b'*CLS\n']
>>> instr.disconnect()
set_analog_filter_enabled(state: bool) → None[source]

Enable or disable the analogue low-pass filter.

Parameters:

state (bool) – True to enable, False to disable.

set_autorange(state: bool) → None[source]

Enable or disable autorange.

Parameters:

state (bool) – True to enable autorange.

set_autozero_enabled(state: bool) → None[source]

Enable or disable automatic zero-reference measurements.

set_buffer_feed_continuous_next() → None[source]

Set feed mode to continuous-next (:TRAC:FEED:CONT NEXT).

set_buffer_feed_sense() → None[source]

Set trace feed source to measurement readings (:TRAC:FEED SENS).

set_buffer_size(size: int) → None[source]

Set the trace buffer point capacity.

Parameters:

size (int) – Number of points to allocate in the trace buffer.

Raises:

ValueError – If size is not positive.

set_digits(digits: int) → None[source]

Set display and data digits.

Parameters:

digits (int) – Number of digits to display/store (valid range: 4..8).

Raises:

ValueError – If digits is outside 4..8.

set_filter_count(count: int) → None[source]

Set the digital filter averaging count.

Parameters:

count (int) – Number of readings to average. Must be positive.

Raises:

ValueError – If count is not positive.

set_filter_enabled(state: bool) → None[source]

Enable or disable the digital filter.

Parameters:

state (bool) – True to enable the filter.

set_filter_type(filter_type: str) → None[source]

Select the repeating or moving-window digital filter.

"WINDOW" is accepted as the user-facing name for the instrument’s MOV (moving-window) mode. "MOVING" remains an accepted alias for callers using the SCPI manual’s terminology.

set_line_sync_enabled(state: bool) → None[source]

Enable or disable power-line synchronization of A/D conversions.

set_measure_function(function: NanovoltmeterFunction) → None[source]

Set the active measurement function.

Parameters:

function (NanovoltmeterFunction) – Function to select.

set_nplc(value: float) → None[source]

Set the integration time in power-line cycles.

Parameters:

value (float) – Integration time in power-line cycles. Must be positive.

Raises:

ValueError – If value is not positive.

set_range(value: float) → None[source]

Set the voltage measurement range in volts.

Parameters:

value (float) – Measurement range in volts. Must be positive.

Raises:

ValueError – If value is not positive.

set_relative_enabled(state: bool) → None[source]

Enable or disable relative (REL) mode.

Parameters:

state (bool) – True to enable, False to disable.

set_relative_value(value: float) → None[source]

Set the channel-one voltage reference used by relative mode.

set_trigger_count(count: int) → None[source]

Set the trigger count.

Parameters:

count (int) – Number of triggers. Must be positive.

Raises:

ValueError – If count is not positive.

set_trigger_delay(delay: float) → None[source]

Set the delay between a trigger event and measurement in seconds.

set_trigger_source(source: NanovoltmeterTriggerSource) → None[source]

Set the trigger source.

Parameters:

source (NanovoltmeterTriggerSource) – Trigger source to select.