Example #1
0
		if (int(config.KEEP_TMP_FILES)==0):utils.removeCAT(frameCounter)
		
		objects = utils.rejectBadObjects(objects)
		
		updateMasterObjectList(objects, frameInfo.getWindow(j))
	
		debug.write("Total objects in this window:" + str(len(objects)))


	
averageFrames = []	
normalisedImages = []
for j in range(frameInfo.numWindows):
	averageFrame = numpy.divide(summedFrames[j], frameCounter)
	averageFrames.append(averageFrame)
	normalisedImage = utils.percentiles(averageFrame, 25, 99)
	normalisedImages.append(normalisedImage)

	
# Construct full frame from Windows
fullFrame = numpy.zeros((frameInfo.nxmax, frameInfo.nymax))
for j in range(frameInfo.numWindows):
	xll = frameInfo.getWindow(j).xll 
	yll = frameInfo.getWindow(j).yll 
	xsize = frameInfo.getWindow(j).xsize 
	ysize = frameInfo.getWindow(j).ysize 
	rotatedImage = numpy.flipud(normalisedImages[j])
	fullFrame[xll:xll+xsize, yll:yll+ysize] = fullFrame[xll:xll+xsize, yll:yll+ysize] + rotatedImage
	
fullFrame = numpy.fliplr(fullFrame)
	
Example #2
0
					
				FITSHeaders.append(FITSHeader)
		
				print "keyword: ", FITSHeader['keyword'], " value: ", FITSHeader['value'], " comment: ", FITSHeader['comment']
				
	headFile.close()
	
	FITSInputhdulist = astropy.io.fits.open(fitsFilename)
	
	print FITSInputhdulist.info()
	
	print FITSInputhdulist[0].data	
	imageData = FITSInputhdulist[0].data
	
	if imagePreview:
		imgplot = plt.imshow(utils.percentiles(imageData, 20, 98), cmap='gray', interpolation='nearest')
		plt.show()

	print "Doing some more stuff"
	FITSInputhdulist.close()
	
	debug.write("Writing FITS file: " + outputFilename, level=1)
	
	prihdr = astropy.io.fits.Header()
	prihdr['COMMENT'] = "This file created by makefits.py from the Ultracam pipeline."
	prihdr['OBJECT'] = "KOI-823"
	for h in FITSHeaders:
		print "Adding: ", h["keyword"], ":", h["value"]
		keyword = str(h["keyword"])
		try: 
			prihdr[keyword] = float(h["value"])
Example #3
0
        # Construct full frame from Windows
        fullFrame = numpy.zeros((frameInfo.nxmax, frameInfo.nymax))

        for j in range(frameInfo.numWindows):

            frameImage = frameWindows[j + frameInfo.numWindows * i]
            frameImage = numpy.rot90(frameImage)

            # All windows need to be rotated by 180 degrees before using the Image library to write to png
            xll = frameInfo.getWindow(j).xll
            yll = frameInfo.getWindow(j).yll
            xsize = frameInfo.getWindow(j).xsize
            ysize = frameInfo.getWindow(j).ysize
            rotatedImage = numpy.flipud(frameImage)
            normalisedImage = utils.percentiles(rotatedImage, 10, 98)
            fullFrame[xll : xll + xsize, yll : yll + ysize] = (
                fullFrame[xll : xll + xsize, yll : yll + ysize] + normalisedImage
            )

        fullFrame = numpy.fliplr(fullFrame)

        imgData = fullFrame
        imgSize = numpy.shape(imgData)
        imgLength = imgSize[0] * imgSize[1]
        testData = numpy.reshape(imgData, imgLength, order="F")
        img = Image.new("L", imgSize)
        img.putdata(testData)

        if colour == "b":
            if (frameCounter % rdat.nblue) != 0:
Example #4
0
			summedFrame = numpy.zeros((width, height))
			summedFrames.append(summedFrame)
		firstFrame = False
			
	for j in range(frameInfo.numWindows): 
	
		frameImage = numpy.copy(frameWindows[j])
		utils.createFITS(frameCounter, frameImage)
		utils.runSex(frameCounter)
							
		summedFrame = summedFrames[j]
		summedFrame = numpy.add(summedFrame, frameImage)
		summedFrames[j] = summedFrame

		if mplPreview==True:
			imgplot = plt.imshow(utils.percentiles(frameImage, 20, 98), cmap='gray', interpolation='nearest')
			plt.draw()
		
		print "Window info:", frameInfo.getWindow(j)
			
		if (int(config.KEEP_TMP_FILES)==0):utils.removeFITS(frameCounter);
		
		objects = utils.readSexObjects(frameCounter)
		
		if (int(config.KEEP_TMP_FILES)==0):utils.removeCAT(frameCounter)
		
		objects = utils.rejectBadObjects(objects)
		
		updateMasterObjectList(objects, frameInfo.getWindow(j))
	
		debug.write("Total objects in this window:" + str(len(objects)))