[AstroPy] Aperture photometry

Rene Breton superluminique at gmail.com
Thu Apr 14 17:35:54 EDT 2011

The plan is to deliver comparable functionality as the IDL astrolib 
routine. This means been able to perform the aperture photometry from an 
image array, given a list of coordinates, apertures, etc. The actual 
function arguments might be different to make it more modern and the 
algorithms might be improved, if possible.

The aper.pro (http://idlastro.gsfc.nasa.gov/ftp/pro/idlphot/aper.pro) 
routine deals specifically with circular aperture photometry (polygonal 
could eventually be added if someone wants to extend the circular 
aperture one). According to the documentation there are two methods to 
deal with subpixels, a polygonal approximation and an exact calculation. 
Here is the quote:

; /EXACT -  By default, APER counts subpixels, but uses a polygon
; approximation for the intersection of a circular aperture with
; a square pixel (and normalizes the total area of the sum of the
; pixels to exactly match the circular area).   If the /EXACT
; keyword, then the intersection of the circular aperture with a
; square pixel is computed exactly.    The /EXACT keyword is much
; slower and is only needed when small (~2 pixels) apertures are
; used with very undersampled data.

So my idea is also to provide different algorithms. The first is the 
crude aperture, with no subpixel. The second will be the polygonal 
approximation, which is fine in most situations, and last will be the 
exact. I'm still at the stage of taking apart the code and reorganizing 
it so I can't tell much more about the algorithm.


On 11-04-14 05:23 PM, Sergio Pascual wrote:
> It would be great to have routines directly comparable with those from
> Iraf or IDL. What kind of apertures does Astrolib support? How it
> handles subpixel fractions?
> I think there's a lack of information about the algorithms used to
> effectively compute the subpixel fraction in the apertures.
> Regards, Sergio
> 2011/4/14 Rene Breton<superluminique at gmail.com>:
>> Hi Sergio,
>> I'm currently working on porting the IDL astrolib aperture photometry
>> routines to python (which you can find in pyastrolib). I'm not done with
>> them yet. Hopefully it should be done soon as I have some data reduction to
>> perform. I can let you know if you're interested.
>> If you want something more basic for now, have a look at the attached python
>> script. It does the aperture photometry but doesn't handle subpixel
>> contributions. If the radius of your aperture isn't too small it shouldn't
>> be too far off a more careful reduction. I haven't made the script to handle
>> multiple source positions/apertures but this could easily be fixed.
>> Cheers,
>> Rene
>> On 11-04-14 01:18 PM, Sergio Pascual wrote:
>>> Hi
>>> Let's say I have an image as a  numpy array and I want to obtain the
>>> summed values of the array inside an ellipse inside the image. In
>>> other words, I wanto to make aperture photometry. Do you know of any
>>> python astronomy package that implements this. It's a fairly basic
>>> think, but I haven't found anything.
>>> Regards

More information about the AstroPy mailing list