Skip to content

DMM (Digital Multimeter)¤

Interface¤

Bases: Instrument

Digital multimeter instrument. Call set_measurement_function then read.

Parameters:

  • name ¤

    (str) –

    Channel-name prefix for published data.

  • driver ¤

    (DMMDriverBase) –

    Concrete DMM driver; owns its own transport::

    dmm = InstroDMM( "main", driver=Agilent34401A("ASRL3::INSTR"), )

  • publishers ¤

    (list[Publisher] | None, default: None ) –

    Publishers that receive emitted Measurement/Command data.

  • **kwargs ¤

    Default tags applied to every emitted Measurement/Command. Pass dataset_rid="<rid>" to auto-create a NominalCorePublisher (uses the on-disk 'default' Nominal credential).

name instance-attribute ¤

name = name

legacy_naming instance-attribute ¤

legacy_naming = legacy_naming

publishers instance-attribute ¤

publishers = publishers or []

default_tags instance-attribute ¤

default_tags: dict[str, str] = {}

background_interval property writable ¤

background_interval

Seconds between background daemon iterations (0 = no wait).

background_enable property writable ¤

background_enable

Whether the background daemon is enabled (must still be start()-ed).

add_publisher ¤

add_publisher(publisher: Publisher)

Register a publisher to receive this instrument's Measurement/Command data.

publish ¤

publish(data: Measurement | Command, **kwargs)

Fan data out to every configured publisher; kwargs pass through.

add_background_daemon_function ¤

add_background_daemon_function(method: Callable, *args, **kwargs)

Append method to the daemon's call list. Use define_background_daemon to replace instead.

stop ¤

stop()

Signal the background daemon to stop and join it. No-op if not running.

get_channel ¤

get_channel(
    channel_name: str,
    length: int = 1,
    wait_for_latest: bool = False,
    timeout: float = 10.0,
) -> Measurement

Return the most recent length samples for channel_name from the in-memory buffer.

Parameters:

  • channel_name ¤

    (str) –

    Name of the channel to retrieve.

  • length ¤

    (int, default: 1 ) –

    Number of trailing samples to return.

  • wait_for_latest ¤

    (bool, default: False ) –

    Block until at least length new values arrive.

  • timeout ¤

    (float, default: 10.0 ) –

    Seconds to wait when wait_for_latest=True.

Raises:

  • RuntimeError

    No background buffer; start() was not called.

  • ChannelNotFoundTimeoutError

    wait_for_latest=True and channel did not appear within timeout.

  • ChannelValueTimeoutError

    wait_for_latest=True and values did not arrive within timeout.

define_background_daemon ¤

define_background_daemon(method: Callable, *args, **kwargs)

Replace all daemon functions with a single method (called with the given args).

start ¤

start() -> None

Start the background daemon thread.

Raises:

  • ValueError

    set_measurement_function has not been called.

open ¤

open() -> None

Open the underlying driver.

close ¤

close() -> None

Close the underlying driver and stop the daemon.

set_measurement_function ¤

set_measurement_function(
    function: MeasurementFunction, **kwargs
) -> Command

Configure the DMM for function (DC voltage, resistance, etc.).

set_digits ¤

set_digits(n: int, **kwargs) -> Command

Set resolution in digits. Requires set_measurement_function() to have been called.

set_aperture_seconds ¤

set_aperture_seconds(seconds: float, **kwargs) -> Command

Set integration time (aperture) in seconds. Requires set_measurement_function() first.

set_aperture_nplc ¤

set_aperture_nplc(nplc: float, **kwargs) -> Command

Set integration time as a number of power-line cycles.

Higher NPLC integrates over more AC noise (better DC/DCI/resistance accuracy) at the cost of measurement rate. NPLC=100 is the typical highest-accuracy setting. Requires set_measurement_function first.

set_range ¤

set_range(value: float | None, **kwargs) -> Command

Set manual range; None selects auto-range. Requires set_measurement_function first.

Publishes range_mode.cmd ("AUTO"/"MANUAL") on every call and range.cmd (float) only when a manual range is supplied — splitting them keeps each channel single-typed, which the Nominal streaming backend requires.

read ¤

read(**kwargs) -> Measurement

Trigger a measurement under the configured function and return it. Requires set_measurement_function first.

