Skip to content

DMM (Digital Multimeter)¤

Interface¤

Digital multimeter (DMM) instrument interface and helpers.

Defines NominalDMM and related helpers. Transport/protocols: SCPI, VISA.

Public API

NominalDMM, NominalDMMFacade

logger module-attribute ¤

logger = getLogger(__name__)

NominalDMM ¤

NominalDMM(
    name: str,
    driver: DMMDriverBase,
    connection_config: ConnectConfig | None = None,
    device_id: str | None = None,
    publishers: list[Publisher] | None = None,
    **kwargs,
)

Bases: NominalInstrument

Digital multimeter hardware abstraction to communicate with various models and vendor DMMs.

Methods return Measurement and Command data types to be compatible with Nominal Instrumentation tools. Configure measurement with set_measurement_function(), then call read() to trigger a measurement.

Parameters:

  • name ¤

    (str) –

    A name to identify this DMM instance. Used in channel naming and published data.

  • driver ¤

    (DMMDriverBase) –

    The driver instance for the specific DMM vendor/model.

  • connection_config ¤

    (ConnectConfig | None, default: None ) –

    Connection configuration for SCPI/VISA devices. Pass None for vendor-library drivers that use device_id.

  • device_id ¤

    (str | None, default: None ) –

    Device identifier for vendor-library drivers. Pass None for SCPI devices.

  • publishers ¤

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

    List of publishers to send data to when executing methods. Defaults to None.

  • **kwargs ¤

    Optional keyword arguments used as tags throughout the life of the instrument. These tags are applied to the Measurement and Command objects.

    Special keyword arguments: dataset_rid: If provided, automatically creates and adds a NominalCorePublisher with the specified dataset RID. Assumes a Nominal 'default' credential is stored on disk.

name instance-attribute ¤

name = name

data_handler instance-attribute ¤

data_handler = (
    None
    if connection_config is None
    else DataHandler(select(connection_config))
)

publishers instance-attribute ¤

publishers = publishers or []

default_tags instance-attribute ¤

default_tags: dict[str, str] = {}

background_interval property writable ¤

background_interval

Get the background worker interval setting.

Returns:

  • float

    The current interval in seconds between background worker iterations. The worker waits this duration between executing background daemon functions.

background_enable property writable ¤

background_enable

Get the background worker enable state.

Returns:

  • bool

    True if the background worker is enabled, False otherwise.

auto_create classmethod ¤

auto_create(
    name: str,
    resource: ConnectConfig,
    publishers: list[Publisher] | None = None,
    **kwargs,
) -> NominalDMM

Discover and create a NominalDMM instance by querying the instrument's IDN.

This factory method automatically discovers the DMM model and creates an appropriate driver instance from Nominal's list of registered DMM vendors/models.

The discovery process: 1. Open a VISA session to the resource string. 2. Send '*IDN?' query. 3. Parse the returned vendor/model string. 4. Find a matching driver subclass. 5. Close the temporary session. 6. Create and return a NominalDMM instance with the appropriate driver.

Parameters:

  • name ¤
    (str) –

    A name to identify this DMM instance. Used in channel naming and published data.

  • resource ¤
    (ConnectConfig) –

    A ConnectConfig for SCPI/VISA devices.

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

    List of publishers to send data to when executing methods. Defaults to None.

  • **kwargs ¤

    Optional keyword arguments used as tags throughout the life of the instrument.

    Special keyword arguments: dataset_rid: If provided, automatically creates and adds a NominalCorePublisher with the specified dataset RID.

Returns:

  • NominalDMM ( NominalDMM ) –

    Configured DMM instance with the appropriate driver.

Raises:

  • ValueError

    If no matching driver is found for the IDN string.

start ¤

start() -> None

Start the background worker thread.

Raises:

  • ValueError

    If set_measurement_function() has not been called.

open ¤

open() -> None

Establish connection to the device.

close ¤

close() -> None

Disconnect from the device.

set_measurement_function ¤

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

Set the DMM to the measurement function (dc voltage, resistance, etc.) you intend to perform.

Parameters:

  • function ¤
    (MeasurementFunction) –

    The measurement function to configure the DMM to.

  • **kwargs ¤

    Optional keyword arguments used as tags on the published Command.

