Skip to content

Feature extractors

light_curve provides 40+ hand-crafted feature extractors for astrophysical light curves. All share a common interface: callable objects with .names and .descriptions attributes.

import light_curve as licu
import numpy as np

t = np.array([0.0, 1.2, 3.5, 7.1, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0])
m = np.array([15.1, 15.3, 14.9, 15.0, 15.2, 15.1, 14.8, 15.3, 15.0, 15.1])
err = np.array([0.05] * 10)
band = np.tile(["g", "r"], 5)

ext = licu.Extractor(licu.Chi2Pvar(), licu.BeyondNStd(nstd=1), licu.LinearFit(bands=["g", "r"]))
result = ext(t, m, err, band)
print(dict(zip(ext.names, result)))

Use Extractor to combine multiple features into a single callable, or call each class directly for a single feature. The .many() method processes a list of light curves in batch with reduced Python–Rust overhead.

See the API reference for full signatures, parameters, and equations.


Feature table

Variability

Fast: all 26 features combined ~100 µs on 1,000 observations, single band.

Feature Description Outputs
Amplitude Half peak-to-peak amplitude 1
AndersonDarlingNormal Unbiased Anderson–Darling normality test statistic 1
BeyondNStd Fraction of observations beyond \(n\,\sigma_m\) from \(\langle m \rangle\) 1
Chi2Pvar Probability of variability from the \(\chi^2\) test 1
Cusum Range of cumulative sums 1
Eta Von Neumann \(\eta\) 1
EtaE \(\eta^e\), adapted for unevenly sampled time series 1
ExcessVariance Measure of intrinsic variability amplitude 1
InterPercentileRange \(Q(1-p) - Q(p)\) inter-percentile range 1
Kurtosis Excess kurtosis of magnitude 1
LaflerKinmanStringLength Lafler–Kinman string-length smoothness statistic 1
MaximumSlope Maximum slope between consecutive observations 1
Mean Mean magnitude 1
MeanVariance Standard deviation to mean ratio 1
Median Median magnitude 1
MedianAbsoluteDeviation Median of \(\lvert m_i - \mathrm{median}(m) \rvert\) 1
MedianBufferRangePercentage Fraction of points within \(q \times \mathrm{amplitude}\) of median 1
OtsuSplit Otsu thresholding: bimodality measure (subset means, std devs, fraction) 4
PercentAmplitude Maximum deviation of magnitude from its median 1
PercentDifferenceMagnitudePercentile Ratio of inter-percentile range to median 1
ReducedChi2 Reduced \(\chi^2\) of magnitude measurements 1
Roms Robust median statistic (experimental) 1
Skew Skewness \(G_1\) of magnitude 1
StandardDeviation Standard deviation \(\sigma_m\) of magnitude 1
StetsonK Stetson \(K\) light-curve shape coefficient 1
WeightedMean Inverse-variance weighted mean magnitude 1

Linear trend

Fast: both features combined ~10 µs on 1,000 observations, single band.

Feature Description Outputs
LinearFit Slope, its error, and reduced \(\chi^2\) of the weighted linear fit 3
LinearTrend Slope, its error, and noise level of the unweighted linear fit 3

Time sampling

Fast: all 6 features combined ~5 µs on 1,000 observations, single band.

Feature Description Outputs
Duration Total time span of the light curve 1
MaximumTimeInterval Maximum gap between consecutive observations 1
MinimumTimeInterval Minimum gap between consecutive observations 1
ObservationCount Number of observations 1
TimeMean Mean observation time 1
TimeStandardDeviation Standard deviation of observation times 1

Periodogram

Feature Description Outputs
Periodogram Lomb–Scargle periodogram: period and power of the strongest peaks; supports phase_features to extract features from the phase-folded light curve at the best period ≥2

Non-linear parametric fits (transients, flux only)

Feature Description Outputs
BazinFit Bazin function — 5-parameter rising/falling exponential fit for core-collapse SNe 6
LinexpFit Linexp function — linear-times-exponential fit for core-collapse SNe 5
VillarFit Villar function — 7-parameter Gaussian+plateau fit for SN classification 8

Multiband parametric fit

Feature Description Outputs
RainbowFit Multiband blackbody fit (Russeil+23) — bolometric flux + temperature evolution + SED spectral model 4 to 10+

Multiband

Fast: all 4 features combined ~20 µs on 1,000 observations.

Feature Description Outputs
ColorOfMaximum Difference between maximum magnitudes of two bands 1
ColorOfMedian Difference between median magnitudes of two bands 1
ColorOfMinimum Difference between minimum magnitudes of two bands 1
ColorSpread Population std dev of per-band weighted mean magnitudes 1

Detection-based (experimental)

Feature Description Outputs
FluxNNotDetBeforeFd Number of non-detections (flux) before the first detection 1
MagnitudeNNotDetBeforeFd Number of non-detections (magnitude) before the first detection 1

Meta

Feature Description
Extractor Combine multiple feature extractors into a single callable
Bins Bin a time series, then apply any set of features to each bin