light-curve¶
High-performance time-series feature extraction for astrophysics.
light-curve is a Python package for analyzing photometric light curves at the scale of millions of objects.
It provides multiple tools for ML pre-processing pipelines as well as 40+ statistical and variability features
for filtering, classification, and catalog analysis.
Feature extractors
40+ features: magnitude and flux statistics, time-series shape descriptors, period extraction, and parametric fits for transients. Supports multi-band light curves and optimized to process 10⁶–10⁹ objects.
ML embeddings
Map raw light curves to dense vectors using pretrained transformer models. Suitable for classification, anomaly detection, and similarity search at different scales
dm-dt maps
2D histograms of Δmag vs log-Δt for all observation pairs, providing a fixed-size image representation for CNN-based variability classifiers.
Quick start¶
import light_curve as lc
from light_curve.embed import Astromer2
import numpy as np
rng = np.random.default_rng(0)
t = np.sort(rng.uniform(0, 100, 100))
m = 15.0 + 0.01 * t + rng.normal(0, 0.1, 100)
err = np.full(100, 0.1)
# Feature extraction
extractor = lc.Extractor(lc.Amplitude(), lc.BeyondNStd(nstd=1), lc.LinearFit())
result = extractor(t, m, err)
# ML embedding with pretrained Astromer2 (downloads on first use)
model = Astromer2.from_hf(output="mean")
embedding = model(t, m).squeeze() # shape (256,)
# dm-dt map for CNN-based variability classifiers
dmdt = lc.DmDt.from_borders(min_lgdt=0, max_lgdt=2, max_abs_dm=1.0, lgdt_size=16, dm_size=16, norm=[])
matrix = dmdt.points(t, m) # shape (16, 16)
Used by¶
Alert brokers
AMPEL, ANTARES, and Fink use light-curve for real-time feature extraction
when classifying on the order of a million alerts per night from the Zwicky Transient Facility
and the Rubin Observatory.
The SNAD team
The SNAD
anomaly-detection group uses light-curve to analyze hundreds of millions of
Zwicky Transient Facility light curves from data releases, powering large-scale analyses
and the public SNAD ZTF Viewer.
Software
Publications
Used in 30+ research publications.
