Cards#
Card module.
Contains the BaseCardProxy and AO/DOCardProxy classes
representing individual cards.
- class nistreamer.card.BaseCardProxy(_streamer, max_name, nickname=None)[source]#
Bases:
objectThe base of card proxy classes.
Exposes hardware settings and device-wide control.
- property nickname: str#
Human-readable card name used in visualizations.
Nickname is set when card is added to the streamer. If no nickname was specified, card MAX name is used instead.
- property samp_rate: float#
Sampling rate (in Hz).
- property start_trig_in: str | None#
Start trigger input.
- Format:
term: str- card awaits for an external start trigger at terminalterm;None- card does not use external start trigger.
- property start_trig_out: str | None#
Start trigger output.
If configured, the card will emit a pulse every time it starts running. This signal can be used by other cards to start-sync.
- Format:
term: str- emit signal at terminalterm;None- no export.
- property samp_clk_in: str | None#
Sample clock input.
- Format:
term: str- card uses external sample clock from terminalterm;None- card uses internal on-board sample clock instead.
- property samp_clk_out: str | None#
Sample clock output.
- Format:
term: str- card exports sample clock to terminalterm;None- no export.
- property ref_clk_in: str | None#
10 MHz reference clock input.
- Format:
term: str- on-board clock locks to the reference signal from terminalterm;None- on-board clock is free-running.
See also
Use
ref_clk_provider()to specify which card provides the reference signal for others.
- property min_bufwrite_timeout: float | None#
Minimal buffer write timeout (in seconds).
The main purpose - deadlock prevention when hardware sync fails and some cards either never start or get stuck midway (typically, due to incorrect / missing start trigger or external sample clock). Streamer will stop and return a
RuntimeErrorif timeout elapses.- Format:
val: f64- finite, wait time of at leastvalseconds;None- no timeout, wait indefinitely.
The default is 5 seconds. A larger value can be set to allow a longer wait for an external signal or if external sample clock “freezing” is used to “pause” generation for periods of time.
- class nistreamer.card.AOCardProxy(_streamer, max_name, nickname=None)[source]#
Bases:
BaseCardProxy- add_chan(chan_idx, dflt_val=0.0, rst_val=0.0, nickname=None, proxy_class=<class 'nistreamer.channel.AOChanProxy'>)[source]#
Add an output channel.
- Parameters:
chan_idx (
int) – hardware channel index (as shown in NI MAX)dflt_val (
float) – the default value for intervals that are not covered by instructionsrst_val (
float) – the value set byadd_reset_instr()commandnickname (
str) – human-readable name used for visualizationsproxy_class (
Optional[Type[AOChanProxy]]) – custom subclass ofAOChanProxyto use.
- Returns:
Channel proxy instance
- Raises:
KeyError – if this hardware channel has been added already
- class nistreamer.card.DOCardProxy(_streamer, max_name, nickname=None)[source]#
Bases:
BaseCardProxy- add_chan(port_idx, line_idx, dflt_val=False, rst_val=False, nickname=None, proxy_class=<class 'nistreamer.channel.DOChanProxy'>)[source]#
Add an output channel.
- Parameters:
port_idx (
int) – digital port index (as shown in NI MAX)line_idx (
int) – digital line index within the port (as shown in NI MAX)dflt_val (
bool) – the default value for intervals that are not covered by instructionsrst_val (
bool) – the value set byadd_reset_instr()commandnickname (
str) – human-readable name used for visualizationsproxy_class (
Optional[Type[DOChanProxy]]) – custom subclass ofDOChanProxyto use.
- Returns:
Channel proxy instance
- Raises:
KeyError – if this hardware channel has been added already
- property const_fns_only: bool#
Shows whether the “constant functions only” mode is enabled.
If enabled, all lines on this card will only accept the following constant-valued instructions:
high,low,go_high, andgo_low. This restriction allows to accelerate the runtime sample computation and significantly reduce the risk of buffer underflow.In most cases, only constant-valued instructions are used anyway, so this mode is enabled by default. You only need to disable it if you want to use non-constant boolean waveform functions.