nitypes.waveform.DigitalWaveform

class nitypes.waveform.DigitalWaveform(sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., dtype: None = ..., default_value: bool | int | nitypes.waveform.DigitalState | None = ..., *, data: None = ..., start_index: SupportsIndex | None = ..., capacity: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., copy_extended_properties: bool = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...)
class DigitalWaveform(sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., dtype: type[nitypes.waveform.typing.TOtherDigitalState] | numpy.dtype[nitypes.waveform.typing.TOtherDigitalState] = ..., default_value: bool | int | nitypes.waveform.DigitalState | None = ..., *, data: None = ..., start_index: SupportsIndex | None = ..., capacity: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., copy_extended_properties: bool = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...)
class DigitalWaveform(sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., dtype: None = ..., default_value: bool | int | nitypes.waveform.DigitalState | None = ..., *, data: numpy.typing.NDArray[nitypes.waveform.typing.TOtherDigitalState] = ..., start_index: SupportsIndex | None = ..., capacity: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., copy_extended_properties: bool = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...)
class DigitalWaveform(sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., dtype: numpy.typing.DTypeLike = ..., default_value: bool | int | nitypes.waveform.DigitalState | None = ..., *, data: numpy.typing.NDArray[Any] | None = ..., start_index: SupportsIndex | None = ..., capacity: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., copy_extended_properties: bool = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...)

Bases: Generic[nitypes.waveform.typing.TDigitalState]

A digital waveform, which encapsulates digital data and timing information.

Constructing

To construct a digital waveform, use the DigitalWaveform class:

>>> DigitalWaveform()
nitypes.waveform.DigitalWaveform(0, 1)
>>> DigitalWaveform(sample_count=5, signal_count=3)
nitypes.waveform.DigitalWaveform(5, 3, data=array([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0],
[0, 0, 0]], dtype=uint8))

When displaying a digital waveform as a string, the first number is the sample count and the second number is the signal count.

To construct a digital waveform from a NumPy array of line data, use the DigitalWaveform.from_lines method. Each array element represents a digital state, such as 1 for “on” or 0 for “off”. The line data should be in a 1D array indexed by sample or a 2D array indexed by (sample, signal). (Note, signal indices are reversed! See “Signal index vs. column index” below for details.) The digital waveform displays the line data as a 2D array.

>>> import numpy as np
>>> DigitalWaveform.from_lines(np.array([0, 1, 0], np.uint8))
nitypes.waveform.DigitalWaveform(3, 1, data=array([[0], [1], [0]], dtype=uint8))
>>> DigitalWaveform.from_lines(np.array([[0, 0], [1, 0], [0, 1], [1, 1]], np.uint8))
nitypes.waveform.DigitalWaveform(4, 2, data=array([[0, 0], [1, 0], [0, 1], [1, 1]], dtype=uint8))

You can also use DigitalWaveform.from_lines to construct a digital waveform from a sequence, such as a list.

>>> DigitalWaveform.from_lines([[0, 0], [1, 0], [0, 1], [1, 1]])
nitypes.waveform.DigitalWaveform(4, 2, data=array([[0, 0], [1, 0], [0, 1], [1, 1]], dtype=uint8))

To construct a digital waveform from a NumPy array of port data, use the DigitalWaveform.from_port method. Each element of the port data array represents a digital sample taken over a port of signals. Each bit in the sample is a signal value, either 1 for “on” or 0 for “off”. (Note, signal indices are reversed! See “Signal index vs. column index” below for details.)

>>> DigitalWaveform.from_port(np.array([0, 1, 2, 3], np.uint8))
nitypes.waveform.DigitalWaveform(4, 8, data=array([[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1]], dtype=uint8))

You can use a mask to specify which lines in the port to include in the waveform.

>>> DigitalWaveform.from_port(np.array([0, 1, 2, 3], np.uint8), 0x3)
nitypes.waveform.DigitalWaveform(4, 2, data=array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=uint8))

You can also use a non-NumPy sequence such as a list, but you must specify a mask so the waveform knows how many bits are in each list element.

>>> DigitalWaveform.from_port([0, 1, 2, 3], 0x3)
nitypes.waveform.DigitalWaveform(4, 2, data=array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=uint8))

The 2D version, DigitalWaveform.from_ports, returns multiple waveforms, one for each row of data in the array or nested sequence.