Returns:

  • Command ( Command ) –

    A Command object containing the configuration, timestamp, and tags. The command is automatically published to all configured publishers.

set_digits ¤

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

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

Parameters:

  • n ¤
    (int) –

    Resolution in digits.

  • **kwargs ¤

    Optional keyword arguments used as tags on the published Command.

Returns:

  • Command ( Command ) –

    A Command object. The command is automatically published.

Raises:

  • ValueError

    If set_measurement_function() has not been called.

set_aperture_seconds ¤

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

Set integration time (aperture) in seconds. Requires set_measurement_function() to have been called.

Parameters:

  • seconds ¤
    (float) –

    Integration time in seconds

  • **kwargs ¤

    Optional keyword arguments used as tags on the published Command.

Returns:

  • Command ( Command ) –

    A Command object. The command is automatically published.

Raises:

  • ValueError

    If set_measurement_function() has not been called.

set_aperture_nplc ¤

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

Set integration time (aperture) in number of power line cycles. Requires set_measurement_function() to have been called.

NPLC is number of power line cycles. DC Voltage, DC Current, and Resistance measurement resolution, accuracy is reduced by power line induced AC noise. Using NPLC of 1 or greater increases AC noise integration time, and increases measurement resolution and accuracy, however the trade-off is slower measurement rates. For highest measurement accuracy NPLC of 100 is recommended.

Parameters:

  • nplc ¤
    (float) –

    Integration time number of power line cycles.

  • **kwargs ¤

    Optional keyword arguments used as tags on the published Command.

Returns:

  • Command ( Command ) –

    A Command object. The command is automatically published.

Raises:

  • ValueError

    If set_measurement_function() has not been called.

set_range ¤

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

Set manual range; None = auto range. Requires set_measurement_function() to have been called.

Parameters:

  • value ¤
    (float | None) –

    Range in current function's units, or None for auto range.

  • **kwargs ¤

    Optional keyword arguments used as tags on the published Command.

Returns:

  • Command ( Command ) –

    A Command object. The command is automatically published.

Raises:

  • ValueError

    If set_measurement_function() has not been called.

read ¤

read(**kwargs) -> Measurement

Trigger a measurement and return the value. Requires set_measurement_function() first.

The driver uses the current measurement function (from the facade) to dispatch to the appropriate measure method. The result is wrapped in a Measurement and published.

Parameters:

  • **kwargs ¤

    Optional keyword arguments used as tags on the published Measurement.

Returns:

  • Measurement ( Measurement ) –

    A Measurement object containing the channel name, value, timestamp, and tags. The measurement is automatically published.

Raises:

  • ValueError

    If set_measurement_function() has not been called.

add_publisher ¤

add_publisher(publisher: Publisher)

Add a publisher to the list of publishers for this instrument.

Publishers receive all Measurement and Command objects that are published by this instrument. Multiple publishers can be added to send data to different destinations.

Parameters:

  • publisher ¤
    (Publisher) –

    The publisher instance to add.

publish ¤

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

Publish a Measurement or Command to all configured publishers.

This method sends the data to all publishers that have been added to this instrument. Additional keyword arguments are passed through to each publisher's publish method.

Parameters:

  • data ¤
    (Measurement | Command) –

    The measurement or command data to publish.

  • **kwargs ¤

    Optional keyword arguments passed to each publisher's publish method.

get_identity ¤

get_identity() -> str

Query the instrument's identity string.

This method sends the SCPI "*IDN?" command to retrieve the instrument's identification information, which typically includes manufacturer, model number, serial number, and firmware version.

Returns:

  • str ( str ) –

    The instrument's identity string.

Raises:

  • RuntimeError

    If no connection is configured for this instrument (data_handler is None).

open_and_get_identity staticmethod ¤

open_and_get_identity(connection_config: ConnectConfig) -> str

Convenience method to open a connection, query identity, and close.

This static method creates a temporary instrument instance, opens a connection, queries the identity, closes the connection, and returns the identity string. Useful for instrument discovery without maintaining a long-lived connection.

Parameters:

  • connection_config ¤
    (ConnectConfig) –

    The connection configuration for the instrument.

Returns:

  • str ( str ) –

    The instrument's identity string.

Raises:

  • RuntimeError

    If the connection cannot be established or the identity cannot be queried.

send_arbitrary_command ¤

