# DAQDriverBase

## class DAQDriverBase[source]

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC "(in Python v3.15)")

Vendor 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 call
`super().__init__()` and then populate those privates inside their own
`configure_*` methods (`self._ai_channels[channel.alias] = channel`,
`self._ai_hw_timing_config = hw_timing_config`, etc.). Read-only
`@property` accessors hand back frozen snapshots so the state can’t be
mutated from outside the `configure_*` path; `InstroDAQ` exposes the
same snapshots for user introspection — it does not keep its own copies.

Attributes

| [`ai_channels`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.ai_channels "instro.daq.DAQDriverBase.ai_channels") | Frozen snapshot of configured AI channels, keyed by alias. |
| --- | --- |
| [`ai_hw_timing_config`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.ai_hw_timing_config "instro.daq.DAQDriverBase.ai_hw_timing_config") |  |
| [`ao_channels`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.ao_channels "instro.daq.DAQDriverBase.ao_channels") | Frozen snapshot of configured AO channels, keyed by alias. |
| [`ao_hw_timing_config`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.ao_hw_timing_config "instro.daq.DAQDriverBase.ao_hw_timing_config") |  |
| [`channels`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.channels "instro.daq.DAQDriverBase.channels") | Frozen snapshot of all configured AI/AO/DI/DO channels (excludes relays). |
| [`di_channels`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.di_channels "instro.daq.DAQDriverBase.di_channels") | Frozen snapshot of configured DI channels, keyed by alias. |
| [`di_hw_timing_config`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.di_hw_timing_config "instro.daq.DAQDriverBase.di_hw_timing_config") |  |
| [`do_channels`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.do_channels "instro.daq.DAQDriverBase.do_channels") | Frozen snapshot of configured DO channels, keyed by alias. |
| [`do_hw_timing_config`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.do_hw_timing_config "instro.daq.DAQDriverBase.do_hw_timing_config") |  |
| [`relay_channels`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.relay_channels "instro.daq.DAQDriverBase.relay_channels") | Frozen snapshot of configured relay channels, keyed by alias. |
| [`points_in_buffer`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.points_in_buffer "instro.daq.DAQDriverBase.points_in_buffer") |  |

Methods