Types & Configuration¤

DMM shared types: MeasurementFunction, DMMMeasurementConfig, RangeMode.

MeasurementFunction ¤

Bases: Enum

DMM measurement function (mode).

DC_VOLTAGE class-attribute instance-attribute ¤

DC_VOLTAGE = 'DC_VOLTAGE'

AC_VOLTAGE class-attribute instance-attribute ¤

AC_VOLTAGE = 'AC_VOLTAGE'

TWO_WIRE_RESISTANCE class-attribute instance-attribute ¤

TWO_WIRE_RESISTANCE = 'TWO_WIRE_RESISTANCE'

FOUR_WIRE_RESISTANCE class-attribute instance-attribute ¤

FOUR_WIRE_RESISTANCE = 'FOUR_WIRE_RESISTANCE'

DC_CURRENT class-attribute instance-attribute ¤

DC_CURRENT = 'DC_CURRENT'

AC_CURRENT class-attribute instance-attribute ¤

AC_CURRENT = 'AC_CURRENT'

RangeMode ¤

Bases: Enum

DMM range mode published on range_mode.cmd.

AUTO class-attribute instance-attribute ¤

AUTO = 'AUTO'

MANUAL class-attribute instance-attribute ¤

MANUAL = 'MANUAL'

DMMMeasurementConfig dataclass ¤

DMMMeasurementConfig(
    function: MeasurementFunction,
    digits: int | None = None,
    aperture_seconds: float | None = None,
    aperture_nplc: float | None = None,
    range: float | None = None,
)

DMM acquisition config. Drivers apply only the options they support; the rest are ignored or raise.

Attributes:

  • function (MeasurementFunction) –

    Measurement function (required).

  • digits (int | None) –

    Resolution in digits; None = instrument default.

  • aperture_seconds (float | None) –

    Integration time in seconds (vendor-dependent; mutually exclusive with aperture_nplc).

  • aperture_nplc (float | None) –

    Integration time in power-line cycles (vendor-dependent).

  • range (float | None) –

    Manual range in the active function's units; None = auto range.

function instance-attribute ¤

digits class-attribute instance-attribute ¤

digits: int | None = None

aperture_seconds class-attribute instance-attribute ¤

aperture_seconds: float | None = None

aperture_nplc class-attribute instance-attribute ¤

aperture_nplc: float | None = None

range class-attribute instance-attribute ¤

range: float | None = None

Driver Interface¤

Bases: ABC

Vendor DMM driver contract. Concrete drivers own their transport and lifecycle.

Range and NPLC are split per function (set_dc_voltage_range, set_ac_current_nplc, …) so the driver never tracks the active function — InstroDMM dispatches based on its own _measurement_config.

open abstractmethod ¤

open() -> None

Open the underlying transport and put the instrument into a known state.

Concrete drivers also do one-shot setup here (e.g. *CLS to clear the error queue, SYST:REM for remote control).

close abstractmethod ¤

close() -> None

Close the underlying transport. Idempotent.

set_measurement_function abstractmethod ¤

set_measurement_function(function: MeasurementFunction) -> None

Configure the DMM for function (DC voltage, AC current, 2-wire resistance, …).

Drivers may issue a dummy measurement to commit the mode change. MeasurementFunction values the instrument doesn't support should raise NotImplementedError.

set_digits ¤

set_digits(n: int) -> None

Set resolution to n digits.

Default raises NotImplementedError; override on drivers whose SCPI exposes a direct digits/resolution control. Instruments that only expose integration time (e.g. Keithley 2400) should leave this as a no-implementation and direct users to set_aperture_nplc.

set_aperture_seconds ¤

set_aperture_seconds(seconds: float) -> None

Set integration time directly in seconds.

Default raises NotImplementedError. Mutually exclusive with set_aperture_nplc on a given driver — vendors typically expose one or the other.

set_dc_voltage_range ¤

set_dc_voltage_range(value: float | None) -> None

Set manual DC-voltage range to value volts; None selects auto-range.

set_ac_voltage_range ¤

set_ac_voltage_range(value: float | None) -> None

Set manual AC-voltage range to value volts; None selects auto-range.

set_dc_current_range ¤

set_dc_current_range(value: float | None) -> None

Set manual DC-current range to value amperes; None selects auto-range.

