Skip to main content

Reading LabChart recorded data

Project description

adinstruments_sdk_python

Use this code to read .adicht (Labchart) files into Python. Interfacing with the ADIstruments DLL is done via cffi.

  • The code utilizes the SDK from ADIstruments to read files in Python as NumPy arrays.
  • Currently only works for Windows. Not fixable by me, requires changes by ADInstruments
  • A slightly more fleshed out MATLAB version can be found here.
  • Currently requires Python 3.6-3.14 with some of the newer versions requiring 64 bit Python (this can change but requires some work on my end)

Installation

pip install adi-reader

Demo code

import adi
f = adi.read_file(r'C:\Users\RNEL\Desktop\test\test_file.adicht')
# All id numbering is 1 based, first channel, first block
# When indexing in Python we need to shift by 1 for 0 based indexing
# Functions however respect the 1 based notation ...

# These may vary for your file ...
channel_id = 2
record_id = 1
data = f.channels[channel_id-1].get_data(record_id)

import matplotlib.pyplot as plt
plt.plot(data)
plt.show()
	

Grabbing data from a specific channel. Some advanced data retrieval functionality is also shown.

import adi
f = adi.read_file(r'C:\Users\RNEL\Desktop\test\test_file.adicht')
#Note, this defaults to a partial, case insensitive match
p = f.get_channel_by_name('pres')

record_id = 1
#time units are in seconds
time,data = p.get_data(record_id,start_time=10,return_time=True)


plt.plot(time,data)
plt.xlabel('time (s)')
plt.ylabel(f'{p.name} ({p.units[record_id]})')
plt.show()

Dependencies

Data Model

Data are collected in blocks or records, starting at record 1. For each record the channel properties can change (units, sampling rate). Every time settings are changed or recording stops, a new block is created (once recording starts again).

The two primary data types that are exposed through the SDK are:

  • channel data
  • comments - time of comment and text information (along with an id and info on which channel the comment applies to)

There are other things that are collected in LabChart files, but these are not exposed via the SDK.

  • file
    • records
      • timing info
      • comments
    • channels
      • data

Improvements

Feel free to open pull requests or to open issues.

Things I would like to add at some point:

  • a general review tool that plots a file
  • even simpler, plotting a channel with comments
  • better method support for getting specific info
  • better functionality of data retrieval

Change Notes

  • 2026-04-12 :
    • Added 3.14 support
    • Improved documentation

Support Notes

My ability to work on this code was supported, in part, by a grant from the NIH NIDDK (grant: R21DK140694)

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

adi_reader-0.1.15.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

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

adi_reader-0.1.15-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file adi_reader-0.1.15.tar.gz.

File metadata

  • Download URL: adi_reader-0.1.15.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for adi_reader-0.1.15.tar.gz
Algorithm Hash digest
SHA256 d63cccd1a24b1e55b560c5b298d656c6cefb1d0023584a3c3485dc98e382906d
MD5 09878597bd3dd0702ec2c5bd652ec927
BLAKE2b-256 a67e2ef3e31791bce4d3a990c043e28b26807d64d15f6de12a98c93332b4e5ec

See more details on using hashes here.

File details

Details for the file adi_reader-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: adi_reader-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for adi_reader-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 2228401418431fe7e9e47394088986043e60820a53adffd1f6db8d07737519ad
MD5 98e4eda63658e5ca7afbabc00c40fbf0
BLAKE2b-256 e41d48a5b86cf4c547342994421f126c7d1541c47abdc3aefff066065f03061a

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