I finally completed my contrast curve method today, but first:

One of the things Professor Johnson told me to do was to compartmentalize my code. If there are recurring actions I'm doing, I should just write a separate function for those actions. So today I redefined some of my original functions. It definitely makes my code look way neater, and will certainly save me a lot of typing later on.

Methods:

def annmask(self,cx,cy,ann_in,ann_out): Creates an annulus of 1's (other points outside annulus are set to zero)

def annulus(self,cx,cy,ann_in,ann_out): Creates an annulus of data (other points outside annulus are set to zero). This function just multiplies the array of 1's from annmask by the data values in the image.

def ann_meanbg(self,cx,cy,ann_in,ann_out): Finds the average bg noise of an annulus. This function uses the values taken from the annulus function and finds the mean of those points.

def ann_stdbg(self,cx,cy,ann_in,ann_out): Finds the standard deviation of brightness values inside an annulus. This function uses the values from the annulus function and finds the standard deviation of those points.

def phot(self,cx,cy,rad=5,ann_in=8,ann_out=10): This function was originally the aper_phot(...) function mentioned in this post: http://exolab-sandra.blogspot.com/2011/06/aperture-photometry.html. It now borrows heavily from the annulus(...) and annmask(...) functions.

Now, back to contrast curves.

def contrastcurve(self,ann_space=0): Returns an array of radii from star (rs) and corresponding sigma for annuli (lim). The annuli are two FWHM's wide and each element in rs is the average of the inner and outer radius of each annulus. ann_space is the space between the aperture and the innermost inner annulus radius.

Example:

Using the same two images we used yesterday (with sim being the cropped image), we have:

>>> sim.contrastcurve()

(array([ 3.43701872, 4.00985518, 4.58269163, 5.15552809,

5.72836454, 6.30120099, 6.87403745, 7.4468739 ,

8.01971036, 8.59254681, 9.16538326, 9.73821972,

10.31105617, 10.88389262]),

array([ 579.53765955, 191.44800124, 124.88768112, 52.21637822,

29.54445459, 12.46020976, 8.8020379 , 6.49041072,

5.61804079, 5.24630489, 4.67690715, 4.30710904,

4.28717292, 4.07445331]))

The first array contains the radii, and the second contains the corresponding sigma for each radius.

__Learned:__

-More about how fitgaussian(...) is defined.

__To-Do:__

-Have fun in Yosemite! (That's right, I'm going on a trip this weekend :D)