DAQ (Data Acquisition)¤
Interface¤
data acquisition (DAQ) instrument interface and helpers.
Defines InstroDAQ and related helpers.
Transport/protocols: SCPI, VISA.
Public API
InstroDAQ, HWTimingException, InstroDAQFacade
InstroDAQ
¤
InstroDAQ(
name: str,
driver: DAQDriverBase,
device_id: str | None = None,
connection_config: ConnectConfig | None = None,
publishers: list[Publisher] | None = None,
**kwargs,
)
Bases: Instrument
Parameters:
-
(name¤str) –A name to give your DAQ that helps differentiate it from other DAQ instances.
-
(driver¤DAQDriverBase) –The driver instance for the specific DAQ vendor.
-
(device_id¤str | None, default:None) –Provide this when using a non-SCPI/VISA DAQ device. Defaults to None.
-
(connection_config¤ConnectConfig | None, default:None) –Provide this when using a SCPI/VISA DAQ Device. Defaults to None.
-
(publishers¤list[Publisher] | None, default:None) –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 and can be utilized by publishers like NominalCorePublisher as added metadata.
Special keyword arguments: dataset_rid (str): If provided, automatically creates and adds a NominalCorePublisher with the specified dataset RID. Assumes a Nominal 'default' credential is stored on disk.
background_enable
property
writable
¤
background_enable: bool
Get the background worker enable state.
Returns:
-
bool(bool) –True if background worker is enabled, False otherwise.
data_handler
instance-attribute
¤
data_handler = (
None
if connection_config is None
else DataHandler(select(connection_config))
)
create
classmethod
¤
create(
name: str,
vendor: DAQVendor,
resource: str | ConnectConfig,
publishers: list[Publisher] | None = None,
**kwargs,
) -> InstroDAQ
Factory method to create a InstroDAQ instance for the specified vendor and resource.
Parameters:
-
(name¤str) –The name assigned to the DAQ instrument.
-
(vendor¤DAQVendor) –The vendor enum specifying which DAQ driver to use.
-
(resource¤str | ConnectConfig) –The identifier/resource string or connection configuration for the DAQ.
-
(publishers¤list[Publisher] | None, default:None) –Optional list of publishers for data output.
-
–**kwargs¤Optional keyword arguments used as tags throughout the life of the instrument. These tags are applied to the Measurement and Command objects and can be utilized by publishers like NominalCorePublisher as added metadata.
Special keyword arguments: dataset_rid (str): If provided, automatically creates and adds a NominalCorePublisher with the specified dataset RID. Assumes a Nominal 'default' credential is stored on disk.
Returns:
-
InstroDAQ(InstroDAQ) –An initialized InstroDAQ object with the specified configuration.
configure_analog_channel
¤
configure_analog_channel(
direction: Direction,
physical_channel: str,
alias: str | None = None,
range_min: float = -10.0,
range_max: float = 10.0,
scaler: Scaler | None = None,
terminal_config: TerminalConfig | None = None,
)
Configure an analog input or output channel.
Parameters:
-
(direction¤Direction) –The direction of the channel (INPUT or OUTPUT). Note: OUTPUT is not yet implemented.
-
(physical_channel¤str) –The physical channel identifier (e.g., "ai0", "Dev1/ai0").
-
(alias¤str | None, default:None) –A user-friendly name for the channel. If not provided, the physical_channel name is used as the alias. Defaults to None.
-
(range_min¤float, default:-10.0) –The minimum voltage range for the channel. Defaults to -10.0.
-
(range_max¤float, default:10.0) –The maximum voltage range for the channel. Defaults to 10.0.
-
(scaler¤Scaler, default:None) –A Scaler object responsible for scaling the data read by the DAQ channel. Defaults to None.
-
(terminal_config¤TerminalConfig, default:None) –The terminal configuration for the channel. Defaults to None.
Raises:
-
ValueError–If direction is not INPUT or OUTPUT.
configure_ai_sample_rate
¤
configure_ai_sample_rate(
sample_rate: float, samples_per_channel: int | None = None, **kwargs
)
start
¤
start(**kwargs)
Start the DAQ device.
This method initiates a hardware timed data acquisition process.
Parameters:
-
–**kwargs¤Optional keyword arguments. Supported: - channel_type (ChannelType, optional): Specifies which DAQmx task to start (NI devices only).
read_analog
¤
read_analog(**kwargs) -> Measurement | list[Measurement]
Read from analog input channels.
This method handles both hardware-timed and software-timed acquisitions: - Hardware-timed with background disabled: Fetches data from the DAQ buffer directly. - Hardware-timed with background enabled: Retrieves data from the channel buffer for all configured analog input channels. Returns a single Measurement if channels are time-correlated, or a list of Measurements if channels have different timestamps. - Software-timed: Initiates a conversion and returns the current values for all configured channels.
Parameters:
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Measurement objects and can be utilized by publishers like NominalCorePublisher as added metadata.
Returns:
-
Measurement | list[Measurement]–Measurement | list[Measurement]: A single Measurement if all channels share the same
-
Measurement | list[Measurement]–timing information (timestamps), otherwise a list of Measurements where each Measurement
-
Measurement | list[Measurement]–contains channels with distinct timing information. Each Measurement contains channel data
-
Measurement | list[Measurement]–and timestamps. Data is automatically published to all configured publishers (except when
-
Measurement | list[Measurement]–reading from channel buffer with background enabled, as data was already published).
write_analog_value
¤
Write a value to an analog output channel.
Parameters:
-
(channel¤str) –The alias of the analog output channel to write to.
-
(value¤float) –The analog value to write.
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.
Raises:
-
KeyError–If the specified channel alias is not found in the configured analog output channels.
configure_digital_channel
¤
configure_digital_channel(
direction: Direction,
physical_channel: str,
logic: Logic,
logic_level: float | None = None,
alias: str | None = None,
port_width: DigitalPortWidth | None = None,
)
Configure a digital input or output channel.
Parameters:
-
(direction¤Direction) –The direction of the channel (INPUT or OUTPUT).
-
(physical_channel¤str) –The physical channel identifier (e.g., "di0", "port0/line0").
-
(logic¤Logic) –The logic level type (HIGH or LOW).
-
(logic_level¤float | None, default:None) –The voltage threshold for the logic level (if hardware supports customization). If None, the driver's default logic level is used. Defaults to None.
-
(alias¤str | None, default:None) –A user-friendly name for the channel. If not provided, alias will be set to
physical_channel. Defaults to None. -
(port_width¤DigitalPortWidth | None, default:None) –The width of the digital port in bits (8, 16, 32, or 64). Only used when port configuring the channel as a port rather than a line. Defaults to None.
write_digital_line
¤
Write a value to a digital output line.
Parameters:
-
(channel¤str) –The alias of the digital output channel to write to.
-
(data¤int) –The digital value to write (typically 0 or 1 for a line).
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.
Raises:
-
KeyError–If the specified channel alias is not found in the configured digital output channels.
Note
The written command is automatically published to all configured publishers.
read_digital_line
¤
Read a value from a digital input line.
Parameters:
-
(channel¤str) –The alias of the digital input channel to read from.
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Measurement object and can be utilized by publishers like NominalCorePublisher as added metadata.
Returns:
-
Measurement–A Measurement object containing the digital value, channel name, and timestamp. The measurement is also automatically published to all configured publishers.
Raises:
-
KeyError–If the specified channel alias is not found in the configured digital input channels.
write_digital_port
¤
Write a value to a digital output port.
Parameters:
-
(channel¤str) –The alias of the digital output channel to write to.
-
(data¤int) –The digital value to write to the port.
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.
Raises:
-
KeyError–If the specified channel alias is not found in the configured digital output channels.
Note
The written command is automatically published to all configured publishers.
read_digital_port
¤
Read a value from a digital input port.
Parameters:
-
(channel¤str) –The alias of the digital input channel to read from.
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Measurement object and can be utilized by publishers like NominalCorePublisher as added metadata.
Returns:
-
Measurement–A Measurement object containing the digital port value, channel name, and timestamp. The measurement is also automatically published to all configured publishers.
Raises:
-
KeyError–If the specified channel alias is not found in the configured digital input channels.
configure_relay_channel
¤
configure_relay_channel(
physical_channel: str, alias: str | None = None
)
close_relay
¤
Close a relay (connect the circuit).
Parameters:
-
(channel¤str) –The alias of the relay channel to close.
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.
Raises:
-
KeyError–If the specified channel alias is not found in the configured relay channels.
open_relay
¤
Open a relay (disconnect the circuit).
Parameters:
-
(channel¤str) –The alias of the relay channel to open.
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Command object and can be utilized by publishers like NominalCorePublisher as added metadata.
Raises:
-
KeyError–If the specified channel alias is not found in the configured relay channels.
get_actual_sample_rate
¤
get_actual_sample_rate() -> float | None
Return the actual sample rate achieved by the hardware after start().
Returns None if the driver does not support this query or if start() has not been called.
get_points_in_buffer
¤
get_points_in_buffer(**kwargs) -> Measurement
Get the current number of points in the DAQ buffer.
This is useful for monitoring hardware-timed acquisitions to see how many samples are waiting to be read from the buffer.
Parameters:
-
–**kwargs¤Optional keyword arguments used as tags. These tags are applied to the Measurement object and can be utilized by publishers like NominalCorePublisher as added metadata.
Returns:
-
Measurement(Measurement) –A Measurement object containing the buffer point count with channel name
-
Measurement–"{daq_name}.buffer" and a timestamp. The measurement is also automatically published
-
Measurement–to all configured publishers.
add_publisher
¤
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 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:
Raises:
-
RuntimeError–If no connection is configured for this instrument (data_handler is None).
query_arbitrary_command
¤
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:
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
¤
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:
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
¤
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:
InstroDAQFacade
¤
InstroDAQFacade(nominal_daq: InstroDAQ)
Facade class that provides drivers with access to InstroDAQ configuration.
This class implements the APIInstroDAQ interface and allows drivers to access channel configurations and timing settings without direct access to the InstroDAQ instance's internal state.
Parameters:
ai_hw_timing_configs
property
¤
ai_hw_timing_configs: HWTimingConfig
Get the hardware timing configuration for analog input channels.
Returns:
-
HWTimingConfig(HWTimingConfig) –The hardware timing configuration containing sample rate,
-
HWTimingConfig–sample period, and samples per channel.
Raises:
-
ValueError–If hardware timing has not been configured for analog input channels.
ai_sample_rate
property
¤
ai_sample_rate: float
Get the analog input sample rate in Hz.
Returns:
-
float(float) –The sample rate in Hz for analog input channels.
Raises:
-
ValueError–If hardware timing has not been configured for analog input channels.
channels
property
¤
channels: list[DAQChannel]
Get all configured DAQ channels.
Returns:
-
list[DAQChannel]–list[DAQChannel]: A list of all configured channels (analog and digital, input and output).
ai_channels
property
¤
ai_channels: dict[str, AnalogChannel]
Get all configured analog input channels.
Returns:
-
dict[str, AnalogChannel]–dict[str, AnalogChannel]: A dictionary mapping channel aliases to AnalogChannel objects.
ao_channels
property
¤
ao_channels: dict[str, AnalogChannel]
Get all configured analog output channels.
Returns:
-
dict[str, AnalogChannel]–dict[str, AnalogChannel]: A dictionary mapping channel aliases to AnalogChannel objects.
di_channels
property
¤
di_channels: dict[str, DigitalChannel]
Get all configured digital input channels.
Returns:
-
dict[str, DigitalChannel]–dict[str, DigitalChannel]: A dictionary mapping channel aliases to DigitalChannel objects.
do_channels
property
¤
do_channels: dict[str, DigitalChannel]
Get all configured digital output channels.
Returns:
-
dict[str, DigitalChannel]–dict[str, DigitalChannel]: A dictionary mapping channel aliases to DigitalChannel objects.
Types & Configuration¤
data acquisition (DAQ) instrument interface and helpers.
Defines DAQVendor and related helpers.
Public API:
DAQVendor, ChannelType, Logic, Direction, HWTimingConfig, DAQChannel, AnalogChannel, DigitalPortWidth, DigitalChannel, DigitalPortChannel, DigitalLineChannel, RelayChannel
ChannelType
¤
Logic
¤
Direction
¤
TerminalConfig
¤
HWTimingConfig
dataclass
¤
DAQChannel
dataclass
¤
AnalogChannel
dataclass
¤
AnalogChannel(
range_max: float,
range_min: float,
scaler: Scaler | None,
terminal_config: TerminalConfig | None = None,
*,
physical_channel: str,
alias: str,
direction: Direction,
)
Bases: DAQChannel
DigitalPortWidth
¤
DigitalChannel
dataclass
¤
DigitalPortChannel
dataclass
¤
DigitalPortChannel(
logic_level: float | None,
logic: Logic,
width: DigitalPortWidth,
*,
physical_channel: str,
alias: str,
direction: Direction,
)
Bases: DigitalChannel
DigitalLineChannel
dataclass
¤
DigitalLineChannel(
logic_level: float | None,
logic: Logic,
bit_position: int | None = None,
*,
physical_channel: str,
alias: str,
direction: Direction,
)
Bases: DigitalChannel
RelayChannel
dataclass
¤
Bases: DAQChannel
A relay channel that can be opened or closed to route signals.
Note: direction is set to OUTPUT by convention (relay control is an output command).
Scaling¤
Scaling for data acquisition (DAQ).
Defines Scaler and related helpers.
Public API:
Scaler, LinearScaler, ReverseLinearScaler, DevicePassthrough, ScalerPipeline
Scaler
¤
Bases: ABC
Abstract base class for scaler operations.
Scalers convert raw DAQ readings to scaled values with appropriate units. All scaler implementations must provide a scaling function and units.
LinearScaler
¤
Bases: Scaler
Scaler that requires a linear transformation: output = raw * gain + offset.
This is useful for sensors that have a linear relationship between the raw reading and the physical quantity being measured.
Parameters:
ReverseLinearScaler
¤
Bases: Scaler
Scaler that applies a reverse linear transformation: output = (raw - offset) / gain.
This is the inverse of LinearScaler and is useful when a signal of interest has been amplified prior to being measured.
Parameters:
DevicePassthrough
¤
Bases: Scaler
Scaler that passes through raw values without scaling.
This is useful when the DAQ device already provides values in the desired units, or when no scaling is needed.
Parameters:
ScalerPipeline
¤
Bases: Scaler
Scaler that chains multiple scaler stages together.
The pipeline applies each scaler stage sequentially, with the output of one stage becoming the input to the next. This allows for complex multi-stage transformations (e.g., voltage scaling followed by thermocouple conversion).
Parameters:
Thermocouple Scaling¤
Thermocouple for data acquisition (DAQ).
Defines TC_TYPE and related helpers.
Public API:
TC_TYPE, ThermocoupleSensor
ThermocoupleSensor
¤
Bases: Scaler
Sensor class for thermocouple measurement scaling.
This sensor converts DAQ voltage readings (in volts or millivolts, as required by the thermocouple library) to temperature values in degrees Celsius using the appropriate thermocouple type and cold junction compensation (CJC).
Parameters:
-
(type¤TC_TYPE) –The type of thermocouple (e.g., K, J, T, etc.).
-
(cjc¤float) –Cold junction compensation (reference temperature) in degrees Celsius.
Example
sensor = ThermocoupleSensor(TC_TYPE.K, 25.0) # Type K with 25°C CJC
Methods:
Parameters:
Driver Interface¤
data acquisition (DAQ) instrument interface and helpers.
Defines DAQDriverBase and related helpers.
Public API:
APIInstroDAQ, DAQDriverBase, DAQDriverDataHandler
APIInstroDAQ
¤
Bases: Protocol
API for the InstroDAQ instrument type.
ai_hw_timing_configs
property
¤
ai_hw_timing_configs: HWTimingConfig
Get the hardware timing configuration for the analog input channels.
ai_channels
property
¤
ai_channels: dict[str, AnalogChannel]
Get the configured analog input channels on the DAQ.
ao_channels
property
¤
ao_channels: dict[str, AnalogChannel]
Get the configured analog output channels on the DAQ.
di_channels
property
¤
di_channels: dict[str, DigitalChannel]
Get the configured digital input channels on the DAQ.
do_channels
property
¤
do_channels: dict[str, DigitalChannel]
Get the configured digital output channels on the DAQ.
HWTimestamper
¤
HWTimestamper(last_timestamp: int)
Generates contiguous nanosecond timestamps for hardware-timed DAQ batches.
Anchors the timeline to the wall clock exactly once via seed(), then advances
purely by sample period on every subsequent next() call. This eliminates timestamp
overlap when two reads return in rapid succession.
seed
classmethod
¤
Create a timestamper anchored to the first batch's wall-clock read-return time.
Parameters:
-
(t_wall¤int) –Wall-clock ns timestamp captured when the first read returned.
-
(dt¤int) –Sample period in nanoseconds.
-
(length¤int) –Number of samples in the first batch.
Returns:
-
tuple[HWTimestamper, list[int]]–A seeded HWTimestamper and the timestamps for the first batch.
next_batch
¤
DAQDriverBase
¤
Bases: ABC
get_driver
classmethod
¤
get_driver(
vendor: DAQVendor, resource: str | None = None
) -> DAQDriverBase
Get a driver instance for the specified vendor and resource.
Parameters:
-
(vendor¤DAQVendor) –The vendor of the DAQ device.
-
(resource¤str | None, default:None) –The resource identifier for the DAQ device.
Returns:
-
DAQDriverBase(DAQDriverBase) –A driver instance for the specified vendor and resource.
configure_ai_channel
abstractmethod
¤
configure_ai_channel(channel: AnalogChannel)
Configure a channel on the device.
configure_ai_hw_timing
abstractmethod
¤
configure_ai_hw_timing(hw_timing_config: HWTimingConfig)
Configure the DAQ for hardware timed sampling.
define_digital_channel
abstractmethod
¤
define_digital_channel(
direction: Direction,
physical_channel: str,
logic: Logic,
logic_level: float | None = None,
alias: str | None = None,
port_width: DigitalPortWidth | None = None,
) -> DigitalChannel
configure_do_channel
abstractmethod
¤
configure_do_channel(channel: DigitalChannel)
Configure a channel on the device.
configure_di_channel
abstractmethod
¤
configure_di_channel(channel: DigitalChannel)
Configure a channel on the device.
get_actual_sample_rate
¤
get_actual_sample_rate() -> float | None
Return the actual sample rate achieved by the hardware after start().
Returns None if the driver does not support this query or if start() has not been called.
write_analog_value
¤
write_analog_value(channel: AnalogChannel, value: float)
Write a value to an analog output channel.
Parameters:
-
(channel¤AnalogChannel) –Channel to write setpoint to.
-
(value¤float) –Value to output
write_digital_line
abstractmethod
¤
write_digital_line(channel: DigitalChannel, data: int)
Write to digital output channels.
write_digital_port
abstractmethod
¤
write_digital_port(channel: DigitalChannel, data: int)
Write a value to a digital output port.
define_relay_channel
¤
define_relay_channel(
physical_channel: str, alias: str | None = None
) -> RelayChannel
Define a relay channel.
Parameters:
-
(physical_channel¤str) –Physical channel identifier (e.g., "3101" for slot 3, channel 101).
-
(alias¤str | None, default:None) –Optional alias for the channel.
Returns:
-
RelayChannel(RelayChannel) –The configured relay channel object.
close_relay
¤
close_relay(channel: RelayChannel)
Close a relay channel (connect the circuit).
Parameters:
-
(channel¤RelayChannel) –The relay channel to close.
open_relay
¤
open_relay(channel: RelayChannel)
Open a relay channel (disconnect the circuit).
Parameters:
-
(channel¤RelayChannel) –The relay channel to open.
DAQDriverDataHandler
¤
DAQDriverDataHandler()
Bases: DAQDriverBase
set_data_handler
¤
set_data_handler(data_handler: DataHandler)
Set the data handler after construction.
get_driver
classmethod
¤
get_driver(
vendor: DAQVendor, resource: str | None = None
) -> DAQDriverBase
Get a driver instance for the specified vendor and resource.
Parameters:
-
(vendor¤DAQVendor) –The vendor of the DAQ device.
-
(resource¤str | None, default:None) –The resource identifier for the DAQ device.
Returns:
-
DAQDriverBase(DAQDriverBase) –A driver instance for the specified vendor and resource.
configure_ai_channel
abstractmethod
¤
configure_ai_channel(channel: AnalogChannel)
Configure a channel on the device.
configure_ai_hw_timing
abstractmethod
¤
configure_ai_hw_timing(hw_timing_config: HWTimingConfig)
Configure the DAQ for hardware timed sampling.
define_digital_channel
abstractmethod
¤
define_digital_channel(
direction: Direction,
physical_channel: str,
logic: Logic,
logic_level: float | None = None,
alias: str | None = None,
port_width: DigitalPortWidth | None = None,
) -> DigitalChannel
configure_do_channel
abstractmethod
¤
configure_do_channel(channel: DigitalChannel)
Configure a channel on the device.
configure_di_channel
abstractmethod
¤
configure_di_channel(channel: DigitalChannel)
Configure a channel on the device.
get_actual_sample_rate
¤
get_actual_sample_rate() -> float | None
Return the actual sample rate achieved by the hardware after start().
Returns None if the driver does not support this query or if start() has not been called.
write_analog_value
¤
write_analog_value(channel: AnalogChannel, value: float)
Write a value to an analog output channel.
Parameters:
-
(channel¤AnalogChannel) –Channel to write setpoint to.
-
(value¤float) –Value to output
write_digital_line
abstractmethod
¤
write_digital_line(channel: DigitalChannel, data: int)
Write to digital output channels.
write_digital_port
abstractmethod
¤
write_digital_port(channel: DigitalChannel, data: int)
Write a value to a digital output port.
define_relay_channel
¤
define_relay_channel(
physical_channel: str, alias: str | None = None
) -> RelayChannel
Define a relay channel.
Parameters:
-
(physical_channel¤str) –Physical channel identifier (e.g., "3101" for slot 3, channel 101).
-
(alias¤str | None, default:None) –Optional alias for the channel.
Returns:
-
RelayChannel(RelayChannel) –The configured relay channel object.
close_relay
¤
close_relay(channel: RelayChannel)
Close a relay channel (connect the circuit).
Parameters:
-
(channel¤RelayChannel) –The relay channel to close.
open_relay
¤
open_relay(channel: RelayChannel)
Open a relay channel (disconnect the circuit).
Parameters:
-
(channel¤RelayChannel) –The relay channel to open.
Vendor Drivers¤
Keysight 34980A¤
Keysight 34980A driver for data acquisition (DAQ) instruments.
Implements Keysight34980A and supporting helpers.
Transport/protocols: SCPI.
Public API
KeysightData, keysight_str_to_ns, parse_datastring, get_scanlist, Keysight34980A
KeysightData
dataclass
¤
Keysight34980A
¤
Keysight34980A(sync_system_clock: bool = True)
Bases: DAQDriverDataHandler
configure_ai_channel
¤
configure_ai_channel(channel: AnalogChannel)
Configure a channel on the device.
configure_ai_hw_timing
¤
configure_ai_hw_timing(hw_timing_config: HWTimingConfig)
Configure the DAQ for hardware timed sampling.
define_digital_channel
¤
define_digital_channel(
direction: Direction,
physical_channel: str,
logic: Logic,
logic_level: float | None = None,
alias: str | None = None,
port_width: DigitalPortWidth | None = None,
) -> DigitalChannel
configure_do_channel
¤
configure_do_channel(channel: DigitalChannel)
Configure a channel on the device.
configure_di_channel
¤
configure_di_channel(channel: DigitalChannel)
Configure a channel on the device.
get_driver
classmethod
¤
get_driver(
vendor: DAQVendor, resource: str | None = None
) -> DAQDriverBase
Get a driver instance for the specified vendor and resource.
Parameters:
-
(vendor¤DAQVendor) –The vendor of the DAQ device.
-
(resource¤str | None, default:None) –The resource identifier for the DAQ device.
Returns:
-
DAQDriverBase(DAQDriverBase) –A driver instance for the specified vendor and resource.
get_actual_sample_rate
¤
get_actual_sample_rate() -> float | None
Return the actual sample rate achieved by the hardware after start().
Returns None if the driver does not support this query or if start() has not been called.
write_analog_value
¤
write_analog_value(channel: AnalogChannel, value: float)
Write a value to an analog output channel.
Parameters:
-
(channel¤AnalogChannel) –Channel to write setpoint to.
-
(value¤float) –Value to output
define_relay_channel
¤
define_relay_channel(
physical_channel: str, alias: str | None = None
) -> RelayChannel
Define a relay channel.
Parameters:
-
(physical_channel¤str) –Physical channel identifier (e.g., "3101" for slot 3, channel 101).
-
(alias¤str | None, default:None) –Optional alias for the channel.
Returns:
-
RelayChannel(RelayChannel) –The configured relay channel object.
set_data_handler
¤
set_data_handler(data_handler: DataHandler)
Set the data handler after construction.