On Tue, 2008-03-18 at 14:50 -0700, Ashish Mahabal wrote: > How does one put a circular aperture on an image in order to measure flux > within it?
Hi Ashish, a quick way of doing this is to first extract a patch, $p, that includes the object. Assuming then that you want to put an aperture centred on ($x,$y) with radius $r, you can do the following, my ($xx,$yy) = ($p->xvals,$p->yvals); $xx -= $x; $yy -= $y; my $R = sqrt( $xx*$xx + $yy*$yy ); my ($xi,$yi) = whichND($R <= $r); my $flux = $p->index2d($ix,$iy)->sum; > How do I collect the "background" by using a larger aperture (say 17) and > excluding the earlier aperture (i.e. an annulus)? To do it for an annulus between $r1 and $r2 you can use my ($xi,$yi) = whichND( ($R<=$r2) * ($R>=$r1) ); and then apply your favorite algorithm to estimate the sky. Note though that you may run into problems with fractional pixels at the edge of $r, depending on how much flux remains at this radius. One quick way around this is to rebin the patch (i.e. scale it up), do your aperture photometry, and then scale it back. This is probably not a good approach if you're doing photometry of thousands of objects though... Cheers, Rahman _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