set_ac_current_range ¤

set_ac_current_range(value: float | None) -> None

Set manual AC-current range to value amperes; None selects auto-range.

set_two_wire_resistance_range ¤

set_two_wire_resistance_range(value: float | None) -> None

Set manual 2-wire-resistance range to value ohms; None selects auto-range.

set_four_wire_resistance_range ¤

set_four_wire_resistance_range(value: float | None) -> None

Set manual 4-wire-resistance range to value ohms; None selects auto-range.

set_dc_voltage_nplc ¤

set_dc_voltage_nplc(nplc: float) -> None

Set DC-voltage integration time to nplc power-line cycles.

set_ac_voltage_nplc ¤

set_ac_voltage_nplc(nplc: float) -> None

Set AC-voltage integration time to nplc power-line cycles.

set_dc_current_nplc ¤

set_dc_current_nplc(nplc: float) -> None

Set DC-current integration time to nplc power-line cycles.

set_ac_current_nplc ¤

set_ac_current_nplc(nplc: float) -> None

Set AC-current integration time to nplc power-line cycles.

set_two_wire_resistance_nplc ¤

set_two_wire_resistance_nplc(nplc: float) -> None

Set 2-wire-resistance integration time to nplc power-line cycles.

set_four_wire_resistance_nplc ¤

set_four_wire_resistance_nplc(nplc: float) -> None

Set 4-wire-resistance integration time to nplc power-line cycles.

measure_four_wire_resistance ¤

measure_four_wire_resistance() -> float

Trigger a 4-wire-resistance measurement and return the value (ohms).

Default raises NotImplementedError; override on drivers whose instrument has dedicated sense leads (e.g. Agilent 34401A).

measure_dc_voltage abstractmethod ¤

measure_dc_voltage() -> float

Trigger a DC-voltage measurement and return the value (volts).

measure_ac_voltage abstractmethod ¤

measure_ac_voltage() -> float

Trigger an AC-voltage measurement and return the value (volts RMS, vendor-dependent).

measure_resistance abstractmethod ¤

measure_resistance() -> float

Trigger a 2-wire-resistance measurement and return the value (ohms).

measure_dc_current abstractmethod ¤

measure_dc_current() -> float

Trigger a DC-current measurement and return the value (amperes).

measure_ac_current abstractmethod ¤

measure_ac_current() -> float

Trigger an AC-current measurement and return the value (amperes RMS, vendor-dependent).

Vendor Drivers¤

Keithley 2400¤

Keithley 2400 SMU driver (DMM-style sense only).

Supports DC voltage, DC current, and 2-wire resistance. Source is held at zero to enable pure sensing. AC is not supported by the 2400.

Keithley2400 ¤

Keithley2400(visa_resource: str | VisaConfig)

Bases: DMMDriverBase

Keithley 2400 SMU as a sense-only DMM.

Integration time is set via NPLC (0.01–10); the 2400 has no aperture-in-seconds. Digits aren't directly settable — use NPLC. AC is not supported.

open ¤
open() -> None
close ¤
close() -> None
set_measurement_function ¤
set_measurement_function(function: MeasurementFunction) -> None

Configure the 2400 sense/source for function.

set_digits ¤
set_digits(n: int) -> None

Unsupported — the 2400 has no digits SCPI; use set_aperture_nplc for resolution.

set_dc_voltage_nplc ¤
set_dc_voltage_nplc(nplc: float) -> None
set_dc_current_nplc ¤
set_dc_current_nplc(nplc: float) -> None
set_two_wire_resistance_nplc ¤
set_two_wire_resistance_nplc(nplc: float) -> None
set_dc_voltage_range ¤
set_dc_voltage_range(value: float | None) -> None
set_dc_current_range ¤
set_dc_current_range(value: float | None) -> None
set_two_wire_resistance_range ¤
set_two_wire_resistance_range(value: float | None) -> None
measure_dc_voltage ¤
measure_dc_voltage() -> float
measure_dc_current ¤
measure_dc_current() -> float
measure_resistance ¤
measure_resistance() -> float
measure_ac_voltage ¤
measure_ac_voltage() -> float
measure_ac_current ¤
measure_ac_current() -> float
set_aperture_seconds ¤
set_aperture_seconds(seconds: float) -> None

