Skip to main content

Python Interface for the DATAQ DI-2008 DAQ

Project description

DI2008-Python

About

Interface for the DI-2008 in Python.

Python 3.10+

Modified from original interface in Python by DATAQ Instruments under MIT License

Maintainer: Clark Hensley ch3136@msstate.edu

Getting Started

Install via pip from PyPI:

pip install di2008-python

See Available DI-2008s:

from di2008_python import print_all_di2008_metadata
print_all_di2008_metadata()

Instantiate DI2008 Object with Dictionary of Parameters:

from di2008_python import (
    DI2008,
    DI2008AnalogChannels,
    DI2008AllAnalogChannels,
    DI2008AnalogLayout,
    DI2008TCType,
    DI2008ScanRateSettings,
    DI2008FilterModes,
    DI2008SerialNums
)

# Create an array of DI-2008s with relevant settings
di2008_array = DI2008({
        # Global Settings
        DI2008AllAnalogChannels: (DI2008AnalogLayout.TC, DI2008TCType.K),
        DI2008ScanRateSettings.SRATE: 4,
        DI2008ScanRateSettings.DEC: 1,
        DI2008ScanRateSettings.FILTER: {
            DI2008AllAnalogChannels: DI2008FilterModes.AVERAGE,
            },
        # Serial Numbers of DI-2008s to apply
        DI2008lSerialNums: [<DI-2008 Serial Num>, <DI-2008 Serial Num>, ...],
        # Overwriting settings for a given DI-2008 (Not one of the ones listed above)
        <DI-2008 Serial Num>: {
            DI2008AnalogChannels.CH1: (DI2008AnalogLayout.TC, DI2008TCType.N),
            DI2008ScanRateSettings.FILTER: {
                DI2008AnalogChannels.CH1: DI2008FilterModes.LAST_POINT,
                }
            }

# Synchronized start of DI2008s
di2008_array.start_di2008s()

# Read from the DI2008s
while True:
    data = di2008_array.read_di2008s()
    print(data)

This interface uses named enumerations to ensure that what settings are being used is clear and concise

Currently, this package supports configuring and using up to 16 DI-2008s via ChannelStretch synchronization, and using any configuration of the Analog Channels. As of version 1.2.2, the digital channels, as well as the Event, Record, Rate, and Count channels are not yet supported.

Note About Bandwidth: Per the DI-2008 Protocol, if a single analog channel is enabled, the maximum sample rate of the DI-2008 is 2000 Hz, and if two or more analog channels are enabled, the maximum sample rate of the DI-2008 is 200 Hz. However, in this current implementation, that rate must be again divided by the number of enabled channels. Thus, 2 channels have a maximum sample rate of 100 Hz, and all 8 enabled channels can be sampled at, at most, 25 Hz. This is a known issue and work to address it is ongoing.

Current Features:

  • Thermocouples
  • ADC Reading
  • Changing Scan Rate, Decimation, and Filtering Mode
  • Automatic ChannelStretch Synchronized Initialization
  • Enforce cleanup on stopping
  • Changing Packet Size
  • Interface with the info operator

Planned Features:

  • Reading configuration from .json/.toml files as well as raw Python dictionaries
    • The backend for this is implement as of version 1.4.0. The API interface needs work.
  • Digital Channels
  • Specify Digital Input as well as Output
  • CJCDelta
  • Rate Measurement
  • LED Color

Further information about the DI-2008 can be found on DATAQ's website and via the DI-2008 Protocol.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

di2008_python-1.4.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

di2008_python-1.4.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file di2008_python-1.4.0.tar.gz.

File metadata

  • Download URL: di2008_python-1.4.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for di2008_python-1.4.0.tar.gz
Algorithm Hash digest
SHA256 ba736b545ce64321851ab7ef6edd38f3a281a3721542e2653497539ce1405dd5
MD5 eaec92d1a9d0020a9ca1cb41b5e722df
BLAKE2b-256 56d263eb967da0d161bad38cbfb23fdb7d4a79e325e27e0939a5136eefdcb44f

See more details on using hashes here.

File details

Details for the file di2008_python-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for di2008_python-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25b2d8caa6d105a62d99d3da82331745af4c0b8a1dfb28562ceee9ab45b7b2bb
MD5 eb03a102ed5f2986168e6996dcd2c799
BLAKE2b-256 eed223bc7d8643f511fb86f67f6c5de7cd6caa382086b8ac435c4f2c9fb32722

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page