"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__)
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 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)]
+ LOG.setLevel(log_level)
+
+wave = load(options.infile)
+numpy.savetxt(options.outfile, wave['wave']['wData'], fmt='%g', delimiter='\t')
if options.verbose > 0:
- pprint.pprint(bin_info)
- pprint.pprint(wave_info)
+ wave['wave'].pop('wData')
+ pprint.pprint(wave)