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

Update to use dynamic structure interface.

parent 058cbd20
......@@ -4,14 +4,15 @@
"IBW -> ASCII conversion"
import logging
import optparse
import pprint
import sys
import numpy
from igor import __version__
from igor.binarywave import loadibw
from igor import __version__, LOG
from igor.binarywave import load
p = optparse.OptionParser(version=__version__)
......@@ -22,8 +23,6 @@ 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()
......@@ -34,8 +33,13 @@ if options.infile == '-':
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 > 1:
log_levels = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
log_level = log_levels[min(options.verbose-1, len(log_levels)-1)]
wave = load(options.infile)
numpy.savetxt(options.outfile, wave['wave']['wData'], fmt='%g', delimiter='\t')
if options.verbose > 0:
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