#!/usr/bin/env python2 ''' Extract data directly. Usage: read.py <input> <output> ''' from lspreader import read from lspreader.misc import dump_pickle; from docopt import docopt; opts = docopt(__doc__,help=True); dump_pickle(opts['<output>'],read(opts['<input>']));
if opts['--x']: dims.append('xi'); if opts['--y']: dims.append('yi'); if opts['--z']: dims.append('zi'); if len(dims)==0: dims=['xi','yi','zi']; #reading in using the reader. frames=rd.read(opts['<input>'], gzip=opts['--gzip']); if opts['--sort']: vprint("sorting..."); frames[:] = [sortframe(frame) for frame in frames]; vprint("done"); #experimental hashing if opts['--firsthash']: d=firsthash(frames[0],dims, removedupes=True); dump_pickle(opts['--firsthash'], d); frames[:] = [addhash(frame,d,removedupes=True) for frame in frames]; elif opts['--hash']: d = readfile(opts['--hash'],dumpfull=True); frames[:] = [addhash(frame,d,removedupes=True) for frame in frames]; #outputting. if opts['--hdf']: import fasteners; output = lambda :hdfoutput(opts['<output>'], frames, opts['--zip']); if opts['--lock']: output = fasteners.interprocess_locked(opts['--lock'])(output); output(); elif not opts['<output>']: for frame in frames: outname = "{}.{}".format(opts['<input>'],frame['step']); if opts['--dir']: