DAQDriverBase#
- class DAQDriverBase[source]#
Bases:
ABCVendor DAQ driver contract.
The driver is the single source of truth for configured channels and timing config, held in private dicts/slots that
__init__initializes so every concrete driver has the same shape; subclasses callsuper().__init__()and then populate those privates inside their ownconfigure_*methods (self._ai_channels[channel.alias] = channel,self._ai_hw_timing_config = hw_timing_config, etc.). Read-only@propertyaccessors hand back frozen snapshots so the state can’t be mutated from outside theconfigure_*path;InstroDAQexposes the same snapshots for user introspection — it does not keep its own copies.Attributes
Frozen snapshot of configured AI channels, keyed by alias.
Frozen snapshot of configured AO channels, keyed by alias.
Frozen snapshot of all configured AI/AO/DI/DO channels (excludes relays).
Frozen snapshot of configured DI channels, keyed by alias.
Frozen snapshot of configured DO channels, keyed by alias.
Frozen snapshot of configured relay channels, keyed by alias.
Methods
Close every task/handle owned by the driver.
Close the relay (connect the circuit).
Deprecated: implement
configure_ai_voltage_channelinstead.Register an AI current channel.
Configure hardware-timed AI sampling at
hw_timing_config.sample_rate.Register an AI thermocouple channel.
Register an AI voltage channel with the underlying driver.
Deprecated: implement
configure_ao_voltage_channelinstead.Register an AO current channel.
Register an AO voltage channel.
Parse, program, and register a DI line channel.
Parse, program, and register a DI port channel.
Parse, program, and register a DO line channel.
Parse, program, and register a DO port channel.
Build a
RelayChannelforphysical_channel(e.g."3101"= slot 3 / channel 101).Block until
samples_per_channelnew AI samples are available, then return them.Actual hardware sample rate achieved after
start().Open the underlying transport (or verify the device is present, for handle-less SDKs).
Open the relay (disconnect the circuit).
Software-timed read of every configured AI channel.
Sample a single DI line.
Sample a multi-line DI port.
Start hardware-timed acquisition.
Stop a running acquisition and release any scan buffers.
Write
valueto AOchannel.Drive a single DO line.
Drive a multi-line DO port.
- property channels: tuple[DAQChannel, ...]#
Frozen snapshot of all configured AI/AO/DI/DO channels (excludes relays).
- property ai_channels: Mapping[str, AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel]#
Frozen snapshot of configured AI channels, keyed by alias.
- property ao_channels: Mapping[str, AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel]#
Frozen snapshot of configured AO channels, keyed by alias.
- property di_channels: Mapping[str, DigitalChannel]#
Frozen snapshot of configured DI channels, keyed by alias.
- property do_channels: Mapping[str, DigitalChannel]#
Frozen snapshot of configured DO channels, keyed by alias.
- property relay_channels: Mapping[str, RelayChannel]#
Frozen snapshot of configured relay channels, keyed by alias.
- property ai_hw_timing_config: HWTimingConfig | None#
- property ao_hw_timing_config: HWTimingConfig | None#
- property di_hw_timing_config: HWTimingConfig | None#
- property do_hw_timing_config: HWTimingConfig | None#
- abstractmethod open()[source]#
Open the underlying transport (or verify the device is present, for handle-less SDKs).
- abstractmethod start(**kwargs)[source]#
Start hardware-timed acquisition.
InstroDAQpasseschannel_type=<ChannelType>when the user targets a specific task (e.g. on NI, where AI/AO/DI/DO each have their own DAQmx task). Drivers without that distinction can ignore it.
- abstractmethod stop(**kwargs)[source]#
Stop a running acquisition and release any scan buffers.
channel_typemirrorsstart().
- abstractmethod configure_ai_voltage_channel(
- channel: AnalogVoltageChannel,
Register an AI voltage channel with the underlying driver.
- configure_ao_voltage_channel(
- channel: AnalogVoltageChannel,
Register an AO voltage channel. Override if the driver supports analog voltage output.
- configure_ai_current_channel(
- channel: AnalogCurrentChannel,
Register an AI current channel. Override if the driver supports analog current input.
- configure_ao_current_channel(
- channel: AnalogCurrentChannel,
Register an AO current channel. Override if the driver supports analog current output.
- configure_ai_thermocouple_channel(
- channel: AnalogThermocoupleChannel,
Register an AI thermocouple channel. Override if the driver supports thermocouple input.
- abstractmethod configure_di_line_channel( )[source]#
Parse, program, and register a DI line channel.
- abstractmethod configure_do_line_channel( )[source]#
Parse, program, and register a DO line channel.
- configure_di_port_channel(
- physical_channel: str,
- logic: Logic,
- port_width: DigitalPortWidth,
- logic_level: float | None = None,
- alias: str | None = None,
Parse, program, and register a DI port channel. Override if the driver supports port-mode digital input.
- configure_do_port_channel(
- physical_channel: str,
- logic: Logic,
- port_width: DigitalPortWidth,
- logic_level: float | None = None,
- alias: str | None = None,
Parse, program, and register a DO port channel. Override if the driver supports port-mode digital output.
- define_relay_channel( ) RelayChannel[source]#
Build a
RelayChannelforphysical_channel(e.g."3101"= slot 3 / channel 101).Default implementation suits the Keysight 34980A’s slot/channel addressing; override if the driver needs different parsing. Overrides must also record the resulting channel on
self._relay_channels.
- configure_ai_channel(
- channel: AnalogChannel,
Deprecated: implement
configure_ai_voltage_channelinstead.
- configure_ao_channel(
- channel: AnalogChannel,
Deprecated: implement
configure_ao_voltage_channelinstead.
- abstractmethod configure_ai_hw_timing(
- hw_timing_config: HWTimingConfig,
Configure hardware-timed AI sampling at
hw_timing_config.sample_rate.Called before
start()wheneverInstroDAQ.configure_ai_hw_sample_rate()is invoked. The driver should program the sample clock and anysamples_per_channelbuffer sizing the underlying SDK requires.
- get_actual_sample_rate() float | None[source]#
Actual hardware sample rate achieved after
start().Default returns
None(driver doesn’t know or hasn’t started). Override on drivers whose SDK reports the effective rate (NI, MCC, LabJack T-series all do).
- abstractmethod read_analog() Any[source]#
Software-timed read of every configured AI channel.
Returns a vendor-specific payload that
_read_to_measurementsthen unpacks intoMeasurement``s. ``response.dtshould beNoneso the wrapper timestamps with wall-clock time.
- abstractmethod fetch_analog() Any[source]#
Block until
samples_per_channelnew AI samples are available, then return them.Drivers should set
self.points_in_bufferfor buffer-depth telemetry and returndt(ns per sample) so the wrapper can build contiguous timestamps viaHWTimestamper.
- abstractmethod read_digital_line(
- channel: DigitalChannel,
Sample a single DI line. Returns 0 or 1 after applying
channel.logic.
- abstractmethod read_digital_port(
- channel: DigitalChannel,
Sample a multi-line DI port. Returns an N-bit integer; bit
ireflects linei.
- write_analog_value(
- channel: AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel,
- value: float,
Write
valueto AOchannel. Override if the driver supports analog output.
- abstractmethod write_digital_line(
- channel: DigitalChannel,
- data: int,
Drive a single DO line.
datais 0 or 1 (active-lowchannel.logicis handled in the driver).
- abstractmethod write_digital_port(
- channel: DigitalChannel,
- data: int,
Drive a multi-line DO port.
datais an N-bit integer; biticontrols linei.
- close_relay(channel: RelayChannel)[source]#
Close the relay (connect the circuit). Override if the driver supports relays.
- open_relay(channel: RelayChannel)[source]#
Open the relay (disconnect the circuit). Override if the driver supports relays.