>>> nested_list = [[0, 1, 2, 3], [3, 0, 3, 0]]
>>> DigitalWaveform.from_ports(nested_list, [0x3, 0x3])
[nitypes.waveform.DigitalWaveform(4, 2, data=array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=uint8)),
nitypes.waveform.DigitalWaveform(4, 2, data=array([[1, 1], [0, 0], [1, 1], [0, 0]], dtype=uint8))]

Digital signals

You can access individual signals using the DigitalWaveform.signals property.

>>> wfm = DigitalWaveform.from_port([0, 1, 2, 3], 0x3)
>>> wfm.signals[0]
nitypes.waveform.DigitalWaveformSignal(data=array([0, 1, 0, 1], dtype=uint8))
>>> wfm.signals[1]
nitypes.waveform.DigitalWaveformSignal(data=array([0, 0, 1, 1], dtype=uint8))

The DigitalWaveformSignal.data property returns a view of the data for that signal.

>>> wfm.signals[0].data
array([0, 1, 0, 1], dtype=uint8)

Signal index vs. column index

Each DigitalWaveformSignal has two index properties:

  • DigitalWaveformSignal.signal_index - The position in the DigitalWaveform.signals collection (0-based from the first signal). signal_index 0 is the rightmost column in the data.

  • DigitalWaveformSignal.column_index - The column in the DigitalWaveform.data array, e.g. waveform.data[:, column_index]. column_index 0 is the leftmost column in the data.

These indices are reversed with respect to each other. signal_index 0 (line 0) corresponds to the highest column_index, and the highest signal_index (the highest line) corresponds to column_index 0. This ordering follows industry conventions where line 0 is the least significant bit and appears last (in the rightmost column) of the data array.

>>> wfm = DigitalWaveform.from_port([0, 1, 2, 3], 0x7)  # 3 signals
>>> wfm.data
array([[0, 0, 0],
       [0, 0, 1],
       [0, 1, 0],
       [0, 1, 1]], dtype=uint8)
>>> wfm.signals[0].signal_index
0
>>> wfm.signals[0].column_index
2
>>> wfm.signals[0].data
array([0, 1, 0, 1], dtype=uint8)
>>> wfm.signals[2].signal_index
2
>>> wfm.signals[2].column_index
0
>>> wfm.signals[2].data
array([0, 0, 0, 0], dtype=uint8)

Digital signal names

The DigitalWaveformSignal.name property allows you to get and set the signal names.

>>> wfm.signals[0].name = "port0/line0"
>>> wfm.signals[1].name = "port0/line1"
>>> wfm.signals[2].name = "port0/line2"
>>> wfm.signals[0].name
'port0/line0'
>>> wfm.signals[0]
nitypes.waveform.DigitalWaveformSignal(name='port0/line0', data=array([0, 1, 0, 1], dtype=uint8))

The signal names are stored in the NI_LineNames extended property on the digital waveform. Note that the order of the names in the string follows column_index order (highest line number first), which is reversed compared to signal_index order (lowest line first). This means line 0 (signal_index 0) appears last in the NI_LineNames string. This matches industry conventions where line 0 appears in the rightmost column of the data array.

>>> wfm.extended_properties["NI_LineNames"]
'port0/line2, port0/line1, port0/line0'

When creating a digital waveform, you can directly set the NI_LineNames extended property.

>>> wfm = DigitalWaveform.from_port([2, 4], 0x7,
... extended_properties={"NI_LineNames": "Dev1/port1/line6, Dev1/port1/line5, Dev1/port1/line4"})
>>> wfm.signals[0]
nitypes.waveform.DigitalWaveformSignal(name='Dev1/port1/line4', data=array([0, 0], dtype=uint8))
>>> wfm.signals[1]
nitypes.waveform.DigitalWaveformSignal(name='Dev1/port1/line5', data=array([1, 0], dtype=uint8))
>>> wfm.signals[2]
nitypes.waveform.DigitalWaveformSignal(name='Dev1/port1/line6', data=array([0, 1], dtype=uint8))

Digital state types

By default, digital waveforms use a NumPy dtype of numpy.uint8, which uses a byte of memory for each digital state.

Using np.uint8 allows the waveform to contain digital states other than “on” or off”, such as such as DigitalState.FORCE_OFF (X) or DigitalState.COMPARE_HIGH (H). This capability is used for digital pattern applications.