send_arbitrary_command(command: str)

Send an arbitrary command string to the instrument.

This method allows sending custom commands directly to the instrument without going through the instrument's high-level API. Useful for accessing instrument-specific features not exposed by the standard interface.

Parameters:

  • command ¤
    (str) –

    The command string to send to the instrument.

Raises:

  • RuntimeError

    If no connection is configured for this instrument (data_handler is None).

query_arbitrary_command ¤

query_arbitrary_command(command: str) -> str

Send an arbitrary command string and return the instrument's response.

This method sends a command and waits for a response, useful for querying instrument state or configuration. The response is returned as a string.

Parameters:

  • command ¤
    (str) –

    The query command string to send to the instrument.

Returns:

  • str ( str ) –

    The instrument's response to the query command.

Raises:

  • RuntimeError

    If no connection is configured for this instrument (data_handler is None).

add_background_daemon_function ¤

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

Adds a function (and its arguments) to be periodically called by the background worker daemon.

There may already be functions defined and this will add to the end of that list. Call define_background_daemon to clear and define a new function if you do not want the default functions to run.

Parameters:

  • method ¤
    (Callable) –

    The method/function to be invoked in the background thread.

  • *args ¤

    Positional arguments to pass to the method.

  • **kwargs ¤

    Keyword arguments to pass to the method.

stop ¤

stop()

Stop the background worker thread.

This method signals the background worker thread to stop and waits for it to complete. If the thread is not running, this method does nothing.

get_channel ¤

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

Get most recent Measurement data for a specific channel from the buffer.

Parameters:

  • channel_name ¤
    (str) –

    The name of the channel from which to retrieve data.

  • length ¤
    (int, default: 1 ) –

    The number of most recent samples to return.

  • wait_for_latest ¤
    (bool, default: False ) –

    Block and wait for the next channel value(s).

  • timeout ¤
    (float, default: 10.0 ) –

    Timeout in seconds when waiting for channel or values. Defaults to 10.0 seconds. Only applies when wait_for_latest=True.

Returns:

  • Measurement ( Measurement ) –

    A Measurement object containing the requested channel data and timestamps.

Raises:

  • RuntimeError

    No background buffer exists because start() was not called.

  • ChannelNotFoundTimeoutError

    If wait_for_latest=True and the channel does not appear within timeout.

  • ChannelValueTimeoutError

    If wait_for_latest=True and sufficient values are not available within timeout.

define_background_daemon ¤

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

Clear all background daemon functions and register a single custom method.

This method clears any previously registered background daemon functions and registers a new method to be called in the background daemon loop. This is useful when you want to replace the default background functions with a custom implementation.

Parameters:

  • method ¤
    (Callable) –

    The method to call as part of the background daemon.

  • *args ¤

    Positional arguments to pass to the method when it is called.

  • **kwargs ¤

    Keyword arguments to pass to the method when it is called.

NominalDMMFacade ¤

NominalDMMFacade(nominal_dmm: NominalDMM)

Facade class that provides drivers with access to NominalDMM configuration.

This class implements the APINominalDMM interface and allows drivers to access the current measurement configuration without direct access to the NominalDMM instance's internal state.

Parameters:

  • nominal_dmm ¤

    (NominalDMM) –

    The NominalDMM instance to provide access to.

measurement_function property ¤

measurement_function: MeasurementFunction

Get the current measurement function (mode) of the DMM.

Returns:

Raises:

  • ValueError

    If set_measurement_function() has not been called.

measurement_config property ¤

measurement_config: DMMMeasurementConfig

Get the current acquisition configuration of the DMM.

Returns:

Raises:

  • ValueError

    If set_measurement_function() has not been called.

Types & Configuration¤

Digital multimeter (DMM) instrument interface and helpers.

Defines MeasurementFunction, DMMMeasurementConfig and related helpers. Public API: MeasurementFunction, DMMMeasurementConfig

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'

DMMMeasurementConfig dataclass ¤

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

Full acquisition configuration for a DMM measurement.

Holds the measurement function and optional acquisition options so users can adjust DMM acquisition in one place. Drivers apply only the options they support; unsupported options are ignored or can raise in the driver.

