Skip to content
Closed
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ All notable changes to this project will be documented in this file.

* ### Major Changes
* Removed support for Python 3.9.
* (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).
* Completed support for reading and writing Waveforms, and removed the 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).
Comment on lines +37 to +38
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parent bullet is unnecessary and only matters to developers, not users.


* ### Known Issues
* ...
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
8 changes: 2 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,12 +4,8 @@
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 ( # noqa: E402
import nidaqmx
from nidaqmx.constants import (
READ_ALL_AVAILABLE,
AcquisitionType,
LineGrouping,
Expand Down
10 changes: 3 additions & 7 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,14 +4,10 @@
pattern using the DAQ device's clock.
"""

import os
from nitypes.waveform import DigitalWaveform

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

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
import nidaqmx
from nidaqmx.constants import AcquisitionType, LineGrouping

with nidaqmx.Task() as task:
waveform = DigitalWaveform(sample_count=100, signal_count=16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,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: 0 additions & 2 deletions generated/nidaqmx/_feature_toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,3 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
# --------------------------------------
# Define feature toggle constants here:
# --------------------------------------

WAVEFORM_SUPPORT = FeatureToggle("WAVEFORM_SUPPORT", CodeReadiness.INCOMPLETE)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from nitypes.waveform import AnalogWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -137,7 +136,6 @@ def read_one_sample(self, data, timeout=10):
self._handle, 1, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveforms(
self,
waveforms: list[AnalogWaveform[numpy.float64]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from nitypes.waveform import AnalogWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -109,7 +108,6 @@ def read_one_sample(self, timeout=10):
"""
return self._interpreter.read_analog_scalar_f64(self._handle, timeout)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveform(
self,
waveform: AnalogWaveform[numpy.float64],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from nitypes.waveform import DigitalWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -486,7 +485,6 @@ def read_one_sample_port_uint32(self, data, timeout=10):
self._handle, 1, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveforms(
self,
waveforms: list[DigitalWaveform[Any]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from nitypes.waveform import DigitalWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -393,7 +392,6 @@ def read_one_sample_port_uint32(self, timeout=10):
""" # noqa: W505 - doc line too long (103 > 100 characters) (auto-generated noqa)
return self._interpreter.read_digital_scalar_u32(self._handle, timeout)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveform(
self,
waveform: DigitalWaveform[Any],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from nitypes.waveform import AnalogWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -91,7 +90,6 @@ def write_one_sample(self, data, timeout=10):
self._handle, 1, auto_start, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveforms(
self, waveforms: Sequence[AnalogWaveform[Any]], timeout: float = 10.0
) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from nitypes.waveform import AnalogWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -82,7 +81,6 @@ def write_one_sample(self, data, timeout=10):

return self._interpreter.write_analog_scalar_f64(self._handle, auto_start, timeout, data)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveform(self, waveform: AnalogWaveform[Any], timeout: float = 10.0) -> int:
"""Writes a waveform to a single analog output channel in a task.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from nitypes.waveform import DigitalWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -325,7 +324,6 @@ def write_one_sample_port_uint32(self, data, timeout=10):
self._handle, 1, auto_start, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveforms(
self, waveforms: Sequence[DigitalWaveform[Any]], timeout: float = 10.0
) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy
from nitypes.waveform import DigitalWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -285,7 +284,6 @@ def write_one_sample_port_uint32(self, data, timeout=10):

return self._interpreter.write_digital_scalar_u32(self._handle, auto_start, timeout, data)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveform(self, waveform: DigitalWaveform[Any], timeout: float = 10.0) -> int:
"""Writes a waveform to a single digital output channel in a task.

Expand Down
3 changes: 0 additions & 3 deletions generated/nidaqmx/task/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from nitypes.waveform import AnalogWaveform, DigitalWaveform

from nidaqmx import utils
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import (
READ_ALL_AVAILABLE,
AcquisitionType,
Expand Down Expand Up @@ -806,7 +805,6 @@ def _read_power(
:samples_read
]

@requires_feature(WAVEFORM_SUPPORT)
def read_waveform(self, number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0):
"""Reads samples from the task or virtual channels you specify, and returns them as waveforms.

Expand Down Expand Up @@ -1588,7 +1586,6 @@ def _is_waveform_data(self, data):
isinstance(wf, DigitalWaveform) for wf in data
)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveform(
self,
waveforms: (
Expand Down
2 changes: 0 additions & 2 deletions src/handwritten/_feature_toggles.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too early for this. Read https://dev.azure.com/ni/DevCentral/_wiki/wikis/AppCentral.wiki/900/Feature-Toggles

Feature toggles should only be removed once the code protected behind the feature toggle ships in the enabled state. Do not remove a feature toggle before the code ships.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't know that policy was the same for GitHub repos, but it makes sense. I'll abandon this PR for now. Also, I'll change the work item from "remove the feature toggle" to "enable the feature toggle by default".

Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,3 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
# --------------------------------------
# Define feature toggle constants here:
# --------------------------------------

WAVEFORM_SUPPORT = FeatureToggle("WAVEFORM_SUPPORT", CodeReadiness.INCOMPLETE)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from nitypes.waveform import AnalogWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -137,7 +136,6 @@ def read_one_sample(self, data, timeout=10):
self._handle, 1, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveforms(
self,
waveforms: list[AnalogWaveform[numpy.float64]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from nitypes.waveform import AnalogWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -109,7 +108,6 @@ def read_one_sample(self, timeout=10):
"""
return self._interpreter.read_analog_scalar_f64(self._handle, timeout)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveform(
self,
waveform: AnalogWaveform[numpy.float64],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from nitypes.waveform import DigitalWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -486,7 +485,6 @@ def read_one_sample_port_uint32(self, data, timeout=10):
self._handle, 1, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveforms(
self,
waveforms: list[DigitalWaveform[Any]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from nitypes.waveform import DigitalWaveform

from nidaqmx import DaqError
from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import READ_ALL_AVAILABLE, FillMode, ReallocationPolicy
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.stream_readers._channel_reader_base import ChannelReaderBase
Expand Down Expand Up @@ -393,7 +392,6 @@ def read_one_sample_port_uint32(self, timeout=10):
""" # noqa: W505 - doc line too long (103 > 100 characters) (auto-generated noqa)
return self._interpreter.read_digital_scalar_u32(self._handle, timeout)

@requires_feature(WAVEFORM_SUPPORT)
def read_waveform(
self,
waveform: DigitalWaveform[Any],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from nitypes.waveform import AnalogWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -91,7 +90,6 @@ def write_one_sample(self, data, timeout=10):
self._handle, 1, auto_start, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveforms(
self, waveforms: Sequence[AnalogWaveform[Any]], timeout: float = 10.0
) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from nitypes.waveform import AnalogWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -82,7 +81,6 @@ def write_one_sample(self, data, timeout=10):

return self._interpreter.write_analog_scalar_f64(self._handle, auto_start, timeout, data)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveform(self, waveform: AnalogWaveform[Any], timeout: float = 10.0) -> int:
"""Writes a waveform to a single analog output channel in a task.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from nitypes.waveform import DigitalWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -325,7 +324,6 @@ def write_one_sample_port_uint32(self, data, timeout=10):
self._handle, 1, auto_start, timeout, FillMode.GROUP_BY_CHANNEL.value, data
)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveforms(
self, waveforms: Sequence[DigitalWaveform[Any]], timeout: float = 10.0
) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy
from nitypes.waveform import DigitalWaveform

from nidaqmx._feature_toggles import WAVEFORM_SUPPORT, requires_feature
from nidaqmx.constants import FillMode
from nidaqmx.stream_writers._channel_writer_base import (
AUTO_START_UNSET,
Expand Down Expand Up @@ -285,7 +284,6 @@ def write_one_sample_port_uint32(self, data, timeout=10):

return self._interpreter.write_digital_scalar_u32(self._handle, auto_start, timeout, data)

@requires_feature(WAVEFORM_SUPPORT)
def write_waveform(self, waveform: DigitalWaveform[Any], timeout: float = 10.0) -> int:
"""Writes a waveform to a single digital output channel in a task.

Expand Down
Loading