You can also construct a digital waveform using a NumPy dtype of numpy.bool. This also uses a byte of memory for each digital state, but it restricts the states to “on” and “off”.

Testing digital waveforms

You can use DigitalWaveform.test() to compare an acquired waveform against an expected waveform. This returns a DigitalWaveformTestResult object, which has a Boolean success property and a failures property containing a collection of DigitalWaveformFailure objects, which indicate the location of each test failure.

Here is an example. The expected waveform counts in binary using COMPARE_LOW (L) and COMPARE_HIGH (H), but signal 0 of the actual waveform is stuck high.

>>> actual = DigitalWaveform.from_lines([[0, 1], [1, 1], [0, 1], [1, 1]])
>>> expected = DigitalWaveform.from_lines([[DigitalState.COMPARE_LOW, DigitalState.COMPARE_LOW],
... [DigitalState.COMPARE_HIGH, DigitalState.COMPARE_LOW],
... [DigitalState.COMPARE_LOW, DigitalState.COMPARE_HIGH],
... [DigitalState.COMPARE_HIGH, DigitalState.COMPARE_HIGH]])
>>> result = actual.test(expected)
>>> result.success
False
>>> len(result.failures)
2

The failures indicate the sample indices into the actual and expected waveforms, the signal index, and the digital state from the actual and expected waveforms:

>>> result.failures[0]
DigitalWaveformFailure(sample_index=0, expected_sample_index=0, signal_index=0, column_index=1,
actual_state=<DigitalState.FORCE_UP: 1>, expected_state=<DigitalState.COMPARE_LOW: 3>)
>>> result.failures[1]
DigitalWaveformFailure(sample_index=1, expected_sample_index=1, signal_index=0, column_index=1,
actual_state=<DigitalState.FORCE_UP: 1>, expected_state=<DigitalState.COMPARE_LOW: 3>)

Timing information

Digital waveforms have the same timing information as analog waveforms.

Class members

classmethod from_lines(array: numpy.typing.NDArray[nitypes.waveform.typing.TOtherDigitalState], dtype: None = ..., *, copy: bool = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) DigitalWaveform[nitypes.waveform.typing.TOtherDigitalState]
classmethod from_lines(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], dtype: type[nitypes.waveform.typing.TOtherDigitalState] | numpy.dtype[nitypes.waveform.typing.TOtherDigitalState], *, copy: bool = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) DigitalWaveform[nitypes.waveform.typing.TOtherDigitalState]
classmethod from_lines(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], dtype: numpy.typing.DTypeLike = ..., *, copy: bool = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., signal_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) DigitalWaveform[Any]

Construct a waveform from a one or two-dimensional array or sequence of line data.

Each element of the line data array represents a digital state, such as 1 for “on” or 0 for “off”. The line data should be in a 1D array indexed by sample or a 2D array indexed by (sample, signal). The line data may also use digital state values from the DigitalState enum.

Note that signal indices are reversed with respect to this array’s column indices. The first column in each sample corresponds to the highest line number and highest signal index. The last column in each sample corresponds to line 0 and signal index 0.

Parameters:
  • array – The line data as a one or two-dimensional array or a sequence.

  • dtype – The NumPy data type for the waveform data.

  • copy – Specifies whether to copy the array or save a reference to it.

  • start_index – The sample index at which the waveform data begins.

  • sample_count – The number of samples in the waveform.

  • signal_count – The number of signals in the waveform.

  • extended_properties – The extended properties of the waveform.

  • timing – The timing information of the waveform.

Returns:

A waveform containing the specified data.

classmethod from_port(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], mask: SupportsIndex | None = ..., dtype: None = ..., *, bitorder: Literal['big', 'little'] = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) DigitalWaveform[numpy.uint8]
classmethod from_port(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], mask: SupportsIndex | None = ..., dtype: type[nitypes.waveform.typing.TOtherDigitalState] | numpy.dtype[nitypes.waveform.typing.TOtherDigitalState] = ..., *, bitorder: Literal['big', 'little'] = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) DigitalWaveform[nitypes.waveform.typing.TOtherDigitalState]
classmethod from_port(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], mask: SupportsIndex | None = ..., dtype: numpy.typing.DTypeLike = ..., *, bitorder: Literal['big', 'little'] = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) DigitalWaveform[Any]