Attributes:

  • function (MeasurementFunction) –

    Measurement function (required).

  • digits (int | None) –

    Resolution in digits (optional). None = instrument default.

  • aperture_seconds (float | None) –

    Integration time in seconds (optional). Some instruments use this; others use aperture_nplc.

  • aperture_nplc (float | None) –

    Integration time in number of power-line cycles (optional). Some instruments use this; others use aperture_seconds.

  • range (float | None) –

    Manual range in current function's units (optional). 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¤

Digital multimeter (DMM) instrument interface and helpers.

Defines DMMDriverBase and related helpers. Transport/protocols: SCPI.

Public API

APINominalDMM, DMMDriverBase, DMMDriverDataHandler

logger module-attribute ¤

logger = getLogger(__name__)

APINominalDMM ¤

Bases: Protocol

API for the NominalDMM instrument type.

Exposes the currently configured measurement function and optionally the full measurement config so the driver can dispatch read() correctly.

measurement_function property ¤

measurement_function: MeasurementFunction

Get the current measurement function (mode) of the DMM.

measurement_config property ¤

measurement_config: DMMMeasurementConfig

Get the current acquisition configuration of the DMM.

DMMDriverBase ¤

Bases: ABC

Abstract base class for vendor DMM.

Each concrete provider implements sending and receiving data for its vendor/model.

hal instance-attribute ¤

open ¤

open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤

close() -> None

Close connection to the device. Override in subclasses if needed.

set_measurement_function abstractmethod ¤

set_measurement_function(function: MeasurementFunction) -> None

Set the measurement function (mode) for the DMM.

Parameters:

set_digits ¤

set_digits(n: int) -> None

Set resolution in digits. Override in subclasses if supported.

set_aperture_seconds ¤

set_aperture_seconds(seconds: float) -> None

Set integration time (aperture) in seconds. Override in subclasses if supported.

Parameters:

  • seconds ¤
    (float) –

    Integration time in seconds.

set_aperture_nplc ¤

set_aperture_nplc(nplc: float) -> None

Set integration time (aperture) in number of power line cycles. Override in subclasses if supported.

Parameters:

  • nplc ¤
    (float) –

    Integration time number of power line cycles.

set_range ¤

set_range(value: float | None) -> None

Set manual range; None = auto range. Override in subclasses if supported.

Parameters:

  • value ¤
    (float | None) –

    Range in current function's units, or None for auto range.

measure_four_wire_resistance ¤

measure_four_wire_resistance() -> float

Measure 4-wire resistance. Override in subclasses if supported.

measure_dc_voltage abstractmethod ¤

measure_dc_voltage() -> float

Measure DC voltage. Override to raise if unsupported.

measure_ac_voltage abstractmethod ¤

measure_ac_voltage() -> float

Measure AC voltage. Override to raise if unsupported.

measure_resistance abstractmethod ¤

measure_resistance() -> float

Measure resistance. Override to raise if unsupported.

measure_dc_current abstractmethod ¤

measure_dc_current() -> float

Measure DC current. Override to raise if unsupported.

measure_ac_current abstractmethod ¤

measure_ac_current() -> float

Measure AC current. Override to raise if unsupported.

DMMDriverDataHandler ¤

DMMDriverDataHandler()

Bases: DMMDriverBase

Base class for SCPI-based DMM drivers using DataHandler.

data_handler property ¤

data_handler: DataHandler

Get the data handler, ensuring it's been set.

hal instance-attribute ¤

set_data_handler ¤

set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication.

get_driver classmethod ¤

