---
title: "From one photoelectron to an aperture of pixels"
description: "Build a photon-counting model, aperture correction and signal-to-noise estimate, including the background that remains after subtraction."
canonical_url: "https://sandboxphysics.com/stories/stellar-photometry/counting-photons/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/stellar-photometry/counting-photons/"
last_modified: "2026-10-28"
---

[Measure starlight in a crowded sky](https://sandboxphysics.com/stories/stellar-photometry/)

AC02 · L1

# From one photoelectron to an aperture of pixels

Sandbox Physics · 2026-10-28

Photometry begins with adding photoelectrons collected during an exposure. More target light usually makes random scatter less conspicuous. Adding more pixels also collects background and its noise, so a larger circle need not give a better measurement.

## Before you begin

You can add numbers, take a square root and calculate a circle’s area. The chapter introduces expectation, variance and integration. The preceding explainer introduces the stellar image and aperture.

## Decide what the count means

Use detector coordinates in pixels, with $x$ increasing to the right and $y$ downward. In one exposure the star contributes $F$ photoelectrons in total, and the sky contributes a mean $B$ per pixel. Photoelectrons are collected charge carriers. They equal incoming photon counts only for unit quantum efficiency and no other loss.

Brightness can be reported as photoelectrons per exposure or as a rate per second. Exposure time connects the two. The later TESS exercise uses a rate; the browser detector uses counts in one simulated exposure. Keep that distinction when comparing numbers.

Let $P(x,y)$ describe the fraction of light per unit pixel area. Its integral over the whole plane is one. A detector pixel has a finite area, so integrate the profile over its square instead of reading only the value at its center. Think of integration as cutting the square into tiny pieces and adding their contributions.

$$
\iint P(x,y)\,dx\,dy=1,\qquad P_i=\int_{x_i-1/2}^{x_i+1/2}\int_{y_i-1/2}^{y_i+1/2}P(x,y)\,dy\,dx
$$

The integral is a fraction. Multiplication by the total stellar photoelectrons gives the mean stellar count in that pixel.

## Why repeated exposures differ

Independent photon arrivals produce Poisson counts. A count with mean $N$ has variance $N$ as well. Variance measures the average squared departure from the mean; its square root is the standard deviation.

A mean of ten thousand photoelectrons therefore has a photon-noise standard deviation of one hundred, or one percent. A mean of one hundred has a standard deviation of ten, or ten percent. Readout electronics add another noise contribution. Independent contributions add in variance.

$$
\mathbb E[N]=\lambda,\quad\operatorname{Var}(N)=\lambda,\quad\sigma_N=\sqrt\lambda,\qquad\operatorname{Var}(y_i)=FP_i+B+\sigma_{\mathrm{read}}^2
$$

Read noise here is specified as a standard deviation in photoelectrons, so it must be squared. Dark current and flat-field errors are omitted.

## Add an aperture and correct the missing light

Write $w_i$ for the fraction of pixel $i$ covered by the circular aperture. It is one inside, zero outside and intermediate at the edge. Subtract the estimated background, multiply by these weights and add. The same weighted sum of the target profile gives the enclosed fraction $E$. Dividing by that fraction compensates for lost target light.

A centered circular Gaussian provides a useful continuum check. Integrating rings of the profile gives the fraction enclosed within a radius. On a coarse detector, retain the pixel integration and aperture weights; the continuum expression supplies a useful limiting check.

$$
E=\sum_iw_iP_i,\qquad\widehat F=\frac{\sum_iw_i(y_i-\widehat B)}E
$$

Use identical weights in numerator and denominator. An off-center aperture needs its own enclosed fraction.

$$
P(r)=\frac{e^{-r^2/(2\sigma^2)}}{2\pi\sigma^2},\qquad E(<R)=\int_0^R2\pi rP(r)\,dr=1-e^{-R^2/(2\sigma^2)}
$$

Width and radius are both in pixels. Substitution in the radial integral gives the final exponential.

Reading: Photutils 3.1.1, Aperture photometry · TESS Science Data Products Description, Revision F (2020)

## Work through a brightness measurement

Suppose a star contributes ten thousand photoelectrons, of which the aperture collects nine tenths. The aperture contains twenty-five complete pixels. Each has a sky contribution of one hundred electrons and read noise of four electrons. There is no neighbor, and the mean sky is known exactly. The expected aperture total is eleven thousand five hundred. Subtracting two thousand five hundred sky electrons leaves nine thousand; dividing by nine tenths recovers ten thousand.

The variance contains nine thousand stellar electrons, two thousand five hundred background electrons and twenty-five read-noise variances. It is $9000+2500+25\times16=11900$. Its square root is about one hundred nine. Aperture correction gives a flux uncertainty of about one hundred twenty-one and a signal-to-noise ratio of about eighty-two and a half.

Estimating the sky from another region adds uncertainty. Subtracting the same estimated background from every aperture pixel gives their errors a shared contribution.

$$
\operatorname{Var}(\widehat F)=\frac{\sum_iw_i^2\operatorname{Var}(y_i)+(\sum_iw_i)^2\operatorname{Var}(\widehat B)}{E^2}
$$

This assumes the sky estimate comes from an independent region. Correlation with the aperture requires covariance terms. The teaching aperture treats its background input as known.

## Why expanding the circle can hurt

Near the center, new pixels contribute substantial stellar light. Far out, they contribute little target light but still add background noise. A useful radius depends on the profile, the sky and neighboring objects. A fixed radius cannot be best for every image.

Increase the example’s background tenfold and calculate the signal-to-noise ratio again. Then consider an exposure long enough to increase both target and background. Following the contributions separately makes it easier to adapt the method to a different observation.

## Exercises and explanations

1. With photon noise dominant, how much does four times the exposure improve signal-to-noise?

   Read the explanation

   The signal increases fourfold and its Poisson variance also increases fourfold. Standard deviation doubles, so signal-to-noise doubles. This assumes no saturation, changing background or additional systematics.

2. An aperture contains twenty-five pixels. The subtracted background is too high by three electrons per pixel and the enclosed fraction is nine tenths. What is the flux bias?

   Read the explanation

   The sum loses seventy-five extra electrons. Aperture correction gives a bias $-75/0.9\approx-83.3$ electrons. More aperture area accumulates more of the same sky error.

3. Why does subtracting the mean background leave its photon noise?

   Read the explanation

   Subtracting a constant shifts the count distribution without changing its scatter. The extra or missing background photons in each exposure still differ from that mean.

## Try the prediction

### [Isolate the sky contribution](https://sandboxphysics.com/labs/crowded-star-photometry/)

1. Choose A star on its own, keeping aperture and blur fixed.
2. Predict how a brighter sky will change the scatter of the cyan fitted curve, then change the sky setting.
3. Export one pixel record and distinguish expected counts from the noisy measurements.

[Previous: Did the star really fade?](https://sandboxphysics.com/stories/stellar-photometry/whose-light/) [Next: One pixel can contain light from two stars](https://sandboxphysics.com/stories/stellar-photometry/separating-stars/)

## Sources and calculation scope

1. [TESS Science Data Products Description, Revision F (2020)](https://archive.stsci.edu/files/live/sites/mast/files/home/missions-and-data/active-missions/tess/_documents/EXP-TESS-ARC-ICD-TM-0014-Rev-F.pdf)

   Section 4.2.2, Table 8: FLUX is already background-subtracted; FLUX\_BKG and FLUX\_BKG\_ERR preserve the removed estimate. Table 32 describes quality flags.

2. [Photutils 3.1.1, Aperture photometry](https://photutils.readthedocs.io/en/3.1.1/user_guide/aperture.html)

   Fractional aperture weighting, background subtraction and error propagation. The browser uses its own documented midpoint area quadrature.
