Utils#
Miscellaneous helper tools.
- nistreamer.utils.connect_terms(src, dest)[source]#
Create a static connection between terminals.
Hint: you can find the list of available terminals and signals as well as permitted routes for each card using NI MAX app. Click the specific card entry in the device tree on the left, then hit the “Device Routes” tab on the bottom of the window.
CAUTION! Static conntections are independent of any NI tasks and will persist until explicily undone, involved cards are reset, or the full system is power-cycled. If left behind, such static connections can lead to physical line double-driving, very confusing sync issues, and even hardware damage.
- Parameters:
src (
str) – full source terminal or signal namedest (
str) – full destination terminal name
- Raises:
ValueError – if any terminal name is invalid or if the connection cannot be established.
Examples
>>> connect_terms(src='/Dev1/PFI0', dest='/Dev1/PXI_Trig0') >>> connect_terms(src='/Dev2/10MHzRefClock', dest='/Dev2/PFI0')
See also
Use
disconnect_terms()orreset_dev()to undo static connections.
- nistreamer.utils.disconnect_terms(src, dest)[source]#
Undo static connection.
- Parameters:
src (
str) – full source terminal or signal namedest (
str) – full destination terminal name
- Raises:
ValueError – if any terminal name is invalid.
Statically export 10 MHz reference clock signal.
CAUTION! Static conntections are independent of any NI tasks and will persist until explicily undone, involved cards are reset, or the full system is power-cycled. If left behind, such static connections can lead to physical line double-driving, very confusing sync issues, and even hardware damage.
- Parameters:
dev (
str) – device nameterm (
str) – terminal name
- Raises:
ValueError – if parameters are invalid
Examples
>>> share_10mhz_ref(dev='Dev1', term='PFI0')
See also
Consider using a safer way of 10 MHz reference export by setting
ref_clk_provider()property. This will automatically undo export when run is finished.If still choosing manual approach, use
unshare_10mhz_ref()orreset_dev()to undo this export afterwards.
Undo static export of 10 MHz reference clock signal.
- Parameters:
dev (
str) – device nameterm (
str) – terminal name
- Raises:
ValueError – if parameters are invalid
- nistreamer.utils.reset_dev(name)[source]#
Perform hardware reset.
- Parameters:
name (
str) – device name as shown in NI MAX
- class nistreamer.utils.RendOption[source]#
Enum-like collection of select Plotly renderer options.
See Plotly docs for the full list of available renderers.
- browser = 'browser'#
- notebook = 'notebook'#
- svg = 'svg'#
- png = 'png'#
- jpeg = 'jpeg'#
- nistreamer.utils.iplot(chan_list, start_time=None, end_time=None, nsamps=1000, renderer='browser', row_height=None)[source]#
Plot signals for a list of channels.
Values are computed for a grid of
nsampstime points uniformly distributed over the closed interval[start_time, end_time]. Note that sequence has to be freshly compiled to plot.- Parameters:
chan_list – list of channel proxy instances to plot (trace order will follow the list order)
start_time (
Optional[float]) – window start time. IfNone, zero time is usedend_time (
Optional[float]) – window end time. IfNone, compiled sequence end time is usednsamps (
Optional[int]) – number of time points to evaluate for each channelrenderer (
Optional[str]) – Plotly renderer to use. A few options are collected inRendOptionrow_height (
Optional[float]) – channel sub-plot height
- Raises:
ImportError – if
plotlyis not installedValueError – if sequence is not freshly compiled or any parameters are invalid
Notes
You may need to select a sufficiently large
nsampsand a sufficiently narrow time window to see the true waveform shape that the actual stream would produce when sampling at the hardware clock rate. Otherwise, very narrow pulses may be missed and periodic waveforms may appear distorted due to undersampling.