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
13 changes: 6 additions & 7 deletions docs/source/api/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ Migrating from the previous objects
===================================

The ``NIDAQmx`` object of ``hardware/national_instruments/daqmxni.py`` (one object, one task, channels described by
mutable classes with a ``source`` attribute, ``update_task`` with several ``if`` on the type) is replaced by the API of
this section. There is no compatibility layer: the old names disappear with the old module, once the plugins of the
package use the new API.
mutable classes with a ``source`` attribute, ``update_task`` with several ``if`` on the type) was replaced by the API of
this section, and the module has been removed. There is no compatibility layer: the old names do not exist any more.

Two lines of releases exist:

Expand Down Expand Up @@ -151,7 +150,7 @@ In a PyMoDAQ plugin
State of the package
--------------------

The AI, counter and ramp-output plugins already use the new API. The generic plugins (``NIDAQmx`` viewers and
actuator, which read ``config_daqmx.toml``) still use the old module ``daqmxni.py`` and are ported next, together with
the removal of the old module: until then, both may be found in the same checkout, but nothing new should be built on
``daqmxni.py``.
All the plugins of the package use the new API: the AI, counter and ramp-output plugins, the generic viewers
(``NIDAQmx`` analog and ``NIDAQmx_DI`` digital) and the generic actuators (``NIDAQmx`` analog and ``NIDAQmx_DO``
digital). The old modules (``daqmxni.py``, ``NIDAQmx_base.py``, ``NIDAQmx_Viewer.py`` and ``NIDAQmx_Move.py``) have been
removed; code that still needs them has to stay on the ``pydaqmx`` line or be rewritten as shown above.
6 changes: 3 additions & 3 deletions docs/source/creating_plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ In order to create a plugin using a NI card to acquire some data or control an a

Then you have to analyze the experiment that you want to perform and find the best type of controller that you should use:

* a single ``NIDAQmx`` object, if you need to perform only one type of task.
* a single task of :doc:`the API <api/index>` (``AnalogInputTask``, ``AnalogOutputTask``...), if you need to perform only one type of task.

* a dict of several ``NIDAQmx`` objects, like in the ``DAQmx_Counter`` example, if you will only use the NI card but need to combine several tasks.
* a ``TaskGroup`` of several tasks, like in the ``DAQmx_Counter`` example, if you will only use the NI card but need to combine several tasks.

* a dict of ``NIDAQmx`` objects and other hardware controllers, for example if you want to synchronise your acquisition with an actuator which will be triggered by the NI card.
* a ``TaskGroup`` and other hardware controllers, for example if you want to synchronise your acquisition with an actuator which will be triggered by the NI card.

* Another more complicated object (that you will need to write!), like in the ``NIDAQmx_RampOutput`` example, if you need to share some resources of the NI card between different instrument plugins which control independent parameters/measurements. Beware in particular of the Scan extension which sends all the move commands at the same time.
13 changes: 2 additions & 11 deletions docs/source/docstring/hardware.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
hardware - National Instruments
===============================

NIDAQmx object
--------------

NIDAQmx Base module
-------------------

NIDAQmx Actuator module
-----------------------

NIDAQmx Viewer module
---------------------
The hardware layer is the ``nidaqmx`` based API, documented in :doc:`../api/index`, and the helpers that the plugins
share (``NIDAQmx_AI.py``, ``output_actuator.py``, ``config_files.py``, ``channel_tree.py``, ``ramp_output.py``).
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ This plugin is compatible with PymoDAQ 5.
introduction
user_guide
api/index
nidaqmx
library
creating_plugin

42 changes: 0 additions & 42 deletions docs/source/nidaqmx.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For any other use, you will need to create your own move or viewer based on this
Working principle of the plugins
--------------------------------

