Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ All notable changes to this project will be documented in this file.
* [862: docs tox env fails on rdss-nidaqmxbot-win-10-py32](https://github.com/ni/nidaqmx-python/issues/862)

* ### Major Changes
* (IN PROGRESS behind "WAVEFORM_SUPPORT" feature toggle) Added support for reading and writing Waveform data through gRPC using [NI gRPC Device Server](https://github.com/ni/grpc-device).
* Added support for reading and writing Waveform data, including through gRPC using [NI gRPC Device Server](https://github.com/ni/grpc-device).
* Add support for calculated power channels
* Add support for A and C-type Thermocouples

Expand Down
10 changes: 3 additions & 7 deletions examples/analog_in/voltage_acq_int_clk_plot_wfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
Run 'pip install matplotlib' to install the matplotlib module.
"""

import os
import matplotlib.pyplot as plot

os.environ["NIDAQMX_ENABLE_WAVEFORM_SUPPORT"] = "1"

import matplotlib.pyplot as plot # noqa: E402 # Must import after setting environment variable

import nidaqmx # noqa: E402
from nidaqmx.constants import READ_ALL_AVAILABLE, AcquisitionType # noqa: E402
import nidaqmx
from nidaqmx.constants import READ_ALL_AVAILABLE, AcquisitionType

with nidaqmx.Task() as task:
task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
Expand Down
8 changes: 2 additions & 6 deletions examples/analog_in/voltage_acq_int_clk_wfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
of data using the DAQ device's internal clock.
"""

import os

os.environ["NIDAQMX_ENABLE_WAVEFORM_SUPPORT"] = "1"

import nidaqmx # noqa: E402 # Must import after setting environment variable
from nidaqmx.constants import AcquisitionType # noqa: E402
import nidaqmx
from nidaqmx.constants import AcquisitionType

with nidaqmx.Task() as task:
task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
Expand Down
10 changes: 3 additions & 7 deletions examples/analog_out/gen_voltage_wfm_int_clk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
sample clock.
"""

import os
from nitypes.waveform import AnalogWaveform

os.environ["NIDAQMX_ENABLE_WAVEFORM_SUPPORT"] = "1"

from nitypes.waveform import AnalogWaveform # noqa: E402

import nidaqmx # noqa: E402 # Must import after setting environment variable
from nidaqmx.constants import AcquisitionType # noqa: E402
import nidaqmx
from nidaqmx.constants import AcquisitionType

with nidaqmx.Task() as task:
total_samples = 1000
Expand Down
13 changes: 7 additions & 6 deletions examples/digital_in/acq_dig_port_int_clk_wfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
using the DAQ device's internal clock.
"""

import os
import numpy as np

os.environ["NIDAQMX_ENABLE_WAVEFORM_SUPPORT"] = "1"

import nidaqmx # noqa: E402 # Must import after setting environment variable
from nidaqmx.constants import ( # noqa: E402
import nidaqmx
from nidaqmx.constants import (
READ_ALL_AVAILABLE,
AcquisitionType,
LineGrouping,
)

np.set_printoptions(linewidth=120) # ensure signal.data prints on a single line

with nidaqmx.Task() as task:
task.di_channels.add_di_chan(
"cdaqTesterMod4/port0", line_grouping=LineGrouping.CHAN_FOR_ALL_LINES
Expand All @@ -23,7 +23,8 @@

waveform = task.read_waveform(READ_ALL_AVAILABLE)
print("Acquired data:")
print(waveform.data)
for signal in waveform.signals:
print(f"{signal.name}: {signal.data}")
print(f"Channel name: {waveform.channel_name}")
print(f"t0: {waveform.timing.start_time}")
print(f"dt: {waveform.timing.sample_interval}")
2 changes: 1 addition & 1 deletion examples/digital_out/cont_gen_dig_port_int_clk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
data = [1, 2, 4, 8, 16, 32, 64, 128]

task.do_channels.add_do_chan("Dev1/port0", line_grouping=LineGrouping.CHAN_FOR_ALL_LINES)
task.timing.cfg_samp_clk_timing(1000.0, sample_mode=AcquisitionType.CONTINUOUS)
task.timing.cfg_samp_clk_timing(10.0, sample_mode=AcquisitionType.CONTINUOUS)
task.write(data)
task.start()

Expand Down
31 changes: 19 additions & 12 deletions examples/digital_out/cont_gen_dig_port_int_clk_wfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@
pattern using the DAQ device's clock.
"""

import os
import numpy as np
from nitypes.waveform import DigitalWaveform

os.environ["NIDAQMX_ENABLE_WAVEFORM_SUPPORT"] = "1"
import nidaqmx
from nidaqmx.constants import AcquisitionType, LineGrouping

from nitypes.waveform import DigitalWaveform # noqa: E402

import nidaqmx # noqa: E402 # Must import after setting environment variable
from nidaqmx.constants import AcquisitionType, LineGrouping # noqa: E402
np.set_printoptions(linewidth=220) # ensure signal.data prints on a single line

with nidaqmx.Task() as task:
waveform = DigitalWaveform(sample_count=100, signal_count=16)
for i in range(100):
for j in range(16):
waveform.data[i][j] = (i >> j) & 1

task.do_channels.add_do_chan("Dev1/port0", line_grouping=LineGrouping.CHAN_FOR_ALL_LINES)
task.timing.cfg_samp_clk_timing(1000.0, sample_mode=AcquisitionType.CONTINUOUS)
task.timing.cfg_samp_clk_timing(10.0, sample_mode=AcquisitionType.CONTINUOUS)

sample_count = 50
signal_count = task.do_channels[0].do_num_lines
waveform = DigitalWaveform(sample_count, signal_count)
for i in range(sample_count):
for j in range(signal_count):
waveform.signals[j].name = f"line {j:2}"
waveform.signals[j].data[i] = (i >> (j % 8)) & 1

print("Writing data:")
for signal in waveform.signals:
print(f"{signal.name}: {signal.data}")

task.write(waveform)
task.start()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
)
from nidaqmx.stream_readers import AnalogMultiChannelReader, CounterReader

os.environ["NIDAQMX_ENABLE_WAVEFORM_SUPPORT"] = "1"

# Configuration
SAMPLE_RATE = 1000
SAMPLES_PER_CHANNEL = 1000
Expand Down
2 changes: 1 addition & 1 deletion generated/nidaqmx/_feature_toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
# Define feature toggle constants here:
# --------------------------------------

WAVEFORM_SUPPORT = FeatureToggle("WAVEFORM_SUPPORT", CodeReadiness.INCOMPLETE)
WAVEFORM_SUPPORT = FeatureToggle("WAVEFORM_SUPPORT", CodeReadiness.RELEASE)
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ click = ">=8.0.0"
distro = { version = ">=1.9.0", platform = "linux" }
requests = ">=2.25.0"
typing_extensions = { version = ">=4.0.0" }
nitypes = {version=">=1.1.0.dev1"}
nitypes = {version=">=1.0.1.dev0"}

[tool.poetry.group.codegen.dependencies]
Mako = "^1.2"
Expand Down
2 changes: 1 addition & 1 deletion src/handwritten/_feature_toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
# Define feature toggle constants here:
# --------------------------------------

WAVEFORM_SUPPORT = FeatureToggle("WAVEFORM_SUPPORT", CodeReadiness.INCOMPLETE)
WAVEFORM_SUPPORT = FeatureToggle("WAVEFORM_SUPPORT", CodeReadiness.RELEASE)