Skip to content

Commit

Permalink
Refactor Task Internal Modules: Channels (#544)
Browse files Browse the repository at this point in the history
* Refactor channels

* update channels doc

* update affected tests

* minor codegen fix

* fix lint error

* update return type docs

* minor edit

* modify docs

* update functions metadata

* update metadata
  • Loading branch information
charitylxy authored Mar 19, 2024
1 parent 4d6b783 commit 2e0e590
Show file tree
Hide file tree
Showing 69 changed files with 283 additions and 338 deletions.
7 changes: 0 additions & 7 deletions docs/ai_channel.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/ao_channel.rst

This file was deleted.

15 changes: 0 additions & 15 deletions docs/channel.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/ci_channel.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/co_channel.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/di_channel.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/do_channel.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ nidaqmx.task

.. toctree::

channel
task_channels
task_collections
triggers
7 changes: 7 additions & 0 deletions docs/task_channels.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nidaqmx.task.channels
=====================

.. automodule:: nidaqmx.task.channels
:members:
:show-inheritance:
:member-order: bysource
11 changes: 0 additions & 11 deletions generated/nidaqmx/_task_modules/channels/__init__.py

This file was deleted.

7 changes: 3 additions & 4 deletions generated/nidaqmx/task/_in_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy.typing
import deprecation

from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels import Channel
from nidaqmx.utils import unflatten_channel_string
from nidaqmx.constants import (
AcquisitionType, LoggingMode, LoggingOperation, OverwriteMode,
Expand Down Expand Up @@ -154,9 +154,8 @@ def change_detect_overflowed(self):
@property
def channels_to_read(self):
"""
:class:`nidaqmx._task_modules.channels.channel.Channel`:
Specifies a subset of channels in the task from which to
read.
:class:`nidaqmx.task.channels.Channel`: Specifies a subset of
channels in the task from which to read.
"""

val = self._interpreter.get_read_attribute_string(self._handle, 0x1823)
Expand Down
4 changes: 2 additions & 2 deletions generated/nidaqmx/task/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy
from nidaqmx import utils
from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.task._export_signals import ExportSignals
from nidaqmx.task._in_stream import InStream
from nidaqmx.task._timing import Timing
Expand Down Expand Up @@ -143,7 +143,7 @@ def name(self):
@property
def channels(self):
"""
:class:`nidaqmx._task_modules.channels.channel.Channel`: Specifies
:class:`nidaqmx.task.channels.Channel`: Specifies
a channel object that represents the entire list of virtual
channels in this task.
"""
Expand Down
10 changes: 10 additions & 0 deletions generated/nidaqmx/task/channels/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

from nidaqmx.task.channels._channel import Channel
from nidaqmx.task.channels._ai_channel import AIChannel
from nidaqmx.task.channels._ao_channel import AOChannel
from nidaqmx.task.channels._ci_channel import CIChannel
from nidaqmx.task.channels._co_channel import COChannel
from nidaqmx.task.channels._di_channel import DIChannel
from nidaqmx.task.channels._do_channel import DOChannel

__all__ = ['Channel', 'AIChannel', 'AOChannel', 'CIChannel', 'COChannel', 'DIChannel', 'DOChannel',]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import deprecation

from nidaqmx.scale import _ScaleAlternateConstructor
from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.utils import unflatten_channel_string
from nidaqmx.constants import (
ACExcitWireMode, ADCTimingMode, AccelChargeSensitivityUnits,
Expand Down Expand Up @@ -3111,14 +3111,13 @@ def ai_term_cfg(self):
@property
def ai_thrmcpl_cjc_chan(self):
"""
:class:`nidaqmx._task_modules.channels.channel.Channel`:
Indicates the channel that acquires the temperature of the
cold junction if **ai_thrmcpl_cjc_src** is
**CJCSource1.SCANNABLE_CHANNEL**. If the channel is a
temperature channel, NI-DAQmx acquires the temperature in
the correct units. Other channel types, such as a resistance
channel with a custom sensor, must use a custom scale to
scale values to degrees Celsius.
:class:`nidaqmx.task.channels.Channel`: Indicates the channel
that acquires the temperature of the cold junction if
**ai_thrmcpl_cjc_src** is **CJCSource1.SCANNABLE_CHANNEL**.
If the channel is a temperature channel, NI-DAQmx acquires
the temperature in the correct units. Other channel types,
such as a resistance channel with a custom sensor, must use
a custom scale to scale values to degrees Celsius.
"""

val = self._interpreter.get_chan_attribute_string(self._handle, self._name, 0x1034)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Do not edit this file; it was automatically generated.

from nidaqmx.scale import _ScaleAlternateConstructor
from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.constants import (
AOIdleOutputBehavior, CurrentUnits, DataTransferActiveTransferMode,
DigitalWidthUnits, FuncGenType, ModulationType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit this file; it was automatically generated.

import nidaqmx._task_modules.channels # circular import: Channel._factory uses derived classes
import nidaqmx.task.channels # circular import: Channel._factory uses derived classes
from nidaqmx.system.physical_channel import _PhysicalChannelAlternateConstructor
from nidaqmx.utils import flatten_channel_string, unflatten_channel_string
from nidaqmx.constants import (
Expand Down Expand Up @@ -93,7 +93,7 @@ def _factory(task_handle, virtual_or_physical_name, interpreter):
or physical name of a channel.
interpreter (BaseInterpreter): Specifies the interpreter instance.
Returns:
nidaqmx._task_modules.channels.channel.Channel:
nidaqmx.task.channels.Channel:
Indicates an object that represents the specified channel.
"""
Expand All @@ -102,22 +102,22 @@ def _factory(task_handle, virtual_or_physical_name, interpreter):
channel_type = ChannelType(chan_type)

if channel_type == ChannelType.ANALOG_INPUT:
return nidaqmx._task_modules.channels.AIChannel(
return nidaqmx.task.channels.AIChannel(
task_handle, virtual_or_physical_name, interpreter)
elif channel_type == ChannelType.ANALOG_OUTPUT:
return nidaqmx._task_modules.channels.AOChannel(
return nidaqmx.task.channels.AOChannel(
task_handle, virtual_or_physical_name, interpreter)
elif channel_type == ChannelType.COUNTER_INPUT:
return nidaqmx._task_modules.channels.CIChannel(
return nidaqmx.task.channels.CIChannel(
task_handle, virtual_or_physical_name, interpreter)
elif channel_type == ChannelType.COUNTER_OUTPUT:
return nidaqmx._task_modules.channels.COChannel(
return nidaqmx.task.channels.COChannel(
task_handle, virtual_or_physical_name, interpreter)
elif channel_type == ChannelType.DIGITAL_INPUT:
return nidaqmx._task_modules.channels.DIChannel(
return nidaqmx.task.channels.DIChannel(
task_handle, virtual_or_physical_name, interpreter)
elif channel_type == ChannelType.DIGITAL_OUTPUT:
return nidaqmx._task_modules.channels.DOChannel(
return nidaqmx.task.channels.DOChannel(
task_handle, virtual_or_physical_name, interpreter)

@property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Do not edit this file; it was automatically generated.

from nidaqmx.scale import _ScaleAlternateConstructor
from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.constants import (
AngleUnits, AngularVelocityUnits, CountDirection, CounterFrequencyMethod,
DataTransferActiveTransferMode, DigitalWidthUnits, Edge, EncoderType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit this file; it was automatically generated.

from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.constants import (
ConstrainedGenMode, DataTransferActiveTransferMode, Edge, FrequencyUnits,
Level, OutputDataTransferCondition, TimeUnits, UsageTypeCO)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit this file; it was automatically generated.

from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.constants import (
ActiveOrInactiveEdgeSelection, DataTransferActiveTransferMode,
InputDataTransferCondition, LogicFamily)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit this file; it was automatically generated.

from nidaqmx._task_modules.channels.channel import Channel
from nidaqmx.task.channels._channel import Channel
from nidaqmx.constants import (
ActiveOrInactiveEdgeSelection, DataTransferActiveTransferMode,
DigitalDriveType, Level, LogicFamily, OutputDataTransferCondition)
Expand Down
Loading

0 comments on commit 2e0e590

Please sign in to comment.