| [`close`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.close "instro.daq.DAQDriverBase.close") | Close every task/handle owned by the driver. |
| --- | --- |
| [`close_relay`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.close_relay "instro.daq.DAQDriverBase.close_relay") | Close the relay (connect the circuit). |
| [`configure_ai_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ai_channel "instro.daq.DAQDriverBase.configure_ai_channel") | Deprecated: implement `configure_ai_voltage_channel` instead. |
| [`configure_ai_current_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ai_current_channel "instro.daq.DAQDriverBase.configure_ai_current_channel") | Register an AI current channel. |
| [`configure_ai_hw_timing`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ai_hw_timing "instro.daq.DAQDriverBase.configure_ai_hw_timing") | Configure hardware-timed AI sampling at `hw_timing_config.sample_rate`. |
| [`configure_ai_thermocouple_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ai_thermocouple_channel "instro.daq.DAQDriverBase.configure_ai_thermocouple_channel") | Register an AI thermocouple channel. |
| [`configure_ai_voltage_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ai_voltage_channel "instro.daq.DAQDriverBase.configure_ai_voltage_channel") | Register an AI voltage channel with the underlying driver. |
| [`configure_ao_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ao_channel "instro.daq.DAQDriverBase.configure_ao_channel") | Deprecated: implement `configure_ao_voltage_channel` instead. |
| [`configure_ao_current_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ao_current_channel "instro.daq.DAQDriverBase.configure_ao_current_channel") | Register an AO current channel. |
| [`configure_ao_voltage_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_ao_voltage_channel "instro.daq.DAQDriverBase.configure_ao_voltage_channel") | Register an AO voltage channel. |
| [`configure_di_line_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_di_line_channel "instro.daq.DAQDriverBase.configure_di_line_channel") | Parse, program, and register a DI line channel. |
| [`configure_di_port_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_di_port_channel "instro.daq.DAQDriverBase.configure_di_port_channel") | Parse, program, and register a DI port channel. |
| [`configure_do_line_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_do_line_channel "instro.daq.DAQDriverBase.configure_do_line_channel") | Parse, program, and register a DO line channel. |
| [`configure_do_port_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.configure_do_port_channel "instro.daq.DAQDriverBase.configure_do_port_channel") | Parse, program, and register a DO port channel. |
| [`define_relay_channel`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.define_relay_channel "instro.daq.DAQDriverBase.define_relay_channel") | Build a `RelayChannel` for `physical_channel` (e.g. `"3101"` = slot 3 / channel 101). |
| [`fetch_analog`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.fetch_analog "instro.daq.DAQDriverBase.fetch_analog") | Block until `samples_per_channel` new AI samples are available, then return them. |
| [`get_actual_sample_rate`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.get_actual_sample_rate "instro.daq.DAQDriverBase.get_actual_sample_rate") | Actual hardware sample rate achieved after `start()`. |
| [`open`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.open "instro.daq.DAQDriverBase.open") | Open the underlying transport (or verify the device is present, for handle-less SDKs). |
| [`open_relay`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.open_relay "instro.daq.DAQDriverBase.open_relay") | Open the relay (disconnect the circuit). |
| [`read_analog`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.read_analog "instro.daq.DAQDriverBase.read_analog") | Software-timed read of every configured AI channel. |
| [`read_digital_line`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.read_digital_line "instro.daq.DAQDriverBase.read_digital_line") | Sample a single DI line. |
| [`read_digital_port`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.read_digital_port "instro.daq.DAQDriverBase.read_digital_port") | Sample a multi-line DI port. |
| [`start`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.start "instro.daq.DAQDriverBase.start") | Start hardware-timed acquisition. |
| [`stop`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.stop "instro.daq.DAQDriverBase.stop") | Stop a running acquisition and release any scan buffers. |
| [`write_analog_value`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.write_analog_value "instro.daq.DAQDriverBase.write_analog_value") | Write `value` to AO `channel`. |
| [`write_digital_line`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.write_digital_line "instro.daq.DAQDriverBase.write_digital_line") | Drive a single DO line. |
| [`write_digital_port`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.write_digital_port "instro.daq.DAQDriverBase.write_digital_port") | Drive a multi-line DO port. |

### points_in_buffer: int

### 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 close()[source]

Close every task/handle owned by the driver. Idempotent.

### abstractmethod start(**kwargs)[source]

Start hardware-timed acquisition.

`InstroDAQ` passes `channel_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_type` mirrors [`start()`](https://dev.nominal.io/instro/ref/instruments/instro.daq.DAQDriverBase.md#instro.daq.DAQDriverBase.start "instro.daq.DAQDriverBase.start").

### abstractmethod configure_ai_voltage_channel( channel: AnalogVoltageChannel, )[source]

Register an AI voltage channel with the underlying driver.

### configure_ao_voltage_channel( channel: AnalogVoltageChannel, )[source]

Register an AO voltage channel. Override if the driver supports analog voltage output.

### configure_ai_current_channel( channel: AnalogCurrentChannel, )[source]

Register an AI current channel. Override if the driver supports analog current input.

### configure_ao_current_channel( channel: AnalogCurrentChannel, )[source]

Register an AO current channel. Override if the driver supports analog current output.

### configure_ai_thermocouple_channel( channel: AnalogThermocoupleChannel, )[source]

Register an AI thermocouple channel. Override if the driver supports thermocouple input.

### abstractmethod configure_di_line_channel( physical_channel: str, logic: Logic, logic_level: float | None = None, alias: str | None = None, )[source]

Parse, program, and register a DI line channel.

### abstractmethod configure_do_line_channel( physical_channel: str, logic: Logic, logic_level: float | None = None, alias: str | None = None, )[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, )[source]

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, )[source]

Parse, program, and register a DO port channel. Override if the driver supports port-mode digital output.

### define_relay_channel( physical_channel: str, alias: str | None = None, ) → RelayChannel[source]

Build a `RelayChannel` for `physical_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, )[source]

Deprecated: implement `configure_ai_voltage_channel` instead.

### configure_ao_channel( channel: AnalogChannel, )[source]

Deprecated: implement `configure_ao_voltage_channel` instead.

### abstractmethod configure_ai_hw_timing( hw_timing_config: HWTimingConfig, )[source]

Configure hardware-timed AI sampling at `hw_timing_config.sample_rate`.

Called before `start()` whenever `InstroDAQ.configure_ai_hw_sample_rate()`
is invoked. The driver should program the sample clock and any
`samples_per_channel` buffer 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_measurements` then
unpacks into ``` Measurement``s. ``response.dt ``` should be `None` so
the wrapper timestamps with wall-clock time.

### abstractmethod fetch_analog() → Any[source]

Block until `samples_per_channel` new AI samples are available, then return them.

Drivers should set `self.points_in_buffer` for buffer-depth
telemetry and return `dt` (ns per sample) so the wrapper can
build contiguous timestamps via `HWTimestamper`.

### abstractmethod read_digital_line( channel: DigitalChannel, ) → int[source]

Sample a single DI line. Returns 0 or 1 after applying `channel.logic`.

### abstractmethod read_digital_port( channel: DigitalChannel, ) → int[source]

Sample a multi-line DI port. Returns an N-bit integer; bit `i` reflects line `i`.

### write_analog_value( channel: AnalogChannel | AnalogVoltageChannel | AnalogCurrentChannel | AnalogThermocoupleChannel, value: float, )[source]

Write `value` to AO `channel`. Override if the driver supports analog output.

### abstractmethod write_digital_line( channel: DigitalChannel, data: int, )[source]

Drive a single DO line. `data` is 0 or 1 (active-low `channel.logic` is handled in the driver).

### abstractmethod write_digital_port( channel: DigitalChannel, data: int, )[source]

Drive a multi-line DO port. `data` is an N-bit integer; bit `i` controls line `i`.

### 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.
