NumFiles = sum(NumFiles) print (NumFiles)*expTime/integrationTime,'frames to make' for iSeq in range(len(seqs)): timestampList = timestampLists[iSeq] print timestampList wfn = wvlCalFilenames[iSeq] ffn = flatCalFilenames[iSeq] sunsetDate = sunsetDates[iSeq] for i,ts in enumerate(timestampList): print 'loading',ts obsFn = FileName(run=run,date=sunsetDate,tstamp=ts).obs() ob = ObsFile(obsFn) ob.loadTimeAdjustmentFile(FileName(run=run).timeAdjustments()) index1 = obsFn.find('_') hotPixFn = '/Scratch/timeMasks/timeMask' + obsFn[index1:] if not os.path.exists(hotPixFn): hp.findHotPixels(obsFn,hotPixFn) print "Flux file pixel mask saved to %s"%(hotPixFn) ob.loadHotPixCalFile(hotPixFn,switchOnMask=True) ob.loadWvlCalFile(wfn) ob.loadFlatCalFile(ffn) ob.setWvlCutoffs(wvlLowerCutoff,wvlUpperCutoff) bad_solution_mask=np.zeros((46,44)) bad_count=0; for y in range(46): for x in range(44): if (ob.wvlRangeTable[y][x][1] < wvlUpperCutoff) or (ob.wvlRangeTable[y][x][0] > wvlLowerCutoff): bad_solution_mask[y][x] = 1
for position in ObjPosFile: if iSeq + 1 == position[0]: print "finding aperture and sky masks" guessX = position[1] guessY = position[2] apertureMask = circleAperture(guessX, guessY, radius1) bigMask = circleAperture(guessX, guessY, radius2) skyMask = bigMask - apertureMask # print skyMask[0:20][5:25] for i, ts in enumerate(timestampList): print "loading", ts obsFn = FileName(run=run, date=sunsetDate, tstamp=ts).obs() ob = ObsFile(obsFn) ob.loadTimeAdjustmentFile(FileName(run=run).timeAdjustments()) index1 = obsFn.find("_") hotPixFn = "/Scratch/timeMasks/timeMask" + obsFn[index1:] if not os.path.exists(hotPixFn): hp.findHotPixels(obsFn, hotPixFn) print "Flux file pixel mask saved to %s" % (hotPixFn) ob.loadHotPixCalFile(hotPixFn, switchOnMask=True) ob.loadWvlCalFile(wfn) ob.loadFlatCalFile(ffn) ob.setWvlCutoffs(wvlLowerCutoff, wvlUpperCutoff) bad_solution_mask = np.zeros((46, 44)) bad_count = 0 for y in range(46): for x in range(44): if (ob.wvlRangeTable[y][x][1] < wvlUpperCutoff) or (ob.wvlRangeTable[y][x][0] > wvlLowerCutoff): bad_solution_mask[y][x] = 1