Tuesday, July 5, 2011

Contrast Curve Plot

Created my contrast curve plot today:

def contrast(flux1,flux2): Finds the difference in magnitude (contrast) between two fluxes. It returns this: -2.5*log10(flux1/flux2). This is not an Image class method; it's a function outside the class inside the phot2.py module.

def plotcontrastcurve(self,ann_space=0,fig=1):  Plots a contrast curve of a star in relation to the radial distance from the star. This method uses the function above. 

>>> from startup import* #This imports a bunch of stuff; most importantly, it creates an array arr from the fits file we're using. 
>>> im=phot2.Image(arr)
>>> sim=im.subplot(21,99,40,40) 
>>> sim.plotcontrastcurve()

Notice that the axes are flipped =] Also, note that I had to crop the original fits array. This is because the original array contains many point sources. In order for plotcontrastcurve(...) to work correctly, we need to crop the image so that it only contains one point sources; otherwise, the fitgaussian(...) function plotcontrastcurve(...) is using won't work correctly. 

-More about classes/inheritance
-There's this neat little function in pylab called gca(). It returns the current axes, or creates a new axes if there isn't one. This means that I can plot and modify axes without making a figure container that messes with my utils.setfig(...) code! 
-Using this code to create a new pair of axes, I then used a function called invert_yaxis() to invert the labels on the y-axes. 
-The subclass I created handles all the header information in the FITS file; however, I would like to access it in the ancestor class in order to title the contrast curve I created with the name of the object. 
-Eventually, I'll have to start making a stand-alone program (I guess what I more accurately mean is one that doesn't require a Python Interpreter to run). This program will allow me to open a FITS image, click on/near a point source, and immediately return a contrast curve and some other information about that point source. 

No comments:

Post a Comment