Decide what the count means
Use detector coordinates in pixels, with increasing to the right and downward. In one exposure the star contributes photoelectrons in total, and the sky contributes a mean 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 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.
Why repeated exposures differ
Independent photon arrivals produce Poisson counts. A count with mean has variance 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.
Add an aperture and correct the missing light
Write for the fraction of pixel 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 . 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.
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 . 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.
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.