nitypes

raw JSON →
1.0.1 verified Fri May 01 auth: no python

Data types for NI Python APIs, providing analog, complex, and digital waveforms, frequency spectrums, complex integers, and time conversion. Current stable version is 1.0.1 (latest release). Development releases (1.1.0.dev2) are available. Release cadence is irregular.

pip install nitypes
error AttributeError: module 'nitypes' has no attribute 'AnalogWaveform'
cause Importing the module but not the class; top-level imports require explicit class import.
fix
Use 'from nitypes import AnalogWaveform'
error AttributeError: 'DigitalWaveform' object has no attribute 'unit'
cause The property was renamed from 'unit' to 'units' in nitypes 0.1.0-dev9.
fix
Use 'waveform.units' instead of 'waveform.unit'
error ValueError: signal_index out of range for DigitalWaveform
cause Signal index ordering changed in 1.0.1; existing code may assume different ordering.
fix
Update to nitypes>=1.0.1 and adjust signal index logic as per release notes.
error TypeError: Cannot interpret dtype=complex64 as a complex waveform
cause nitypes expects specific numpy dtypes; complex64 is not supported directly.
fix
Convert data to complex128 using np.complex128 before passing.
breaking In nitypes 1.0.1, the ordering of Digital Waveform Signal Indices was reversed. signal_index now starts from leftmost bit as highest index, opposite to 1.0.0. Code relying on index ordering must be updated.
fix Update to nitypes>=1.0.1 and adjust any logic that assumes signal 0 is the most significant bit.
gotcha nitypes classes like AnalogWaveform and DigitalWaveform are not fully picklable in versions before 1.1.0.dev2. Unpickling may raise errors or produce incorrect data.
fix Upgrade to nitypes>=1.1.0.dev2 to fix pickling issues.
deprecated The `unit` property was renamed to `units` for consistency in version 0.1.0-dev9. Using `unit` will raise AttributeError.
fix Use `.units` instead of `.unit` when accessing unit metadata.
gotcha Type hints may break with numpy >= 2.4.x on nitypes versions before 1.1.0.dev2. Incompatible type stubs cause mypy errors.
fix Upgrade to nitypes>=1.1.0.dev2 to get compatible type hints.
pip install nitypes==1.0.1

Quickstart: import and basic usage of nitypes data types.

from nitypes import AnalogWaveform, DigitalWaveform, Scalar, Vector
import numpy as np

# Create an analog waveform
analog_data = np.array([0.5, 1.2, -0.3], dtype=np.float64)
t0 = 0.0
dt = 0.001
waveform = AnalogWaveform(data=analog_data, t0=t0, dt=dt)
print(waveform)

# Create a digital waveform
digital_data = np.array([0b1010, 0b1100], dtype=np.uint8)
digital_waveform = DigitalWaveform(data=digital_data, t0=t0, dt=dt)
print(digital_waveform)

# Create a scalar and vector
scalar = Scalar(value=5.0)
vector = Vector(data=np.array([1, 2, 3]))
print(scalar, vector)