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()

### Also get the proper names
properName = []
for ll in allObjList:
    properName.append(aries.getProperNameForAllObjFile(ll))

## Now change to the night directory
os.chdir(nightPath)
## List all files in that directory
allFiles = os.listdir(nightPath)

## Copy a fresh bad pixel map
## Note: we are ignoring bad pixel maps for now
makeNewBPM = False
if makeNewBPM == True:
    if os.path.exists("BPM1.fits"):
        os.system("rm -f BPM1.fits")
    os.system("cp " + ao.pipelineReductionDir + "blankBPM1.fits ./BPM1.fits")

allNights = aries.framesForNights.keys()
nightlyFilterDict={}
for nn in allNights:
	nightlyFilterDict[nn]=[]


##### Read in the object(s) used in step5
if os.path.exists("usingObjLists.txt"):
	data = open("usingObjLists.txt","r")
	useObjList = []
	properName = []
	lines = data.readlines()
	for line in lines:
		objList = line.rstrip()
		useObjList.append(objList)
		properName.append(aries.getProperNameForAllObjFile(objList))
	print "Using object lists:",useObjList
else:
	sys.exit("I don't know what objects to analyze. Please run step5-objects.py")


######################## Individual settings for objects for this script ########################
### How much is too big for the FWHM (in pixels)?
rejectFWHMover={}
rejectFWHMover["WASP-1b","Ks"] = 15.
rejectFWHMover["WASP-2b","Ks"] = 25. ## TERRIBLE image quality, both stars elongated
rejectFWHMover["K00174","Ks"] = 30. ## Binary, but seeing is never good
rejectFWHMover["K00341","Ks"] = 20. 
rejectFWHMover["K00555","Ks"] = 25.
rejectFWHMover["K00638","Ks"] = 10. ## Lots of frames, mostly 7-9 fwhm
rejectFWHMover["K00700","Ks"] = 40. ## Crummy but very few frames