Example #1
0
else:
    print('Run = ' + rdir + ' does not have the form YYYY-MM')
    exit(1)

if os.path.exists(edir) and not os.path.isdir(edir):
    print(edir,'exists but is not a directory; please fix.')
    exit(1)
elif not os.path.exists(edir):
    os.makedirs(edir)
    print('Created directory =',edir)

# get a list of night-by-night directories
ndirs = [d for d in os.listdir(rundir) if os.path.isdir(os.path.join(rundir, d))]
ndirs.sort()

runs = Ultra.load_runs(rdir)

print('Read',len(runs),'runs.')

# look for all runs which match the supplied identifier
matches = {}
for i,run in enumerate(runs):
    if run.pid is None or idtest.match(run.pid):
        matches[run.night + ('%03d' % run.number)] = i

science = dict(matches)

# look for all calibrations that match the runs located
for key,value in science.items():
    rdat = runs[value]
    for i,rcal in enumerate(runs):