Construct a waveform from a one-dimensional array or sequence of port data.

This method allocates a new array in order to convert the port data (integers) to line data (bits).

Each element of the port data array represents a digital sample taken over a port of signals. Each bit in the sample represents a digital state, either 1 for “on” or 0 for “off”.

When bitorder=’big’ (default), the integers in the samples are big-endian. The most significant bit of each integer will be placed in the first column of the data array (corresponding to the highest line number and highest signal index). The least significant bit will be placed in the last column of the data array (corresponding to line 0 and signal index 0).

When bitorder=’little’, the integers in the samples are little-endian. The least significant bit of each integer will be placed in the first column of the data array (corresponding to the highest line number and highest signal index). The most significant bit will be placed in the last column of the data array (corresponding to line 0 and signal index 0).

If the input array is not a NumPy array, you must specify the mask.

Parameters:
  • array – The port data as a one-dimensional array or a sequence.

  • mask – A bitmask specifying which lines to include in the waveform.

  • dtype – The NumPy data type for the waveform (line) data.

  • bitorder – The bit ordering to use when unpacking port data (‘big’ or ‘little’). Defaults to ‘big’.

  • start_index – The sample index at which the waveform data begins.

  • sample_count – The number of samples in the waveform.

  • extended_properties – The extended properties of the waveform.

  • timing – The timing information of the waveform.

Returns:

A waveform containing the specified data.

classmethod from_ports(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], masks: collections.abc.Sequence[SupportsIndex] | None = ..., dtype: None = ..., *, bitorder: Literal['big', 'little'] = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) collections.abc.Sequence[DigitalWaveform[numpy.uint8]]
classmethod from_ports(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], masks: collections.abc.Sequence[SupportsIndex] | None = ..., dtype: type[nitypes.waveform.typing.TOtherDigitalState] | numpy.dtype[nitypes.waveform.typing.TOtherDigitalState] = ..., *, bitorder: Literal['big', 'little'] = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) collections.abc.Sequence[DigitalWaveform[nitypes.waveform.typing.TOtherDigitalState]]
classmethod from_ports(array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], masks: collections.abc.Sequence[SupportsIndex] | None = ..., dtype: numpy.typing.DTypeLike = ..., *, bitorder: Literal['big', 'little'] = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta] | None = ...) collections.abc.Sequence[DigitalWaveform[Any]]

Construct a waveform from a two-dimensional array or sequence of port data.

This method allocates a new array in order to convert the port data to line data.

Each row of the port data array corresponds to a resulting DigitalWaveform. Each element of the port data array represents a digital sample taken over a port of signals. Each bit in the sample represents a digital state, either 1 for “on” or 0 for “off”.

When bitorder=’big’ (default), the integers in the samples are big-endian. The most significant bit of each integer will be placed in the first column of the data array (corresponding to the highest line number and highest signal index). The least significant bit will be placed in the last column of the data array (corresponding to line 0 and signal index 0).

When bitorder=’little’, the integers in the samples are little-endian. The least significant bit of each integer will be placed in the first column of the data array (corresponding to the highest line number and highest signal index). The most significant bit will be placed in the last column of the data array (corresponding to line 0 and signal index 0).

If the input array is not a NumPy array, you must specify the masks.

Parameters:
  • array – The port data as a two-dimensional array or a sequence.

  • masks – A sequence of bitmasks specifying which lines from each port to include in the corresponding waveform.

  • dtype – The NumPy data type for the waveform (line) data.

  • bitorder – The bit ordering to use when unpacking port data (‘big’ or ‘little’). Defaults to ‘big’.

  • start_index – The sample index at which the waveform data begins.

  • sample_count – The number of samples in the waveform.

  • extended_properties – The extended properties of the waveform.

  • timing – The timing information of the waveform.

Returns:

A waveform containing the specified data.

