Pick one of the bright stars in Hubble’s photograph of the Hercules Cluster. You can put a finger on its center. Where would you put a finger on the sky behind it? On a detector, light from the star and light from the background have already been added together. Photutils, an open-source Python library for astronomical images, tackles the question with two shapes. A circle collects light around the star. A ring farther out samples the local background. What connects them is the number of usable pixels under the star. [1][2]
A circle on a square grid
Start with a calibrated exposure whose pixels are in counts. A researcher supplies the star’s center and a radius to CircularAperture. Along its rim, the circle cuts across square pixels. With the exact overlap method, a pixel that falls one quarter inside the circle contributes one quarter of its recorded counts. “Exact” describes the geometry. The detector still gives a single reading for that whole pixel. Adding the weighted readings yields the light collected inside the aperture, including the sky’s contribution. [2][3]
To estimate that contribution, the researcher places a CircularAnnulus around the same center, leaving a gap so that the bright part of the star falls inside the ring’s hole. One option in Photutils is to take the median pixel value in the ring after sigma clipping, which discards unusually extreme values. A few bright pixels from a neighboring star can then have little influence. The output has units of counts per pixel. For a sense of the scale, the Space Telescope Science Institute’s tutorial on simulated Roman telescope data uses a three-pixel radius for the star and samples the sky between radii of 20 and 25 pixels. Widening that ring supplies more samples. The area to which the estimate will be applied stays the same. [2][3][5]
The missing pixel
Suppose the ring yields 20 counts per pixel. Inside the circle, the weighted readings add up to 5,900 counts over an effective area of 95 pixels. The sky accounts for an estimated 1,900 counts, leaving 4,000 counts of starlight in the measured area. Those are illustrative numbers. The same calculation works when the effective area has a fractional part. [2]
Now consider why the effective area was 95. Suppose the circle covers 100 pixels’ worth of detector, but a mask excludes five pixels’ worth of bad readings. Using the full area would subtract 2,000 sky counts from a sum that included sky from only 95 pixels. The star would come out 100 counts fainter through bookkeeping alone. Photutils exposes the unmasked, overlap-weighted area as ApertureStats.sumaperarea. Matching the area to the sum fixes the excess sky subtraction. Any starlight that fell on the bad pixels is still missing, a particularly expensive loss if they crossed the star’s bright center. [2][3]
Look again at the photograph. In a crowded patch, even the ordinary-looking pixels in the ring can carry light from neighboring stars. Clipping a few bright peaks leaves their faint outskirts in place. And if two stars share the aperture itself, perfect sky subtraction still leaves the light of both. Photutils offers a different measurement for that situation. Its PSFPhotometry class can fit nearby stars together using a model of how a point of light spreads across the detector. The shape of the blended light then helps estimate each star’s share. That is information a sum inside a circle has already thrown away. [2][4]
Sources
- NASA, “Messier 13,” Hubble photograph and instrument credit.
- Photutils, “Aperture Photometry,” including the worked local-background example.
- Photutils, ApertureStats API reference, pixel weighting, masks and effective area.
- Photutils, “PSF Photometry,” source grouping and simultaneous fitting.
- Space Telescope Science Institute, Roman Notebooks, “Aperture Photometry.”