Commit 155a2be2 authored by W. Trevor King's avatar W. Trevor King
Browse files

Split igorbinarywave.py off of Hooke into its own package.

parent ac028327
MANIFEST
build/
dist/
igor.egg-info/
*.pyc
W. Trevor King <wking@tremily.us> <wking@drexel.edu>
[project]
name: igor
vcs: Git
[files]
authors: yes
files: yes
ignored: COPYING, README, .update-copyright.conf, .git*, test/*
[copyright]
short: %(project)s comes with ABSOLUTELY NO WARRANTY and is licensed under the GNU Lesser General Public License. For details, %%(get-details)s.
long: This file is part of %(project)s.
%(project)s is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
%(project)s is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with %(project)s. If not, see <http://www.gnu.org/licenses/>.
igor: Interface for reading binary IGOR files.
Read Igor Binary Waves (.ibw) and ... written by WaveMetrics' IGOR
package.
Installation
============
Packages
--------
Gentoo
~~~~~~
I've packaged `igor` for Gentoo. You need layman_ and my `wtk
overlay`_. Install with::
# emerge -av app-portage/layman
# layman --add wtk
# emerge -av sci-misc/igor
Dependencies
------------
If you're installing by hand or packaging calibcant for another
distribution, you'll need the following dependencies:
=========== ================= ============================
Package Debian_ Gentoo_
=========== ================= ============================
Numpy_ python-numpy dev-python/numpy
Matplotlib_ python-matplotlib dev-python/matplotlib
Nose_ python-nose dev-python/nose
=========== ================= ============================
Installing by hand
------------------
`igor` is available as a Git_ repository::
$ git clone git://tremily.us/igor.git
See the homepage_ for details. To install the checkout, run the
standard::
$ python setup.py install
Usage
=====
See the module docstrings for simple examples.
Testing
=======
Run internal unit tests with::
$ nosetests --with-doctest --doctest-tests igor
Licence
=======
This project is distributed under the `GNU General Public License
Version 3`_ or greater.
Author
======
W. Trevor King
wking@tremily.us
Copyright 2008-2012
.. _layman: http://layman.sourceforge.net/
.. _wtk overlay: http://blog.tremily.us/posts/Gentoo_overlay/
.. _Debian: http://www.debian.org/
.. _Gentoo: http://www.gentoo.org/
.. _NumPy: http://numpy.scipy.org/
.. _Matplotlib: http://matplotlib.sourceforge.net/
.. _Nose: http://somethingaboutorange.com/mrl/projects/nose/
.. _Git: http://git-scm.com/
.. _homepage: http://blog.tremily.us/posts/calibcant/
.. _GNU General Public License Version 3: http://www.gnu.org/licenses/gpl.txt
#!/usr/bin/env python
"IBW -> ASCII conversion"
import optparse
import pprint
import sys
import numpy
from igor import __version__
from igor.binarywave import loadibw
p = optparse.OptionParser(version=__version__)
p.add_option('-f', '--infile', dest='infile', metavar='FILE',
default='-', help='Input IGOR Binary Wave (.ibw) file.')
p.add_option('-o', '--outfile', dest='outfile', metavar='FILE',
default='-', help='File for ASCII output.')
p.add_option('-v', '--verbose', dest='verbose', default=0,
action='count', help='Increment verbosity')
p.add_option('-n', '--not-strict', dest='strict', default=True,
action='store_false', help='Attempt to parse invalid IBW files.')
options,args = p.parse_args()
if len(args) > 0 and options.infile == None:
options.infile = args[0]
if options.infile == '-':
options.infile = sys.stdin
if options.outfile == '-':
options.outfile = sys.stdout
data,bin_info,wave_info = loadibw(options.infile, strict=options.strict)
numpy.savetxt(options.outfile, data, fmt='%g', delimiter='\t')
if options.verbose > 0:
pprint.pprint(bin_info)
pprint.pprint(wave_info)
# Copyright
"Interface for reading binary IGOR files."
__version__ = '0.2'
#!/usr/bin/python
#
# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
#
# This file is part of Hooke.
......@@ -18,13 +16,7 @@
# License along with Hooke. If not, see
# <http://www.gnu.org/licenses/>.
"""igorbinarywave provides pure Python interface between IGOR Binary
Wave files and Numpy arrays.
This is basically a stand-alone package that we bundle into Hooke for
convenience. It is used by the mfp*d drivers, whose data is saved in
IBW files.
"""
"Read IGOR Binary Wave files into Numpy arrays."
# Based on WaveMetric's Technical Note 003, "Igor Binary Format"
# ftp://ftp.wavemetrics.net/IgorPro/Technical_Notes/TN003.zip
......@@ -42,9 +34,6 @@ import types
import numpy
__version__ = '0.1'
class Field (object):
"""Represent a Structure field.
......@@ -570,44 +559,3 @@ def loadibw(filename, strict=True):
def saveibw(filename):
raise NotImplementedError
if __name__ == '__main__':
"""IBW -> ASCII conversion
"""
import optparse
import sys
p = optparse.OptionParser(version=__version__)
p.add_option('-f', '--infile', dest='infile', metavar='FILE',
default='-', help='Input IGOR Binary Wave (.ibw) file.')
p.add_option('-o', '--outfile', dest='outfile', metavar='FILE',
default='-', help='File for ASCII output.')
p.add_option('-v', '--verbose', dest='verbose', default=0,
action='count', help='Increment verbosity')
p.add_option('-n', '--not-strict', dest='strict', default=True,
action='store_false', help='Attempt to parse invalid IBW files.')
p.add_option('-t', '--test', dest='test', default=False,
action='store_true', help='Run internal tests and exit.')
options,args = p.parse_args()
if options.test == True:
import doctest
num_failures,num_tests = doctest.testmod(verbose=options.verbose)
sys.exit(min(num_failures, 127))
if len(args) > 0 and options.infile == None:
options.infile = args[0]
if options.infile == '-':
options.infile = sys.stdin
if options.outfile == '-':
options.outfile = sys.stdout
data,bin_info,wave_info = loadibw(options.infile, strict=options.strict)
numpy.savetxt(options.outfile, data, fmt='%g', delimiter='\t')
if options.verbose > 0:
import pprint
pprint.pprint(bin_info)
pprint.pprint(wave_info)
# Copyright
"igor: interface for reading binary IGOR files."
from distutils.core import setup
import os.path
from igor import __version__
package_name = 'igor'
_this_dir = os.path.dirname(__file__)
setup(name=package_name,
version=__version__,
maintainer='W. Trevor King',
maintainer_email='wking@tremily.us',
url='http://blog.tremily.us/posts/%s/'.format(package_name),
download_url='http://git.tremily.us/?p={}.git;a=snapshot;h=v{};sf=tgz'.format(package_name, __version__),
license='GNU General Public License (GPL)',
platforms=['all'],
description=__doc__,
long_description=open(os.path.join(_this_dir, 'README'), 'r').read(),
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Libraries :: Python Modules',
],
packages=[
'igor',
],
scripts=[
'bin/igorbinarywave.py',
],
provides=['igor (%s)' % __version__],
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment