Exemple #1
0
	def drawBitmap(self):
		if self.boostedImage is None:
			print "Boosting the image"
			self.boostedImage = generalUtils.percentiles(numpy.copy(self.originalImageData), 20, 99)
		matplotlib.pyplot.ion()
		# mplFrame = numpy.rot90(self.boostedImage)
		mplFrame = self.boostedImage
		mplFrame = numpy.flipud(mplFrame)
		self.figure = matplotlib.pyplot.figure(self.filename, figsize=(self.figSize/1.618, self.figSize))
		self.figure.frameon = False
		self.figure.set_tight_layout(True)
		axes = matplotlib.pyplot.gca()
		axes.set_axis_off()
		self.figure.add_axes(axes)
		imgplot = matplotlib.pyplot.imshow(mplFrame, cmap="gray_r", interpolation='nearest')
		
		verts = []
		for b in self.boundingBox:
			print b
			y, x = self.wcsSolution.all_world2pix(b[0], b[1], 1, ra_dec_order=True)
			coord  = (float(x), float(y))
			print coord
			verts.append(coord)	
			
		verts.append((0, 0))
			
		print verts
		codes = [Path.MOVETO,
		         Path.LINETO,
		         Path.LINETO,
		         Path.LINETO,
		         Path.CLOSEPOLY,
		         ]

		path = Path(verts, codes)

		patch = matplotlib.patches.PathPatch(path, fill=None, lw=2)
		axes.add_patch(patch)
		matplotlib.pyplot.draw()
		matplotlib.pyplot.show(block=False)
		matplotlib.pyplot.draw()
		matplotlib.pyplot.pause(0.01)
    (height, width) = numpy.shape(imageData)

    aspectRatio = float(height) / float(width)
    print(aspectRatio)
    """ Set up the PGPLOT windows """
    imagePlot = {}
    imagePlot['pgplotHandle'] = ppgplot.pgopen('/xs')
    ppgplot.pgpap(paperSize, aspectRatio)
    ppgplot.pgsvp(0.0, 1.0, 0.0, 1.0)
    ppgplot.pgswin(0, width, 0, height)

    # ppgplot.pgenv(0., width,0., height, 1, -2)
    imagePlot['pgPlotTransform'] = [0, 1, 0, 0, 0, 1]

    boostedImage = generalUtils.percentiles(imageData, 20, 99)
    ppgplot.pggray(boostedImage, 0, width - 1, 0, height - 1, 0, 255,
                   imagePlot['pgPlotTransform'])

    # Determine the RA, DEC of the centre of the image, using the WCS solution found in the FITS header
    imageCentre = [width / 2, height / 2]

    ra, dec = wcsSolution.all_pix2world([imageCentre], 1)[0]

    positionString = generalUtils.toSexagesimal((ra, dec))
    print("RA, DEC of image centre is: ", positionString, ra, dec)
    margins = wcsSolution.all_pix2world([[0, 0], [width, height]], 1)
    margins = checkMargins(margins)
    print("ra, dec limits:", margins)

    print("Looking for bright stars")
Exemple #3
0
    (height, width) = numpy.shape(imageData)

    aspectRatio = float(height) / float(width)
    print aspectRatio
    """ Set up the PGPLOT windows """
    imagePlot = {}
    imagePlot['pgplotHandle'] = ppgplot.pgopen('/xs')
    ppgplot.pgpap(paperSize, aspectRatio)
    ppgplot.pgsvp(0.0, 1.0, 0.0, 1.0)
    ppgplot.pgswin(0, width, 0, height)

    # ppgplot.pgenv(0., width,0., height, 1, -2)
    imagePlot['pgPlotTransform'] = [0, 1, 0, 0, 0, 1]

    boostedImage = generalUtils.percentiles(imageData, 20, 99)
    ppgplot.pggray(boostedImage, 0, width - 1, 0, height - 1, 0, 255,
                   imagePlot['pgPlotTransform'])

    # Determine the RA, DEC of the centre of the image, using the WCS solution found in the FITS header
    imageCentre = [width / 2, height / 2]

    ra, dec = wcsSolution.all_pix2world([imageCentre], 1)[0]

    positionString = generalUtils.toSexagesimal((ra, dec))
    print "RA, DEC of image centre is: ", positionString, ra, dec
    margins = wcsSolution.all_pix2world([[0, 0], [width, height]], 1)
    margins = checkMargins(margins)
    print "ra, dec limits:", margins

    xlimits = (0, width)