Set integration time directly in seconds.

Default raises NotImplementedError. Mutually exclusive with set_aperture_nplc on a given driver — vendors typically expose one or the other.

set_ac_voltage_range ¤
set_ac_voltage_range(value: float | None) -> None

Set manual AC-voltage range to value volts; None selects auto-range.

set_ac_current_range ¤
set_ac_current_range(value: float | None) -> None

Set manual AC-current range to value amperes; None selects auto-range.

set_four_wire_resistance_range ¤
set_four_wire_resistance_range(value: float | None) -> None

Set manual 4-wire-resistance range to value ohms; None selects auto-range.

set_ac_voltage_nplc ¤
set_ac_voltage_nplc(nplc: float) -> None

Set AC-voltage integration time to nplc power-line cycles.

set_ac_current_nplc ¤
set_ac_current_nplc(nplc: float) -> None

Set AC-current integration time to nplc power-line cycles.

set_four_wire_resistance_nplc ¤
set_four_wire_resistance_nplc(nplc: float) -> None

Set 4-wire-resistance integration time to nplc power-line cycles.

measure_four_wire_resistance ¤
measure_four_wire_resistance() -> float

Trigger a 4-wire-resistance measurement and return the value (ohms).

Default raises NotImplementedError; override on drivers whose instrument has dedicated sense leads (e.g. Agilent 34401A).

Agilent 34401A¤

Agilent/HP/Keysight 34401A DMM driver (SCPI over GPIB or RS-232).

Agilent34401A ¤

Agilent34401A(visa_resource: str | VisaConfig)

Bases: DMMDriverBase

Agilent/HP/Keysight 34401A DMM.

set_dc_voltage_range class-attribute instance-attribute ¤
set_dc_voltage_range = _store_range
set_ac_voltage_range class-attribute instance-attribute ¤
set_ac_voltage_range = _store_range
set_dc_current_range class-attribute instance-attribute ¤
set_dc_current_range = _store_range
set_ac_current_range class-attribute instance-attribute ¤
set_ac_current_range = _store_range
set_two_wire_resistance_range class-attribute instance-attribute ¤
set_two_wire_resistance_range = _store_range
set_four_wire_resistance_range class-attribute instance-attribute ¤
set_four_wire_resistance_range = _store_range
open ¤
open() -> None

Open transport, *CLS, then SYST:REM to disable the front panel and RS-232 echo.

close ¤
close() -> None
set_measurement_function ¤
set_measurement_function(function: MeasurementFunction) -> None

Configure the function for subsequent reads via a dummy measurement.

set_digits ¤
set_digits(n: int) -> None

Set the digits (4, 5, or 6) used as the resolution argument in MEAS:...? commands.

measure_dc_voltage ¤
measure_dc_voltage() -> float
measure_dc_current ¤
measure_dc_current() -> float
measure_resistance ¤
measure_resistance() -> float
measure_four_wire_resistance ¤
measure_four_wire_resistance() -> float
measure_ac_voltage ¤
measure_ac_voltage() -> float
measure_ac_current ¤
measure_ac_current() -> float
set_aperture_seconds ¤
set_aperture_seconds(seconds: float) -> None

Set integration time directly in seconds.

Default raises NotImplementedError. Mutually exclusive with set_aperture_nplc on a given driver — vendors typically expose one or the other.

set_dc_voltage_nplc ¤
set_dc_voltage_nplc(nplc: float) -> None

Set DC-voltage integration time to nplc power-line cycles.

set_ac_voltage_nplc ¤
set_ac_voltage_nplc(nplc: float) -> None

Set AC-voltage integration time to nplc power-line cycles.

set_dc_current_nplc ¤
set_dc_current_nplc(nplc: float) -> None

Set DC-current integration time to nplc power-line cycles.

set_ac_current_nplc ¤
set_ac_current_nplc(nplc: float) -> None

Set AC-current integration time to nplc power-line cycles.

set_two_wire_resistance_nplc ¤
set_two_wire_resistance_nplc(nplc: float) -> None

Set 2-wire-resistance integration time to nplc power-line cycles.

set_four_wire_resistance_nplc ¤
set_four_wire_resistance_nplc(nplc: float) -> None

Set 4-wire-resistance integration time to nplc power-line cycles.