allObjDict = {} allSkiesByExp = {} allDarkDict = {} allDarkTimes = [] allSkyDict = {} nightAndFilterDict = {} for ff in allFiles: ##### First check to make sure we don't include reduced fits files if (ff[-5:] == ".fits") & (ff[-7:] != ".d.fits") & (ff[-9:] != ".red.fits") & (ff[-9:] != ".sub.fits"): ##### A. Target data (all starts with 'q') if ff[0] == "q": exp = gb.cleanse(ao.getStuffFromHeader(nightPath + ff, "EXPTIME")) filt = gb.cleanse(string.replace(ao.getStuffFromHeader(nightPath + ff, "FILTER"), "band", "")) obj = aries.getProperName(ao.getStuffFromHeader(nightPath + ff, "OBJECT")) ## Create dictionary of objects by object, filter if (obj, filt) not in allObjDict.keys(): # print "New object, filter:",obj, filt allObjDict[obj, filt] = [ff] else: allObjDict[obj, filt].append(ff) ## Finally, make list of all frames by filter for each night start = len(base) + 1 end = start + 4 num = int(ff[start:end]) for nn in frameNumbers: if aries.framesForNights[nn][0] <= num <= aries.framesForNights[nn][1]: if (nn, filt) not in nightAndFilterDict.keys(): nightAndFilterDict[nn, filt] = [ff] else:
######################## Pick objects ################### ### List everything with an allObj file in the data directory objectDirListing = os.listdir(nightPath) allObjList = [] allProperNames = [] nn = 0 print "\nThe following object lists are available:" for xx in objectDirListing: if xx.startswith("allObj") & xx.endswith(".txt"): allObjList.append(xx) elems = xx.split("_") name = aries.getProperName(elems[1]) filt = elems[2] allProperNames.append(name) print nn, name, filt nn = nn + 1 ### Now pick which to use print "\n Which objects and filters should be run?" print "1 -- ALL" print "2 -- Kepler objects (K*) ONLY, excluding things named NEAR or FIELD" print "3 -- Non-Kepler objects (not K*) ONLY" print "4 -- Use subset listed in script (copy and paste into step5-objects.py and rerun)" entry = raw_input("Choice (defaults to 1): ") useObjList = [] if entry == "2":
#print "4 -- Use subset listed in script (copy and paste into step5-objects.py and rerun)" #entry = raw_input("Choice (defaults to 1): ") # #useObjList=[] #if entry == "2": # for nn,obj in enumerate(allProperNames): # if ((obj[0]=="K") & (obj.endswith("FIELD")==False) & (obj.endswith("NEAR")==False)): # useObjList.append(allObjList[nn]) #elif entry == "3": # for nn,obj in enumerate(allProperNames): # if ((obj[0]!="K") & (obj.endswith("FIELD")==False) & (obj.endswith("NEAR")==False)): # useObjList.append(allObjList[nn]) #elif entry == "4": # #### Enter your list here # useObjList = ["allObj_K961_Ks.txt", "allObj_K973_Ks.txt", "allObj_K979_Ks.txt"] # #else: # useObjList = allObjList # #print "Using object lists:",useObjList,"\n" # #g = open("usingObjLists.txt","w") #for obj in useObjList: # print >>g,obj #g.close() # ######## Proper names print aries.getProperName("KOI85")