Exemple #4
0
	mainPGPlotWindow = ppgplot.pgopen(arg.device)	
	ppgplot.pgask(True)
	ppgplot.pgpap(3.0, 1.8)
	# pgPlotTransform = [0, 1, 0, 0, 0, 1]
	spectrum = spectra[0] 
	xScale = (max(spectrum.wavelengths) - min(spectrum.wavelengths)) / xSize
	if hasEphemeris:
		yScale = numPhaseBins
	else:	
		yScale = len(spectra)
		
	pgPlotTransform = [min(spectrum.wavelengths), xScale, 0, 0, 0, 1/float(yScale)]
	lowerWavelength = min(spectrum.wavelengths)
	upperWavelength = max(spectrum.wavelengths)
	ppgplot.pgenv( min(spectrum.wavelengths), max(spectrum.wavelengths), 0, 2, 0, 0)
	ppgplot.pggray(generalUtils.percentiles(trailBitmap, 20, 99), 0, xSize-1 , 0, ySize-1 , 255, 0, pgPlotTransform)
	# ppgplot.pggray(trailBitmap, 0, xSize-1 , 0, ySize-1 , numpy.max(trailBitmap), numpy.min(trailBitmap), pgPlotTransform)
	
	epochs = [s.HJD for s in spectra]
	startHJD = min(epochs)
	endHJD = max(epochs)
	if arg.title is None:
		title = ""
	else: 
		title = arg.title
	if hasEphemeris: 
		# ppgplot.pglab("wavelength [%s]"%spectrum.wavelengthUnits, "Phase", "%s - %s"%(str(startHJD), str(endHJD)))
		ppgplot.pglab("wavelength [%s]"%spectrum.wavelengthUnits, "Phase", title)
	else:
		#ppgplot.pglab("wavelength [%s]"%spectrum.wavelengthUnits, "Spectrum number", "%s - %s"%(str(spectra[0].HJD), str(spectra[-1].HJD)))
		ppgplot.pglab("wavelength [%s]"%spectrum.wavelengthUnits, "Spectrum number", title)
Exemple #5
0
	(height, width) = numpy.shape(imageData)
	
	aspectRatio = float(height)/float(width)
	print aspectRatio
	
	""" Set up the PGPLOT windows """
	imagePlot = {}
	imagePlot['pgplotHandle'] = ppgplot.pgopen('/xs')
	ppgplot.pgpap(paperSize, aspectRatio)
	ppgplot.pgsvp(0.0, 1.0, 0.0, 1.0)
	ppgplot.pgswin(0, width, 0, height)
	
	# ppgplot.pgenv(0., width,0., height, 1, -2)
	imagePlot['pgPlotTransform'] = [0, 1, 0, 0, 0, 1]
	
	boostedImage = generalUtils.percentiles(imageData, 20, 99)
	ppgplot.pggray(boostedImage, 0, width-1, 0, height-1, 0, 255, imagePlot['pgPlotTransform'])
	
	# Determine the RA, DEC of the centre of the image, using the WCS solution found in the FITS header
	imageCentre = [ width/2, height/2]
	
	
	ra, dec = wcsSolution.all_pix2world([imageCentre], 1)[0]
	
	
	positionString = generalUtils.toSexagesimal((ra, dec))
	print "RA, DEC of image centre is: ", positionString, ra, dec
	margins = wcsSolution.all_pix2world([[0, 0], [width, height]], 1)
	margins = checkMargins(margins)
	print "ra, dec limits:", margins
	
    (height, width) = numpy.shape(imageData)

    aspectRatio = float(height) / float(width)
    print (aspectRatio)

    """ Set up the PGPLOT windows """
    imagePlot = {}
    imagePlot["pgplotHandle"] = ppgplot.pgopen("/xs")
    ppgplot.pgpap(paperSize, aspectRatio)
    ppgplot.pgsvp(0.0, 1.0, 0.0, 1.0)
    ppgplot.pgswin(0, width, 0, height)

    # ppgplot.pgenv(0., width,0., height, 1, -2)
    imagePlot["pgPlotTransform"] = [0, 1, 0, 0, 0, 1]

    boostedImage = generalUtils.percentiles(imageData, 20, 99)
    ppgplot.pggray(boostedImage, 0, width - 1, 0, height - 1, 0, 255, imagePlot["pgPlotTransform"])

    # Determine the RA, DEC of the centre of the image, using the WCS solution found in the FITS header
    imageCentre = [width / 2, height / 2]

    ra, dec = wcsSolution.all_pix2world([imageCentre], 1)[0]

    positionString = generalUtils.toSexagesimal((ra, dec))
    print ("RA, DEC of image centre is: ", positionString, ra, dec)
    margins = wcsSolution.all_pix2world([[0, 0], [width, height]], 1)
    margins = checkMargins(margins)
    print ("ra, dec limits:", margins)

    print ("Looking for bright stars")
    brightStars = getBrightStars(ra, dec, 0.5)