Tuesday, June 21, 2011

Aperture Photometry

Hello!
More coding today:

aper_phot.py:
-It calculates the flux of a star (or other object) centered at a pixel, taking into an estimated background flux. It makes use of the makecirc.py file I created earlier.

aper_phot(data,xc,yc,rad=5,ann_in=8,ann_out=10)
data: data array that you want to calculate the flux from
xc,yc: center x and y coordinates of pixel (essentially an array element)
rad: aperture radius
ann_in, ann_out: inner and outer annulus radius, respectively


Annulus refers to a ring around the object that ideally contains only background light from the sky. The aperture is the "size" of the object.

For example:
>>> from numpy import*
>>> import aper_phot
>>> b=arange(49).reshape(7,7)
>>> aper_phot.aper_phot(b,3,3,2,4,5)
array([[  0.,   0.,   0.,   0.,   0.,   0.,   0.],
       [  0.,   0.,   0., -14.,   0.,   0.,   0.],
       [  0.,   0.,  -8.,  -7.,  -6.,   0.,   0.],
       [  0.,  -2.,  -1.,   0.,   1.,   2.,   0.],
       [  0.,   0.,   6.,   7.,   8.,   0.,   0.],
       [  0.,   0.,   0.,  14.,   0.,   0.,   0.],
       [  0.,   0.,   0.,   0.,   0.,   0.,   0.]])


I'm also starting to use emacs as my main Python code editor.


Learned:
-Roughly how aperture photometry works
-Basic emac commands.
Problems:
-setfig still doesn't work correctly. I'm leaving it as it is for now.
To-Do:
-My next big ... subproject is to create a class file that handles images (fits files). I'm saving this class in aper_phot.py, and generally whatever function I need that has to do with aperture photometry will go into this file. 

No comments:

Post a Comment