Skip to main content

Info

Contains a Python API for interacting with Measurement Computing’s Universal Library for Linux.

Author

Measurement Computing

About

The uldaq Python package contains an API (Application Programming Interface) for interacting with Measurement Computing DAQ devices. The package is implemented as an object-oriented wrapper around the UL for Linux C API using the ctypes Python library.

uldaq supports Python 2.7, 3.4+

Prerequisites

Running the uldaq Python API requires the UL for Linux C API.

  • Visit uldaq on GitHub to install the latest version of the UL for Linux C API.

Installing the uldaq Python API requires Python along with the pip, setuptools and wheel packages.

  • For more information on installing Python, go to python.org.

  • For more information on installing Python packages with pip, see the Installing Packages tutorial on python.org.

Installation

Install the uldaq Python API with:

$ pip install uldaq

Note: Installation may need to be run with sudo.

Examples

A complete set of examples is include in the source tarball. To obtain and run the examples, follow these steps:

  1. Go to pypi.org/project/uldaq.

  2. Under Navigation click the Download files link.

  3. Click the uldaq-1.2.3.tar.gz link to download the file.

  4. Copy the file from the default download location to a desired location.

  5. Navigate to the file location and run:

    $ tar -xvf uldaq-1.2.3.tar.gz
  6. The Python examples are located in the examples folder. Run the following commands to execute the analog input example:

    $ cd uldaq-1.2.3/examples
    $ ./a_in.py

Note: For best results, run examples in a terminal window.

Usage

The following is a simple example for reading a single voltage value from each channel in an analog input subsystem of a Measurement Computing DAQ device.

from uldaq import (get_daq_device_inventory, DaqDevice, InterfaceType,
                   AiInputMode, Range, AInFlag)

try:
    # Get a list of available DAQ devices
    devices = get_daq_device_inventory(InterfaceType.USB)
    # Create a DaqDevice Object and connect to the device
    daq_device = DaqDevice(devices[0])
    daq_device.connect()
    # Get AiDevice and AiInfo objects for the analog input subsystem
    ai_device = daq_device.get_ai_device()
    ai_info = ai_device.get_info()

    # Read and display voltage values for all analog input channels
    for channel in range(ai_info.get_num_chans()):
        data = ai_device.a_in(channel, AiInputMode.SINGLE_ENDED,
                              Range.BIP10VOLTS, AInFlag.DEFAULT)
        print('Channel', channel, 'Data:', data)

    daq_device.disconnect()
    daq_device.release()

except ULException as e:
    print('\n', e)  # Display any error messages

The same example using a with block:

from uldaq import (get_daq_device_inventory, DaqDevice, InterfaceType,
                   AiInputMode, Range, AInFlag)

try:
    # Get a list of available devices
    devices = get_daq_device_inventory(InterfaceType.USB)
    # Create a DaqDevice Object and connect to the device
    with DaqDevice(devices[0]) as daq_device:
        # Get AiDevice and AiInfo objects for the analog input subsystem
        ai_device = daq_device.get_ai_device()
        ai_info = ai_device.get_info()

        # Read and display voltage values for all analog input channels
        for channel in range(ai_info.get_num_chans()):
            data = ai_device.a_in(channel, AiInputMode.SINGLE_ENDED,
                                  Range.BIP10VOLTS, AInFlag.DEFAULT)
            print('Channel', channel, 'Data:', data)

except ULException as e:
    print('\n', e)  # Display any error messages

Support/Feedback

The uldaq package is supported by MCC. For uldaq support, contact technical support through mccdaq.com/Support.aspx . Please include version information for Python, uldaq C API and uldaq Python API packages used as well as detailed steps on how to reproduce the problem.

Documentation

Documentation is available at mccdaq.com.

License

uldaq is licensed under an MIT-style license. Other incorporated projects may be licensed under different licenses. All licenses allow for non-commercial and commercial use.

Release files for uldaq 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uldaq 1.2.3
File Size Uploaded
uldaq-1.2.3.tar.gz 94.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uldaq 1.2.3
File Interpreter ABI Platform
uldaq-1.2.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 162.0 kB

Release files / uldaq-1.2.3.tar.gz

Download URL uldaq-1.2.3.tar.gz
Size 94.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2d405ead334bb4e37c20b72d8ec498f0e372b08f1d3323f622abe0581ac28b98
BLAKE2b-256 checksum
How to use checksums
9d9dcae9cbdb8285730e8c7a6eae85f6120330a8e833a97cec95d9e288c3dfba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

Release files / uldaq-1.2.3-py2.py3-none-any.whl

Download URL uldaq-1.2.3-py2.py3-none-any.whl
Size 67.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
44e29c0951d0c9a2b982f57ba85db0625a321717640a265cd64df51a6b61af82
BLAKE2b-256 checksum
How to use checksums
d87a1335cf0fc8db9ffa283307b321686d2283abc22abc07ba2cecb8e1222544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page