This package allows users to use data acquisition hardware from National Instruments with Python. It provides an interface between the NIDAQmx driver and Python. The package works on Windows and Linux.
This package is not an open source driver for NI acquisition hardware. You first need to install the driver provided by NI.
Compared to similar packages, the PyDAQmx module is a full interface to the NIDAQmx ANSI C driver. It imports all the functions from the driver and imports all the predefined constants. This provides an almost one-to-one match between C and Python code.
A more convenient object-oriented interface is also provided, where the mechanisms of taskHandle in C is replaced with a Task object.
The module supports callback functions, see How to use callback functions in PyDAQmx
You first need to install the NI DAQmx driver provided with your data-acquisition hardware. Please verify that you have installed together with the driver the C API (which should be the case by default).
To install PyDAQmx, either download the package manually and run the command:
python setup.py install
or using pip:
pip install PyDAQmx
You can also directly move the PyDAQmx directory to a location that Python can import from (the directory in which scripts using PyDAQmx are run, sys.path, etc.)
For more information see Installation.
The package is written for Python 2. Is is compatible with Python 3 using 2to3. To build and install the package with Python 3
python setup.py build python setup.py install
If you want to run PyDAQmx without installing it, run the python setup.py build command and switch to the build/lib directory.
Installation describes the installation and configuration of PyDAQmx.
How to use PyDAQmx gives you some examples on how to use PyDAQmx.
How to use callback functions in PyDAQmx gives code examples on how to use callback functions.
List of examples gives a list of examples.
More examples are available in the GitHub repository in the PyDAQmx/example directory.
If you use this package for a publication (in a journal, on the web, etc.), please cite it by including as much information as possible from the following: PyDAQmx : a Python interface to the National Instruments DAQmx driver, Pierre CLADÉ, http://pythonhosted.org/PyDAQmx/.