The controller object, which is usually the wrapper to your hardware, will always be a ``NIDAQmx`` object. These are defined in ``hardware\national_instruments\daqmxni.py``. Such an object contains a **task**, which is configured and then sent to the NI device. Beware that a task can only contain one channel type. The channel types are Analog Output, Analog Input, Digital Output, Digital Input or Counter. As a consequence, if you need to combine several of them, your controller will be a bit more complicated. It might be a dict containing several ``NIDAQmx`` objects, as in the counter example, or you might even need to create a specific object to handle these ``NIDAQmx`` objects, as in the ramp output example. More details about these two situations are given in the following sections.
The controller object, which is usually the wrapper to your hardware, is a **task** of :doc:`the API <api/index>` (``AnalogInputTask``, ``AnalogOutputTask``, ``DigitalTask``, ``CounterInputTask`` or ``CounterOutputTask``), built from a ``TaskConfig`` that describes its channels, its clock and its start trigger. Beware that a task can only contain one type of channel: analog input, analog output, digital input or output, or counter. As a consequence, if you need to combine several of them, your controller will be a bit more complicated. It might be a ``TaskGroup`` of several tasks started together, as in the counter example, or you might even need to create a specific object to handle these tasks, as in the ramp output example. More details about these two situations are given in the following sections.

.. toctree::
:maxdepth: 1
Expand Down
8 changes: 4 additions & 4 deletions docs/source/user_guide/counter_details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Details about the implementation of the 0D viewer DAQmx_Counter
===============================================================

Two counters are used for one measurement: a first one counts the edges and a second one gives the counting time.
These are two separate tasks, although the channels are connected together, so a single ``NIDAQmx`` object cannot be
These are two separate tasks, although the channels are connected together, so a single task cannot be
the controller of the plugin.

The controller is a dict containing two ``NIDAQmx`` objects, ``clock`` and ``counter``, each with its own task:
The controller holds two tasks, ``clock`` and ``counter``, started together as a ``TaskGroup``:

* The clock is a ``ClockCounter`` channel (see ``daqmxni.py``), producing pulses at the clock frequency.
* The counter is a ``CIChannel`` counting edges, whose sample clock is the internal output of the clock channel
* The clock is a ``COPulseFreq`` channel of a ``CounterOutputTask``, producing pulses at the clock frequency.
* The counter is a ``CICountEdges`` channel of a ``CounterInputTask`` counting edges, whose sample clock is the internal output of the clock channel
(``/Dev[X]/ctr[Y]InternalOutput``): one sample is taken at the first tick of the clock.

**One grab**
Expand Down
4 changes: 2 additions & 2 deletions docs/source/user_guide/ramp_output_details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Details about the implementation of the NIDAQmx_RampOutput move
===============================================================

Several channels are needed for a movement: an analog output and a counter used as a clock. As in the case of the
counter (see :doc:`counter_details`), they are separate tasks and a single ``NIDAQmx`` object is not enough. In
counter (see :doc:`counter_details`), they are separate tasks and a single task is not enough. In
addition, with several axes, all the outputs must be in the same task, driven by the same clock, and each axis is a
different instrument plugin: they share a controller, ``RampOutputController`` (``ramp_output.py``).

The controller
--------------

It has two ``NIDAQmx`` objects, ``clock`` and ``analog``, and one ``AOChannel`` per axis. For each move:
It has two tasks, ``clock`` (a ``CounterOutputTask``) and ``analog`` (an ``AnalogOutputTask``), and one ``AOVoltage`` channel per axis. For each move:

* the clock task generates ``n + 1`` pulses at the frequency ``1 / step time``;
* the analog task has one output channel per axis, its sample clock is the internal output of the clock channel, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
DataActuator, main)
from pymodaq.utils.logger import set_logger, get_module_name

from pymodaq_plugins_daqmx.hardware.national_instruments.daqmxni import NIDAQmx, ChannelType
from pymodaq_plugins_daqmx.hardware.national_instruments.api import ChannelKind, NIDAQSystem
from pymodaq_plugins_daqmx.hardware.national_instruments.ramp_output import RampOutputController

logger = set_logger(get_module_name(__file__))

AO_CHANNELS = NIDAQmx.get_NIDAQ_channels(source_type=ChannelType.ANALOG_OUTPUT)
COUNTER_CHANNELS = NIDAQmx.get_NIDAQ_channels(source_type=ChannelType.COUNTER_OUTPUT)
AO_CHANNELS = NIDAQSystem().all_channels(ChannelKind.AO)
COUNTER_CHANNELS = NIDAQSystem().all_channels(ChannelKind.CO)


class DAQ_Move_NIDAQmx_RampOutput(DAQ_Move_base):
Expand Down

This file was deleted.

Loading
Loading