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.
  • A slightly more flushed out Matlab version can be found here.

Installation

pip install adi-reader

Test 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()

Dependencies


Setup for other Python versions

  • Running the code might require compiling the cffi code depending on your Python version.
  • This requires running cffi_build.py in the adi package.
  • This might require installing cffi as well as some version of Visual Studio.
  • The currently released code was compiled for Python 3.6-3.9 on Visual Studio 14.0 or greater was required.

For upgrading to 3.8, I installed Python 3.8. Within the interpreter I ran the following:

  • Jim note to self, rather than installing Anaconda I simply:
    • download Python from https://www.python.org/downloads/windows/
    • cd to Python directory or run directly, these go to something like: C:\Users\RNEL\AppData\Local\Programs\Python\Python39-32\python
    • Note the above path is specific to my computer, might need to change user name
import subprocess
import sys

#https://stackoverflow.com/questions/12332975/installing-python-module-within-code
def install(package):
    subprocess.call([sys.executable, "-m", "pip", "install", package])
	
install("cffi")

import os
#This would need to be changed based on where you keep the code
os.chdir('G:/repos/python/adinstruments_sdk_python/adi')

# For 64 bit windows
exec(open("cffi_build.py").read())

# For 32 bit windows
exec(open("cffi_build_win32.py").read())

Improvements

This was written extremely quickly and is missing some features. Feel free to open pull requests or to open issues.

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.0.9.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file adi-reader-0.0.9.tar.gz.

File metadata

  • Download URL: adi-reader-0.0.9.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for adi-reader-0.0.9.tar.gz
Algorithm Hash digest
SHA256 fd8cc482f9053f36c17762f81e370e91fa48f3a27a743c3d22c37ee41e8eff47
MD5 e682adaf11570ff9b2d05579cb117caf
BLAKE2b-256 e8ebdad9b2368a718caf1ab0fcbe3b4a5a419f1d17cd755baad69d8da3ec60c3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for adi_reader-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 721516b01ad6c50b4e505b1c79cffaf185098b05f57187dd3265354f9f59daf8
MD5 34fc5449c6c3077225c8c148669a202e
BLAKE2b-256 0e8e9c1e719df3911c920aa8e6855f158943241bd0dfe02831c365d435294286

See more details on using hashes here.

Supported by

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