Package: axographio
axographiois a Python package that makes it easy to read and write binary
data files in the AxoGraph file format.AxoGraphis 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.Pythonis 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 axographioaxographiois compatible with both Python 2 and Python 3.The easiest way to getaxographiois to install the latest stable version
usingpip, but you can alternatively build it from the source code.Installing the latest stable versionRequirements for installing and runningaxographio:The NumPy package (pip install numpy)Theaxographiopackage contains C++ code that must be compiled.PyPIstores
pre-compiled copies of the package for common platforms (e.g., Python 3 on
64-bit Windows), and these can be installed usingpip.To install the latest stable version, try the following:pip install axographioIf a pre-compiled package is available for your platform onPyPI,pipshould quickly download and install it. If not,pipwill automatically
attempt to build the package from source code. Building the package has
additional requirements. Ifpipfails during building, keep reading.Building from source codeIf you need to build the package because a pre-compiled version is not already
available for your platform onPyPI, or if you just want to try building from
the source code, you will need to meet additional requirements.Requirements for buildingaxographiofrom source code:The NumPy package (pip install numpy)The Cython package, version 0.19 or later (pip installcython>=0.19)A C++ compiler  (e.g., Visual C++ Build Tools from Microsoft on Windows
systems, or Xcode on Mac systems)Ifpipfailed 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
fromGitHub, try the following:pip install git+https://github.com/CWRUChielLab/axographioThis command requiresgit. If you don’t havegit, you can instead
manually download the source fromGitHuband install from your local
directory:pip install C:\wherever-you-put-the-source-codeUsageTry out theBinderdemo for an interactive Python session that requires no
installation or fuss. You can start hackingright now!Loading a data file is as easy as callingread:>>> import axographio
>>>
>>> f = axographio.read('AxoGraph X File.axgx')At this point the variablefwill contain afile_contentsobject 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 OSOf 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 theasarrayfunctions 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 newfile_contentsobject (or use one you loaded earlier), and then callwrite.  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 directoryQuestions and SupportPlease post any questions, problems, comments, or suggestions in theGitHub
issue tracker.Changes0.3.2Re-release of 0.3.1 with version bump to addressissue #80.3.1Modify NumPy’s global print settings only when running tests0.3.0Package test suite can be run usingaxographio.tests.run()Package version can be accessed usingaxographio.__version__Added example Jupyter notebook to source repository (not included with
installation)Updated installation instructionsImproved documentationReorganized source code file structureFixed doctests for NumPy < 1.140.2.0Added compatibility with Python 30.1.1Fixed a rounding error that could create one extra data point in the time
column0.1.0First releaseAcknowledgmentsThis 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.