__slots__ = ['_data', '_data_1d', '_start_index', '_sample_count', '_extended_properties', '_timing',...
property signals: nitypes.waveform.DigitalWaveformSignalCollection[nitypes.waveform.typing.TDigitalState]

A collection of objects representing waveform signals.

property data: numpy.typing.NDArray[nitypes.waveform.typing.TDigitalState]

The waveform data, indexed by (sample, signal).

get_data(start_index: SupportsIndex | None = 0, sample_count: SupportsIndex | None = None) numpy.typing.NDArray[nitypes.waveform.typing.TDigitalState]

Get a subset of the waveform data.

Parameters:
  • start_index – The sample index at which the data begins.

  • sample_count – The number of samples to return.

Returns:

A subset of the raw waveform data.

property sample_count: int

The number of samples in the waveform.

property signal_count: int

The number of signals in the waveform.

property start_index: int

The sample index of the underlying array at which the waveform data begins.

property capacity: int

The total capacity available for waveform data.

Setting the capacity resizes the underlying NumPy array in-place.

  • Other Python objects with references to the array will see the array size change.

  • If the array has a reference to an external buffer (such as an array.array), attempting to resize it raises ValueError.

property dtype: numpy.dtype[nitypes.waveform.typing.TDigitalState]

The NumPy dtype for the waveform data.

property extended_properties: nitypes.waveform.ExtendedPropertyDictionary

The extended properties for the waveform.

property channel_name: str

The name of the device channel from which the waveform was acquired.

property timing: nitypes.waveform.Timing[nitypes.time.typing.AnyDateTime, nitypes.time.typing.AnyTimeDelta, nitypes.time.typing.AnyTimeDelta]

The timing information of the waveform.

The default value is Timing.empty.

append(other: numpy.typing.NDArray[nitypes.waveform.typing.TDigitalState] | DigitalWaveform[nitypes.waveform.typing.TDigitalState] | collections.abc.Sequence[DigitalWaveform[nitypes.waveform.typing.TDigitalState]], /, timestamps: collections.abc.Sequence[datetime.datetime] | collections.abc.Sequence[hightime.datetime] | None = None) None

Append data to the waveform.

Parameters:
  • other – The array or waveform(s) to append.

  • timestamps – A sequence of timestamps. When the current waveform has SampleIntervalMode.IRREGULAR, you must provide a sequence of timestamps with the same length as the array.

Raises:
  • TimingMismatchError – The current and other waveforms have incompatible timing.

  • TimingMismatchWarning – The sample intervals of the waveform(s) do not match.

  • ValueError – The other array has the wrong number of dimensions or the length of the timestamps argument does not match the length of the other array.

  • TypeError – The data types of the current waveform and other array or waveform(s) do not match, or an argument has the wrong data type.

When appending waveforms:

  • Timing information is merged based on the sample interval mode of the current waveform:

    • SampleIntervalMode.NONE or SampleIntervalMode.REGULAR: The other waveform(s) must also have SampleIntervalMode.NONE or SampleIntervalMode.REGULAR. If the sample interval does not match, a TimingMismatchWarning is generated. Otherwise, the timing information of the other waveform(s) is discarded.

    • SampleIntervalMode.IRREGULAR: The other waveforms(s) must also have SampleIntervalMode.IRREGULAR. The timestamps of the other waveforms(s) are appended to the current waveform’s timing information.

  • Extended properties of the other waveform(s) are merged into the current waveform if they are not already set in the current waveform.

load_data(array: numpy.typing.NDArray[nitypes.waveform.typing.TDigitalState], *, copy: bool = True, start_index: SupportsIndex | None = 0, sample_count: SupportsIndex | None = None) None

Load new data into an existing waveform.

Parameters:
  • array – A NumPy array containing the data to load.

  • copy – Specifies whether to copy the array or save a reference to it.

  • start_index – The sample index at which the waveform data begins.

  • sample_count – The number of samples in the waveform.

test(expected_waveform: DigitalWaveform[nitypes.waveform.typing.TDigitalState], *, start_sample: SupportsIndex | None = 0, expected_start_sample: SupportsIndex | None = 0, sample_count: SupportsIndex | None = None) DigitalWaveformTestResult

Test the digital waveform against an expected digital waveform.

Parameters:
  • expected_waveform – The expected digital waveform to compare against.

  • start_sample – The beginning sample of self to compare.

  • expected_start_sample – The beginning sample of expected_waveform to compare.

  • sample_count – The number of samples to compare.

Returns:

The test result.

__eq__(value: object, /) bool

Return self==value.

__reduce__() tuple[Any, Ellipsis]

Return object state for pickling.

__repr__() str

Return repr(self).