## The shiftlist, object list, and final image are saved in the main folder print "Copying shiftfile" os.system("cp Shiftlist_"+obj+"_"+filt+".txt "+objFilterDir) print "Copying list of frames" os.system("cp "+ff+" "+objFilterDir+ff) print "Copying final image" os.system("cp "+obj+"_"+filt+"_mp.fits "+objFilterDir+obj+"_"+filt+".fits") ## The intermediate steps get saved to a subdirectory print "Copying saved info..." os.system("cp "+obj+"_"+filt+"* "+savedDir) ## Also we should print the FWHM for our target in the combined image finalFrame = obj+"_"+filt+"_mp.fits" os.system("rm -f "+finalFrame+".fullcoo") print "Finding the FWHM for the final frame and exporting to a summary file" ao.findStars(finalFrame, aries.useFWHM, aries.useBkg ,aries.useThresh, extra="") worked = ao.readFullCooAllStars(finalFrame, aries.useFWHM, aries.useBkg, aries.useThresh, interactive=True) while worked[0] != True: useFWHM,useBkg,useThresh, useX, useY, useEdge = worked os.system("rm -f "+finalFrame+".fullcoo") ao.findStars(finalFrame, useFWHM, useBkg, useThresh,extra="") worked = ao.readFullCooAllStars(finalFrame, useFWHM, useBkg, useThresh, numXpixels=useX, numYpixels=useY, ignoreEdgePixels=useEdge, interactive=True) measFWHM, measX, measY = ao.getFWHM(finalFrame, finalFrame+".coo", fwhmType=aries.useFWHM) print obj,measX, measY, measFWHM, eval(measFWHM)*0.02 print >>g, obj,measX, measY, measFWHM, eval(measFWHM)*0.02 g.close()
useBPM = aries.doBadPixelCorr[properName[nn], useNight, filt] except: useBPM = aries.doBadPixelCorr["default"] print "\n Now working on", ff, "using FWHM type", useFwhm allFiles = gb.readListFile(ff) ## Now get centers, fwhm of brightest object (usually the target) shiftListCoords = {} for frame in allFiles: ## get rid of existing .coo files # os.system("rm -f "+frame+".fullcoo") # os.system("rm -f "+frame+".coo") ### find stars if os.path.exists(frame + ".fullcoo"): # worked = aries.readFullCoo(frame,useFWHM,useBkg,useThresh) worked = ao.readFullCooAllStars(frame, useFWHM, useBkg, useThresh) else: ao.findStars(frame, useFWHM, useBkg, useThresh) # worked = aries.readFullCoo(frame,useFWHM,useBkg,useThresh) worked = ao.readFullCooAllStars(frame, useFWHM, useBkg, useThresh) while worked[0] != True: useFWHM, useBkg, useThresh = worked os.system("rm -f " + frame + ".fullcoo") ao.findStars(frame, useFWHM, useBkg, useThresh) # worked = aries.readFullCoo(frame,useFWHM,useBkg,useThresh) worked = ao.readFullCooAllStars(frame, useFWHM, useBkg, useThresh) ### Now that we know where the stars are, we can check the FWHM estimate measFWHM, measX, measY = ao.getFWHM(frame + "//.red.sub", frame + ".coo", fwhmType=useFwhm) print frame + " Measured: X, Y (daophot); X, Y, FWHM (imexam)", worked[1], worked[2], measX, measY, measFWHM if 2 < measFWHM < 50: useFWHM = measFWHM
useList[filt].append(obj) ## Find right fwhm, sigma to use try: targetX, targetY, fwhm = summaryInfo[obj, filt] except: targetX = 0 targetY = 0 fwhm = 10 ### DON'T run if .coo file already exists and overwrite is set to False if (os.path.isfile(image + ".coo")) & (overwrite == False): print "\n", obj, "has exisiting .coo file" worked = ao.readFullCooAllStars( image, fwhm, sigma, thresh, numXpixels=maxX, numYpixels=maxY, ignoreEdgePixels=edgePixels, interactive=False, ) else: print "\n", obj, "will make new .coo file" os.system("rm -f " + image + ".coo") os.system("rm -f " + image + ".fullcoo") ### Now look for the stars in the frame iteratively ao.findStars(image, fwhm, sigma, thresh, extra="", overwrite=True) ### Note! the number of pixels is > 1024 due to combining dithers. In fact, let's just ignore the upper limit worked = ao.readFullCooAllStars( image, fwhm, sigma, thresh, numXpixels=maxX, numYpixels=maxY, ignoreEdgePixels=edgePixels ) # import stars, or loop until conditions improve