def get_summary_data( filename, whiskers, trajectories ): if os.path.exists(filename): data = numpy.load(filename) else: data = array(list( summary.features(whiskers) )) numpy.save( filename, data ) return data return summary.commit_traj_to_data_table( trajectories, data )
if not all( map( os.path.exists, args )): raise IOError, "Could not find one or more input source files." if all(map( lambda f: os.path.splitext(f)[-1] in ['.trajectories','.whiskers'], args )): if len(args)==1: src = args[0] tfile = None else: src = args[1] #know the order b.c. already sorted by file extenstion tfile = args[0] w = trace.Load_Whiskers( src ) data = numpy.array(list( summary.features(w, options.face) )) if tfile: t,tid = load_trajectories( tfile ) summary.commit_traj_to_data_table( t, data ) elif all(map( lambda f: os.path.splitext(f)[-1] in ['.trajectories','.measurements'], args )): sources = dict( map( lambda f: (os.path.splitext(f)[-1], f), args ) ) try: data = traj.MeasurementsTable( sources['.measurements'] ).asarray() except KeyError: raise UserException, "A .measurements file must be provided as one of the source files." try: t,tid = load_trajectories( sources['.trajectories'] ) summary.commit_traj_to_data_table( t, data ) except KeyError: pass
if all( map( lambda f: os.path.splitext(f)[-1] in ['.trajectories', '.whiskers'], args)): if len(args) == 1: src = args[0] tfile = None else: src = args[ 1] #know the order b.c. already sorted by file extenstion tfile = args[0] w = trace.Load_Whiskers(src) data = numpy.array(list(summary.features(w, options.face))) if tfile: t, tid = load_trajectories(tfile) summary.commit_traj_to_data_table(t, data) elif all( map( lambda f: os.path.splitext(f)[-1] in ['.trajectories', '.measurements'], args)): sources = dict(map(lambda f: (os.path.splitext(f)[-1], f), args)) try: data = traj.MeasurementsTable(sources['.measurements']).asarray() except KeyError: raise UserException, "A .measurements file must be provided as one of the source files." try: t, tid = load_trajectories(sources['.trajectories']) summary.commit_traj_to_data_table(t, data)