Skip to main content

A Python package for reading and writing AxoGraph data files

Project description

PyPI project GitHub source code Launch a demo in Binder

axographio is a Python package that makes it easy to read and write binary data files in the AxoGraph file format.

AxoGraph is a commercial software package for data acquisition and analysis that is widely used in electrophysiological research. Although it can read and write files in text format, its binary format is much smaller and faster to load and save; thus many users preferentially use this format. The company distributes the details of the file format along with sample C++ code for reading and writing to these files using third-party software, such as this Python package.

Python is a powerful and easy to use general purpose programming language. There are many useful Python libraries available for scientific data analysis and data visualization such as SciPy, Matplotlib, and Mayavi.

This package provides a simple interface for loading AxoGraph data files into a Python program or interactive session. If you want to analyze data you recorded in AxoGraph using Python-based tools, this package provides the glue code you’ll need. You can also write data to the AxoGraph binary format so that it can be viewed and analyzed within AxoGraph.

Getting axographio

axographio is compatible with both Python 2 and Python 3.

The easiest way to get axographio is to install the latest stable version using pip, but you can alternatively build it from the source code.

Installing the latest stable version

Requirements for installing and running axographio:

  • The NumPy package (pip install numpy)

The axographio package contains C++ code that must be compiled. PyPI stores pre-compiled copies of the package for common platforms (e.g., Python 3 on 64-bit Windows), and these can be installed using pip.

To install the latest stable version, try the following:

pip install axographio

If a pre-compiled package is available for your platform on PyPI, pip should quickly download and install it. If not, pip will automatically attempt to build the package from source code. Building the package has additional requirements. If pip fails during building, keep reading.

Building from source code

If you need to build the package because a pre-compiled version is not already available for your platform on PyPI, or if you just want to try building from the source code, you will need to meet additional requirements.

Requirements for building axographio from source code:

  • The NumPy package (pip install numpy)

  • The Cython package, version 0.19 or later (pip install cython>=0.19)

  • A C++ compiler (e.g., Visual C++ Build Tools from Microsoft on Windows systems, or Xcode on Mac systems)

If pip failed while trying to build from source code, make sure you meet these requirements and try again.

If you would like to build and install using the latest development source code from GitHub, try the following:

pip install git+https://github.com/CWRUChielLab/axographio

This command requires git. If you don’t have git, you can instead manually download the source from GitHub and install from your local directory:

pip install C:\wherever-you-put-the-source-code

Usage

Try out the Binder demo for an interactive Python session that requires no installation or fuss. You can start hacking right now!

Loading a data file is as easy as calling read:

>>> import axographio
>>>
>>> f = axographio.read('AxoGraph X File.axgx')

At this point the variable f will contain a file_contents object with the column names and data from the file. For example, you could now plot the first two columns using Matplotlib:

>>> import matplotlib.pyplot as plt
>>>
>>> plt.plot(f.data[0], f.data[1])
>>> plt.xlabel(f.names[0])
>>> plt.ylabel(f.names[1])
>>> plt.show()  # may be optional depending on your OS

Of course, you probably have grander plans than just plotting the data. The column data supports the standard sequence interfaces (i.e., indexing, iteration, etc.) and can be converted to a NumPy or SciPy array using the asarray functions in these packages, e.g.:

>>> import numpy as np
>>>
>>> times = np.asarray(f.data[0])

Writing files is also relatively easy. You simply create a new file_contents object (or use one you loaded earlier), and then call write. For example, the following code creates a file in the current directory called ‘my60Hz.axgx’ with two channels with 60 Hz sine waves:

>>> import axographio
>>> import numpy as np
>>>
>>> times = np.arange(0, 10, 0.0001)
>>> column1 = np.sin(2*np.pi * 60 * times)
>>> column2 = np.cos(2*np.pi * 60 * times)
>>> f = axographio.file_contents(
...    ['time (s)', 'my recording (V)', 'your recording (V)'],
...    [times, column1, column2])
>>> f.write('my60Hz.axgx') # created in the current directory

Questions and Support

Please post any questions, problems, comments, or suggestions in the GitHub issue tracker.

Changes

0.3.0

  • Package test suite can be run using axographio.tests.run()

  • Package version can be accessed using axographio.__version__

  • Added example Jupyter notebook to source repository (not included with installation)

  • Updated installation instructions

  • Improved documentation

  • Reorganized source code file structure

  • Fixed doctests for NumPy < 1.14

0.2.0

  • Added compatibility with Python 3

0.1.1

  • Fixed a rounding error that could create one extra data point in the time column

0.1.0

  • First release

Acknowledgments

This initial version of this project was written in the Chiel Laboratory at Case Western Reserve University, with support from NIH grant NS047073, an Ohio Innovation Incentive Award Fellowship, and the Case Western Reserve MSTP (NIH T32 GM007250). This project builds on a number of other open source projects, including Python, C++ AxoGraph file input/output code from AxoGraph Scientific (placed in the public domain; a modified version is included with the project source code), Cython, and many others. Thanks also to Dr. Hillel Chiel for providing testing and helpful suggestions.

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

axographio-0.3.0.tar.gz (59.2 kB view details)

Uploaded Source

Built Distributions

axographio-0.3.0-cp36-cp36m-win_amd64.whl (95.7 kB view details)

Uploaded CPython 3.6m Windows x86-64

axographio-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl (126.6 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

axographio-0.3.0-cp27-cp27m-win_amd64.whl (98.4 kB view details)

Uploaded CPython 2.7m Windows x86-64

axographio-0.3.0-cp27-cp27m-macosx_10_6_x86_64.whl (128.2 kB view details)

Uploaded CPython 2.7m macOS 10.6+ x86-64

File details

Details for the file axographio-0.3.0.tar.gz.

File metadata

  • Download URL: axographio-0.3.0.tar.gz
  • Upload date:
  • Size: 59.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for axographio-0.3.0.tar.gz
Algorithm Hash digest
SHA256 67646abc65e3a00fc667fe4f2b2de8444b8972f67755fb3740bd576a4096214a
MD5 87adf2e021132d3e5d7875e9b49ce9cb
BLAKE2b-256 c93692cd0042b6eb3361e7b952b5fcd57a868d8ad64bde4dddb1bd1a64f78ae7

See more details on using hashes here.

Provenance

File details

Details for the file axographio-0.3.0-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for axographio-0.3.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 fe8e3d6aac5b65c141c5abc9bbb307ff92655ad204089fde2450830f2fa61ea6
MD5 df36f3b20ccb661f52843dbd16ed262e
BLAKE2b-256 4474efe6245372013ea29ecb2a78fd0f0da58a626feb7a3b39c9ca099373d8f7

See more details on using hashes here.

Provenance

File details

Details for the file axographio-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for axographio-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 07b45c83dbdf7b44ef2e0d3b90e7f3e4f8afcb47b05d704c1b589850ae45a985
MD5 9125719d948759aeb72dfdf426d9d844
BLAKE2b-256 d8b1739ecc739c3a7d7527f89dfc33373cae0561f5b5721b6384b574ec0df714

See more details on using hashes here.

Provenance

File details

Details for the file axographio-0.3.0-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for axographio-0.3.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 263f3e10819ecd78daae5071c2c93ad566a404e42bbf5bbb815fd01d080a7699
MD5 7c1f9f64c22b55360da073c3b1048bfe
BLAKE2b-256 ed515004cb7d36e9b20bce05d90d4913067651e158eb21814dbec2cc3d14208a

See more details on using hashes here.

Provenance

File details

Details for the file axographio-0.3.0-cp27-cp27m-macosx_10_6_x86_64.whl.

File metadata

File hashes

Hashes for axographio-0.3.0-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 92627e507b79c539b6d6ef7d6bfb913b3a7d97aa1c771280d939989a89de6cb4
MD5 d6f1424c6eb1cb9c3e4ee9965ac6e37c
BLAKE2b-256 837697eac519630e8fec9a05593262e3b8fa419fc98fe8649d35d15f9d5cea45

See more details on using hashes here.

Provenance

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