Skip to content

light-curve

High-performance time-series feature extraction for astrophysics.

light-curve is a Python/Rust library for extracting features from photometric light curves — fast enough for millions of objects, flexible enough for survey-scale ML pipelines.

Install
pip install 'light-curve[full]'

A

Hand-crafted features

40+ features across 6 categories: statistical, variability & trend, time sampling, Lomb–Scargle periodogram, parametric fits (Bazin, Villar), and multiband. All implemented in Rust for survey-scale throughput.

[0.31, -1.20, 0.84, ...]

ML embeddings

Map raw light curves to dense vectors using pretrained transformer models (Astromer2, ATCAT). Suitable for classification, anomaly detection, and similarity search at scale.

lg Δt Δm

dm-dt maps

2D histograms of Δmag vs log-Δt for all observation pairs — fixed-size image representation for CNN-based variability classifiers.

Quick start

import light_curve as lc
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)

ext = lc.Extractor(lc.Amplitude(), lc.BeyondNStd(nstd=1), lc.LinearFit())
result = ext(t, m, err)
print(dict(zip(ext.names, result)))
# {'amplitude': 0.67, 'beyond_1_std': 0.35, 'linear_fit_slope': 0.010, ...}

Use .many() for batch processing of many light curves with reduced Python–Rust overhead:

light_curves = [(t1, m1, err1), (t2, m2, err2), ...]
amplitudes = lc.Amplitude().many(light_curves)   # shape (N,)