get_driver(idn: str) -> type[DMMDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument.

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match.

match_idn abstractmethod classmethod ¤

match_idn(idn: str) -> bool

Check if this driver can handle the given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument.

Returns:

  • bool

    True if this driver can handle the instrument, False otherwise.

check_errors abstractmethod ¤

check_errors() -> None

Query the error queue and raise if error pending. Return silently if no errors.

open ¤

open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤

close() -> None

Close connection to the device. Override in subclasses if needed.

set_measurement_function abstractmethod ¤

set_measurement_function(function: MeasurementFunction) -> None

Set the measurement function (mode) for the DMM.

Parameters:

set_digits ¤

set_digits(n: int) -> None

Set resolution in digits. Override in subclasses if supported.

set_aperture_seconds ¤

set_aperture_seconds(seconds: float) -> None

Set integration time (aperture) in seconds. Override in subclasses if supported.

Parameters:

  • seconds ¤
    (float) –

    Integration time in seconds.

set_aperture_nplc ¤

set_aperture_nplc(nplc: float) -> None

Set integration time (aperture) in number of power line cycles. Override in subclasses if supported.

Parameters:

  • nplc ¤
    (float) –

    Integration time number of power line cycles.

set_range ¤

set_range(value: float | None) -> None

Set manual range; None = auto range. Override in subclasses if supported.

Parameters:

  • value ¤
    (float | None) –

    Range in current function's units, or None for auto range.

measure_four_wire_resistance ¤

measure_four_wire_resistance() -> float

Measure 4-wire resistance. Override in subclasses if supported.

measure_dc_voltage abstractmethod ¤

measure_dc_voltage() -> float

Measure DC voltage. Override to raise if unsupported.

measure_ac_voltage abstractmethod ¤

measure_ac_voltage() -> float

Measure AC voltage. Override to raise if unsupported.

measure_resistance abstractmethod ¤

measure_resistance() -> float

Measure resistance. Override to raise if unsupported.

measure_dc_current abstractmethod ¤

measure_dc_current() -> float

Measure DC current. Override to raise if unsupported.

measure_ac_current abstractmethod ¤

measure_ac_current() -> float

Measure AC current. Override to raise if unsupported.

Vendor Drivers¤

Keithley 2400¤

Keithley 2400 SourceMeter driver (DMM measurement portion only).

Implements DMM-style measurement (DC voltage, DC current, resistance) for the Keithley 2400 Source Measure Unit. Only the measurement (sense) functionality is exposed; source configuration is kept minimal (e.g. zero level for V/I, small current for resistance). AC voltage and AC current are not supported by the 2400 in this context and raise NotImplementedError.

Transport/protocols: SCPI.

Public API

Keithley2400DMMDriver

Keithley2400DMMDriver ¤

Keithley2400DMMDriver()

Bases: DMMDriverDataHandler

DMM driver for Keithley 2400 SourceMeter (measurement only).

Supports DC voltage, DC current, and resistance. Integration time is set via NPLC only (0.01 to 10); the 2400 does not support aperture in seconds (no :SENS:VOLT:APER-style SCPI). Range and NPLC are supported. Digits (resolution) are not directly set; use NPLC. AC voltage/current are not supported.

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool

Match Keithley 2400 series (*IDN? contains KEITHLEY and 2400).

set_measurement_function ¤
set_measurement_function(function: MeasurementFunction) -> None

Configure the 2400 for the selected measurement function and options.

set_digits ¤
set_digits(n: int) -> None

Keithley 2400 does not expose a direct digits SCPI; use set_aperture (NPLC) for resolution.

set_aperture_nplc ¤
set_aperture_nplc(nplc: float) -> None

Set integration time via NPLC (0.01 to 10). This model has no aperture-in-seconds SCPI.

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

Set manual range (V, A, or Ohm); None = auto range.

measure_dc_voltage ¤
measure_dc_voltage() -> float

Measure DC voltage. Output is turned on at 0 V to allow reading.

measure_dc_current ¤
measure_dc_current() -> float

Measure DC current. Output is turned on at 0 A to allow reading.

measure_resistance ¤
measure_resistance() -> float

Measure resistance. Output is turned on with default source current.

measure_ac_voltage ¤
measure_ac_voltage() -> float

AC voltage is not supported by the Keithley 2400 in this driver.

measure_ac_current ¤
measure_ac_current() -> float

AC current is not supported by the Keithley 2400 in this driver.

check_errors ¤
check_errors() -> None

Query the instrument error queue and raise if an error is reported.

open ¤
open() -> None

Open connection to the device. Override in subclasses if needed.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_aperture_seconds ¤
set_aperture_seconds(seconds: float) -> None

Set integration time (aperture) in seconds. Override in subclasses if supported.

Parameters:

  • seconds ¤
    (float) –

    Integration time in seconds.

measure_four_wire_resistance ¤
measure_four_wire_resistance() -> float

Measure 4-wire resistance. Override in subclasses if supported.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication.

get_driver classmethod ¤
get_driver(idn: str) -> type[DMMDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument.

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match.

Agilent 34401A¤

Agilent/HP 34401A Digital Multimeter driver.

Implements DMM-style measurements (DC/AC voltage, DC/AC current, resistance) for the Agilent 34401A DMM.

Supports both 2-wire and 4-wire resistance measurements.

Transport/protocols: SCPI over GPIB, RS-232.

Public API

Agilent34401ADMMDriver

Agilent34401ADMMDriver ¤

Agilent34401ADMMDriver()

Bases: DMMDriverDataHandler

DMM driver for Agilent/HP/Keysight 34401A digital multimeter.

hal instance-attribute ¤
data_handler property ¤
data_handler: DataHandler

Get the data handler, ensuring it's been set.

match_idn classmethod ¤
match_idn(idn: str) -> bool

Match Agilent/HP/Keysight 34401A (*IDN? contains 34401).

open ¤
open() -> None

Initialize the instrument for remote operation.

Clears errors and sends SYST:REM to put instrument in remote mode, which disables the front panel and RS-232 echo that can interfere with communication, we send the SYST:REM command to put the instrument in remote mode.

set_measurement_function ¤
set_measurement_function(function: MeasurementFunction) -> None

Set the measurement function for subsequent reads.

Does a dummy read to configure the instrument for this function.

set_digits ¤
set_digits(n: int) -> None

Set measurement resolution for subsequent reads.

The resolution is passed to MEAS:...? commands as an optional parameter. Maps digits to approximate resolution values.

Parameters:

  • n ¤
    (int) –

    Number of digits (4, 5, or 6).

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

Set manual range for subsequent reads.

The range is passed to MEAS:...? commands as an optional parameter. Pass None for auto-ranging (default).

Parameters:

  • value ¤
    (float | None) –

    Range value in function units (V, A, Ohm), or None for auto.

measure_dc_voltage ¤
measure_dc_voltage() -> float

Trigger a DC voltage measurement and return the result.

Uses MEAS:VOLT:DC? with optional range and resolution parameters.

measure_dc_current ¤
measure_dc_current() -> float

Trigger a DC current measurement and return the result.

Uses MEAS:CURR:DC? with optional range and resolution parameters.

measure_resistance ¤
measure_resistance() -> float

Trigger a 2-wire resistance measurement and return the result.

Uses MEAS:RES? with optional range and resolution parameters.

measure_four_wire_resistance ¤
measure_four_wire_resistance() -> float

Trigger a 4-wire resistance measurement and return the result.

Uses MEAS:FRES? with optional range and resolution parameters.

measure_ac_voltage ¤
measure_ac_voltage() -> float

Trigger an AC voltage measurement and return the result.

Uses MEAS:VOLT:AC? with optional range and resolution parameters. Note: AC measurements are true RMS, AC-coupled.

measure_ac_current ¤
measure_ac_current() -> float

Trigger an AC current measurement and return the result.

Uses MEAS:CURR:AC? with optional range and resolution parameters. Note: AC measurements are true RMS, AC-coupled.

check_errors ¤
check_errors() -> None

Query the instrument error queue and raise if an error is reported.

Note: On RS-232, this may timeout if the instrument is busy or if communication settings aren't optimal. Timeouts are silently ignored to avoid blocking normal operation.

close ¤
close() -> None

Close connection to the device. Override in subclasses if needed.

set_aperture_seconds ¤
set_aperture_seconds(seconds: float) -> None

Set integration time (aperture) in seconds. Override in subclasses if supported.

Parameters:

  • seconds ¤
    (float) –

    Integration time in seconds.

set_aperture_nplc ¤
set_aperture_nplc(nplc: float) -> None

Set integration time (aperture) in number of power line cycles. Override in subclasses if supported.

Parameters:

  • nplc ¤
    (float) –

    Integration time number of power line cycles.

set_data_handler ¤
set_data_handler(data_handler: DataHandler) -> None

Set the data handler for SCPI-based drivers.

Parameters:

  • data_handler ¤
    (DataHandler) –

    The DataHandler instance to use for communication.

get_driver classmethod ¤
get_driver(idn: str) -> type[DMMDriverDataHandler]

Find the appropriate driver class for a given IDN string.

Parameters:

  • idn ¤
    (str) –

    The *IDN? response string from the instrument.

Returns:

Raises:

  • ValueError

    If IDN is empty, no matching driver is found, or multiple drivers match.