# combine the files print '.... combining the frames' ofile = os.path.join(cwd, 'derived_data', bias) args = (combine, 'list=' + ldisk, 'method=c', 'sigma=2.8', 'careful=yes', 'adjust=b', 'output=' + ofile, 'nodefs') output = subprocess.Popen(args, stdout=subprocess.PIPE, cwd='/tmp', stderr=subprocess.PIPE).communicate()[0].split('\n') print '.... combined file written to',ofile+'.ucm' if len(output) < 3 or output[-3] != 'Finished.': print 'ERROR: "combine" failed with output:' print '\n'.join(output) exit(1) # compute some stats to add to file print '.... computing some stats to store in file -- this can take a while.' lmin,lmax,lmm,lrm,lgrad,rmin,rmax,rmm,rrm,rgrad = Ultra.flist_stats([os.path.join('/tmp',fname) for fname in flist], 2, 2, 3.) modf = ucm.rucm(ofile + '.ucm') modf['Procbias'] = {'comment': 'procbias information', 'type' : ucm.ITYPE_DIR, 'value': None} modf['Procbias.nframe'] = {'comment': 'number of contributing frames', 'type' : ucm.ITYPE_INT, 'value': len(flist)} modf['Procbias.first'] = {'comment': 'first contributing frame', 'type' : ucm.ITYPE_INT, 'value': first} modf['Procbias.last'] = {'comment': 'last contributing frame', 'type' : ucm.ITYPE_INT, 'value': last} modf['Procbias.lmid'] = {'comment': 'mid-ranges of mean values of left-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': (lmin+lmax)/2.} modf['Procbias.lmean'] = {'comment': 'means of mean values of left-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': lmm} modf['Procbias.lrng'] = {'comment': 'ranges of mean values of left-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': lmax-lmin} modf['Procbias.lrms'] = {'comment': 'means of RMSs of left-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': lrm} modf['Procbias.lgrad'] = {'comment': 'gradients of means of left-hand sides of CCDs (counts/frame)', 'type' : ucm.ITYPE_FVECTOR, 'value': lgrad} modf['Procbias.rmid'] = {'comment': 'mid-ranges of mean values of right-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': (rmin+rmax)/2.} modf['Procbias.rmean'] = {'comment': 'means of mean values of right-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': rmm} modf['Procbias.rrng'] = {'comment': 'ranges of mean values of right-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': rmax-rmin} modf['Procbias.rrms'] = {'comment': 'means of RMSs of right-hand sides of CCDs', 'type' : ucm.ITYPE_FVECTOR, 'value': rrm} modf['Procbias.rgrad'] = {'comment': 'gradients of means of right-hand sides of CCDs (counts/frame)', 'type' : ucm.ITYPE_FVECTOR, 'value': rgrad}