Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.What changed since last night?
A survey telescope revisits the same patch of sky again and again. To find what changed, it subtracts an older, deeper reference image from each new image: static stars cancel and anything new or variable stands out. Each change becomes an alert, and software decides which alerts are worth a follow-up. For objects that vary repeatedly, the brightness over time (the light curve) reveals periods, eclipses and outbursts. Gaps in sampling can fool you: a star watched at the same time every night can look as if it varies with the wrong period. The demo folds a light curve at a trial period so you can see this happen.
Time-domain pipelines find supernovae, kilonovae from neutron-star mergers and near-Earth asteroids, and the same subtraction and alert-filtering ideas apply to change detection in Earth observation and to anomaly monitoring in spacecraft telemetry.
- 1. Difference imaging subtracts…
- 2. A light curve is…
- 3. Observing at the same time every night can cause…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Difference imaging. Align the new image to the reference, match their PSFs, scale fluxes and subtract. Alard and Lupton (1998) fit a convolution kernel that blurs the sharper image to match the other; ZOGY (Zackay, Ofek and Gal-Yam 2016) derives the optimal statistic for any two PSFs and gives proper noise maps. Detect on the difference with a matched filter (G6-2).
- Real/bogus. Most candidates are artefacts: subtraction residuals, cosmic rays, bad columns, satellite trails. Small CNNs on image cutouts (new, reference, difference) score them, for example ZTF’s braai (Duev et al. 2019).
- Alert streams. ZTF (Palomar 48-inch telescope, 47-square-degree camera, alerts since 2018) publishes Avro packets over Kafka. Rubin’s LSST will issue up to about 10 million alerts per night, each within about a minute of the exposure. Community brokers filter and classify the stream: ALeRCE, AMPEL, ANTARES, Babamul, Fink, Lasair and Pitt-Google. Discoveries are reported to the IAU Transient Name Server.
- Light curves. Times are irregular (weather, daylight, seasons); fluxes have heteroscedastic errors; multiple bands are sampled at different times. Work in flux, not magnitudes, near the detection limit (negative fluxes are real measurements).
- Periods. The Lomb–Scargle periodogram (Lomb 1976, Scargle 1982; see VanderPlas 2018) fits a sinusoid at each trial frequency; multiband and multi-term versions exist. Box least squares (Kovács, Zucker and Mazeh 2002) searches for transits. Regular sampling at rate f_s makes f and f ± k f_s indistinguishable (aliases).
- Classification. Features (amplitude, period, colours, rise and decline rates) with random forests, as in ALeRCE’s light-curve classifier, or sequence models on raw light curves (RAPID, Muthukrishna et al. 2019; SuperNNova, Möller and de Boissière 2020); the PLAsTiCC challenge (2018) benchmarked classifiers on simulated LSST data.
- Missions. Kepler (2009–2018) and TESS (since 2018) delivered near-continuous light curves for planet transits; Gaia measures variability across the whole sky.
- 1. ZOGY and Alard–Lupton are methods for…
- 2. Box least squares is designed to find…
- 3. Near the detection limit, analyse light curves in…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.From difference images to periods
Exercise 1.
- Gaussian PSF matching and subtraction.
- The classical Lomb–Scargle periodogram.
- Phase folding.
- A χ² test against a constant light curve.
Practice.
- Check the subtraction: look at difference images around bright stars; dipoles mean misalignment, rings mean PSF mismatch.
- Use the cutout triplet (new, reference, difference) for real/bogus models, and retrain when the instrument or pipeline changes.
- Periodograms: use astropy’s LombScargle with measurement errors; set the frequency grid from the baseline (step about 1/(5T)); check the window function (the periodogram of the sampling alone) for aliases.
- Validate periods by folding and by checking f ± 1 cycle per day; report a false-alarm probability.
- Brokers: subscribe to filtered streams (for example Fink or Lasair filters) rather than the raw firehose.
import numpy as np
from astropy.timeseries import LombScargle, BoxLeastSquares
ls = LombScargle(t, flux, flux_err) # t in days
freq, power = ls.autopower(minimum_frequency=0.03, maximum_frequency=5, samples_per_peak=10)
best = freq[np.argmax(power)]
print(1 / best, ls.false_alarm_probability(power.max()))
window = LombScargle(t, np.ones_like(t), fit_mean=False, center_data=False).power(freq) # aliases of the sampling
bls = BoxLeastSquares(t, flux, flux_err).autopower(0.1) # transit search with a 0.1-day duration- 1. Dipoles in a difference image indicate…
- 2. The window function reveals…
- 3. A frequency-grid step of about…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
PSF matching. For Gaussian PSFs, convolving a reference of width σ_r with a Gaussian of width √(σ_n² − σ_r²) gives exactly the new image’s PSF. Without matching, each star leaves a residual: positive wings and a negative core when the new image is blurrier. Its size scales with the star’s flux, so bright stars create many spurious detections and can bury real transients nearby.
Lomb–Scargle. At each frequency ω the periodogram is the reduction in squared residuals from fitting y = a cos ω(t − τ) + b sin ω(t − τ). The offset τ, defined by tan 2ωτ = Σ sin 2ωt / Σ cos 2ωt, makes the two terms orthogonal. With uniform sampling it reduces to the classical periodogram of the DFT (A10-3).
Aliasing. If all samples fall at t = integer days + ε, then cos(2π(f + 1)t) ≈ cos(2πft + 2πt) and the extra phase 2πt is a whole number of cycles. Frequencies f and f ± 1 cycle per day fit equally well. Small jitter ε breaks the tie only weakly, while spreading visits over hours of the night breaks it strongly.
Resolution and false alarms. The peak width is about 1/T for baseline T, so periods are known to about P²/T. Searching many independent frequencies raises the chance that noise produces a tall peak (a look-elsewhere effect), so the false-alarm probability must account for the number of trial frequencies.
- 1. The PSF-matching kernel width for Gaussian PSFs:
- 2. Daily sampling makes f indistinguishable from…
- 3. Period precision over baseline T is about…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How much do PSF matching and observing cadence matter for finding transients and periods?
History.
- N. Lomb (1976) and J. Scargle (1982) introduced the periodogram for unevenly sampled data.
- C. Alard and R. Lupton, “A method for optimal image subtraction” (1998).
- B. Zackay, E. Ofek and A. Gal-Yam, “Proper image subtraction” (ZOGY, 2016).
- E. Bellm et al., “The Zwicky Transient Facility: system overview, performance, and first results” (2019).
Exercise 2. Part A: a 128 × 128 field with 150 stars (300 to 30000 e). A deep reference (PSF σ 1.2 px, noise 1 e) and a new image in worse seeing (σ 1.8 px, noise 3 e) with 12 injected transients at SNR 10. The difference image is searched with a matched filter at 5σ, with and without PSF matching.
Part B: 24 sinusoidal variables (periods 0.2 to 20 days, amplitude 0.1 mag, noise 0.03 mag) over 200 nights, analysed with Lomb–Scargle from 0.03 to 4 cycles per day. Three cadences: 100 visits at the same clock time ± 30 min; 100 visits spread over ± 4 h; 30 visits at the same clock time. A period counts as recovered within 1%, and as a daily alias if it is off by 1 or 2 cycles per day.
| subtraction | transients found (of 12) | false detections |
|---|---|---|
| naive | 5 | 361 |
| PSF-matched | 12 | 0 |
| cadence | periods recovered | daily aliases |
|---|---|---|
| 100 visits, same clock time | 0.625 | 0.292 |
| 100 visits, spread over the night | 0.958 | 0.042 |
| 30 visits, same clock time | 0.417 | 0.458 |
- PSF matching is not optional: residuals around 150 stars covered much of the field and hid more than half of the transients.
- Cadence beats count: with the same 100 visits, spreading them across the night lifted recovery from 0.63 to 0.96. With 30 visits, almost half the stars landed on an alias.
- Seeds 1 and 2: naive subtraction gave 343 and 344 false detections (4 and 6 transients found); PSF-matched found 11 and 12 with no false detections. Recovery was 0.79 and 0.79 at fixed clock time, 0.92 and 1.0 when spread, and 0.38 and 0.33 for the sparse cadence.
- Caveat: only 24 stars per cadence (expect ±0.1 between seeds), pure sinusoids, one band; real surveys mix bands and need multi-term or multiband periodograms.
Time-domain imaging in AI, robotics and aerospace
- Multi-messenger astronomy: the kilonova AT2017gfo, found after the neutron-star merger GW170817, showed how fast follow-up depends on rapid subtraction and filtering.
- Planetary defence: moving-object pipelines link detections across nights into orbits and report them to the Minor Planet Center; difference images are where asteroids first appear.
- Earth observation: the same reference-subtraction and alert logic drives change detection for floods, fires and construction (G5-7).
- ML in production: real/bogus CNNs and broker classifiers must be retrained when the instrument changes, and their scores must be calibrated across very imbalanced classes.
References
- N. Lomb (1976). “Least-squares frequency analysis of unequally spaced data.” Astrophysics and Space Science 39.
- J. Scargle (1982). “Studies in astronomical time series analysis. II.” ApJ 263.
- J. VanderPlas (2018). “Understanding the Lomb–Scargle periodogram.” ApJS 236.
- G. Kovács, S. Zucker and T. Mazeh (2002). “A box-fitting algorithm in the search for periodic transits.” A&A 391.
- C. Alard and R. Lupton (1998). “A method for optimal image subtraction.” ApJ 503.
- B. Zackay, E. Ofek and A. Gal-Yam (2016). “Proper image subtraction: optimal transient detection, photometry, and hypothesis testing.” ApJ 830.
- E. Bellm et al. (2019). “The Zwicky Transient Facility: system overview, performance, and first results.” PASP 131.
- D. Duev et al. (2019). “Real-bogus classification for the Zwicky Transient Facility using deep learning.” MNRAS 489.