From d243f27dcdb2adc7bc1604457565e28d38e4a4ea Mon Sep 17 00:00:00 2001 From: Jeffrey Gill Date: Wed, 30 May 2018 02:03:50 -0400 Subject: [PATCH] v0.2.0: Python 3 compatibility Updated setup.py docstring and added README --- README.rst | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 81 +++++++++++++++--------------- 2 files changed, 181 insertions(+), 41 deletions(-) create mode 100644 README.rst diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..d8a8218 --- /dev/null +++ b/README.rst @@ -0,0 +1,141 @@ +axographio +========== + +axographio is a Python package that makes it easy to read and write binary data +files in the AxoGraph file format. + +AxoGraph X is a commercial software package used for data acquisition and +analysis that is widely used in electrophysiological research (see +https://axograph.com for more details). While 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 with AxoGraph X. + +Python is a powerful and easy to use general purpose programming language (see +http://python.org for more details). 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. + +Installation +============ + +Preinstallation Requirements +---------------------------- + +* A working Python installation +* The setuptools package +* The NumPy package +* The Cython package + +Note that NumPy takes a bit of work to build, so it may be easiest to install +it from your linux distribution's repository, or use as pre-built package +such as the Scipy Superpack (http://macinscience.org/?page_id=6) for the mac. +Depending on your OS, you may be able to get away with simply typing:: + + sudo easy_install numpy + sudo easy_install Cython + +Installation +------------ + +Once all the preinstallation requirements have been met, you can download and +install axographio using easy_install by typing the following command in a +terminal window:: + + easy_install axographio + +Upgrading +--------- + +If you have an older version of the package installed, you can update it to +the newest version using easy_install with the "-U" flag:: + + easy_install -U axographio + +Usage +===== + +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() + +(The ``plt.show()`` command 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 scipy or numpy 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") + +Questions and Support +===================== + +Please post any questions, problems, comments, or suggestions in the `GitHub +issue tracker `_. + +News +==== + +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. diff --git a/setup.py b/setup.py index 3352e04..0678476 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,24 @@ #!/usr/bin/env python """ -axographio is a library that makes it easy to read and write binary data files -in the AxoGraph file format. +axographio is a Python package that makes it easy to read and write binary data +files in the AxoGraph file format. AxoGraph X is a commercial software package used for data acquisition and analysis that is widely used in electrophysiological research (see -http://axographx.com for more details). While it can read and write files in +https://axograph.com for more details). While 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 with AxoGraph X. Python is a powerful and easy to use general purpose programming language (see -http://python.org for more details). There are many useful python libraries +http://python.org for more details). There are many useful Python libraries available for scientific data analysis and data visualization such as scipy, -matplotlib and MayaVI. +matplotlib and Mayavi. -This library 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 library provides the glue +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. Installation @@ -35,40 +35,32 @@ Note that NumPy takes a bit of work to build, so it may be easiest to install it from your linux distribution's repository, or use as pre-built package such as the Scipy Superpack (http://macinscience.org/?page_id=6) for the mac. -Depending on your OS, you may be able to get away with simply typing: - -:: - - sudo easy_install numpy - sudo easy_install Cython +Depending on your OS, you may be able to get away with simply typing:: + sudo easy_install numpy + sudo easy_install Cython Installation ------------ Once all the preinstallation requirements have been met, you can download and install axographio using easy_install by typing the following command in a -terminal window: - -:: - - easy_install axographio +terminal window:: + easy_install axographio Upgrading --------- If you have an older version of the package installed, you can update it to -the newest version using easy_install with the "-U" flag: - -:: +the newest version using easy_install with the "-U" flag:: - easy_install -U axographio + easy_install -U axographio Usage ===== -Loading a data file is as easy as calling `read`: +Loading a data file is as easy as calling ``read``: >>> import axographio >>> @@ -85,16 +77,16 @@ >>> plt.ylabel(f.names[1]) >>> plt.show() -(The plt.show() command may be optional depending on your OS.) +(The ``plt.show()`` command 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 scipy or numpy array using the asarray functions in these packages, e.g.: ->>> import scipy as sp +>>> import numpy as np >>> ->>> times = sp.asarray(f.data[0]) +>>> 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 @@ -112,17 +104,19 @@ ... [times, column1, column2]) >>> f.write("my60Hz.axgx") - Questions and Support ===================== -Please post any questions, problems, comments, or suggestions on the axographio -group on google groups (http://groups.google.com/group/axographio) - +Please post any questions, problems, comments, or suggestions in the `GitHub +issue tracker `_. News ==== +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 @@ -132,7 +126,6 @@ ----- First release - Acknowledgments =============== @@ -152,8 +145,8 @@ setup( name = "axographio", - version = "0.1.1b1", - setup_requires = ['setuptools_cython', 'numpy'], + version = "0.2.0", + setup_requires = ['cython>=0.19', 'numpy'], ext_modules = [ Extension('axographio', [ 'axographio.pyx', @@ -167,14 +160,20 @@ ], test_suite = 'test_axographio.test_all', # metatdata - author = "Kendrick Shaw", - author_email = "kms15@case.edu", + author = "Kendrick Shaw, Jeffrey Gill", + author_email = "kms15@case.edu, jeffrey.p.gill@gmail.com", license = "BSD License", keywords = ["physiology","electrophysiology","axograph"], - url = "http://code.google.com/p/axographio/", - description = "A python library for reading and writing AxoGraph data files", - classifiers = ["Development Status :: 4 - Beta", "Intended Audience :: Developers", - "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", - "Topic :: Scientific/Engineering :: Bio-Informatics"], + url = "https://github.com/CWRUChielLab/axographio", + description = "A Python package for reading and writing AxoGraph data files", + classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Topic :: Scientific/Engineering :: Bio-Informatics" + ], long_description = __doc__ )