Beispiel #1
0
    return [fig] + fig.get_axes() + [taus] + [msd, msd_err] if errorbars else [msd]

if __name__=='__main__':
    helpy.save_log_entry(absprefix, 'argv')
    meta = helpy.load_meta(absprefix)
    if args.load:
        datapath = absprefix+'_CORNER'*args.corner+'_POSITIONS.txt'
        helpy.txt_to_npz(datapath, verbose=True, compress=True)
        if args.orient or args.track:
            print 'NOTICE: not tracking, only converting file from txt to npz'
            print '        please run again without `-l` to track/orient'
        sys.exit()

    if args.track or args.orient:
        from scipy.spatial import cKDTree as KDTree
        if args.track != args.orient and helpy.bool_input("Would you like to "
                "simultaneously track and find orientations? (It's faster)\n"):
            args.track = args.orient = True
        if args.orient:
            pdata, cdata = helpy.load_data(absprefix, 'position corner')
        else:
            pdata = helpy.load_data(absprefix, 'position')
        pfsets = helpy.splitter(pdata, ret_dict=True)
        pftrees = { f: KDTree(np.column_stack([pfset['x'], pfset['y']]), leafsize=50)
                   for f, pfset in pfsets.iteritems() }
    if args.track:
        meta.update(track_sidelength=args.side, track_maxdist=args.maxdist,
                track_maxtime=args.giveup, track_stub=args.stub,
                track_cut=args.cut)
        trackids = find_tracks(pdata, maxdist=args.maxdist, giveup=args.giveup,
                               n=args.number, cut=args.cut, stub=args.stub)
        trackids = remove_duplicates(trackids, data=pdata)
Beispiel #2
0
        if first.endswith(']'):
            first, _, args.slice = first[:-1].rpartition('[')
        if os.path.isdir(first):
            first = os.path.join(first, '*.tif')
        filenames = sorted(glob(first))
        if args.slice:
            args.slice = helpy.parse_slice(args.slice, len(filenames))
            filenames = filenames[args.slice]
        filepattern = first
        first = filenames[0]
        argv = 'argv'
    if args.plot > 1:
        if len(filenames) > 10:
            print "Are you sure you want to make plots for all",
            print len(filenames), "frames?",
            args.plot -= not helpy.bool_input()
        if args.plot > 2 and (not args.save or len(filenames) > 2):
            print "Do you want to display all the snapshots without saving?",
            args.plot -= not helpy.bool_input()

    suffix = '_POSITIONS'
    outdir = os.path.abspath(os.path.dirname(args.output))
    if not os.path.exists(outdir):
        print "Creating new directory", outdir
        os.makedirs(outdir)
    if args.output.endswith('.gz'):
        args.gz = 1
        args.output = args.output[:-3]
    if args.output.endswith('.txt'):
        args.output = args.output[:-4]
    if args.output.endswith(suffix):
Beispiel #3
0
        if first.endswith(']'):
            first, _, args.slice = first[:-1].rpartition('[')
        if os.path.isdir(first):
            first = os.path.join(first, '*.tif')
        filenames = sorted(glob(first))
        if args.slice:
            args.slice = helpy.parse_slice(args.slice, len(filenames))
            filenames = filenames[args.slice]
        filepattern = first
        first = filenames[0]
        argv = 'argv'
    if args.plot > 1:
        if len(filenames) > 10:
            print "Are you sure you want to make plots for all",
            print len(filenames), "frames?",
            args.plot -= not helpy.bool_input()
        if args.plot > 2 and (not args.save or len(filenames) > 2):
            print "Do you want to display all the snapshots without saving?",
            args.plot -= not helpy.bool_input()

    suffix = '_POSITIONS'
    outdir = os.path.abspath(os.path.dirname(args.output))
    if not os.path.exists(outdir):
        print "Creating new directory", outdir
        os.makedirs(outdir)
    if args.output.endswith('.gz'):
        args.gz = 1
        args.output = args.output[:-3]
    if args.output.endswith('.txt'):
        args.output = args.output[:-4]
    if args.output.endswith(suffix):
        from glob import glob
        filenames = sorted(glob(first))
        filepattern = first
        argv = 'argv'
    elif len(args.files) > 1:
        filenames = sorted(args.files)
        filepattern = reduce(helpy.str_union, args.files)
        i = sys.argv.index(first)
        argv = filter(lambda s: s not in filenames, sys.argv)
        argv.insert(i, filepattern)
        argv[0] = path.basename(argv[0])
        argv = ' '.join(argv)

    if args.plot and len(filenames) > 10:
        args.plot = helpy.bool_input(
                    "Are you sure you want to make plots for all {} frames?"
                    " ".format(len(filenames)))

    suffix = '_POSITIONS'
    gz = args.gz
    output = args.output
    outdir = path.abspath(path.dirname(output))
    if not path.exists(outdir):
        print "Creating new directory", outdir
        makedirs(outdir)
    if output.endswith('.gz'):
        gz = 1
        output = output[:-3]
    if output.endswith('.txt'):
        output = output[:-4]
    if output.endswith(suffix):