Feature extractor from noisy time series
Project description
light-curve processing toolbox for Python
A Python wrapper for the light-curve-feature and
light-curve-dmdt Rust crates, providing high-performance
time-series feature extraction for astrophysics.
Full documentation: light-curve.snad.space
Quick start
pip install 'light-curve[full]'
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)
# Statistical and variability feature extraction
extractor = lc.Extractor(lc.Amplitude(), lc.BeyondNStd(nstd=1), lc.LinearFit())
result = extractor(t, m, err)
print('\n'.join(f"{name} = {value:.4f}" for name, value in zip(extractor.names, result)))
# dm-dt map — 2D histogram of Δmag vs log-Δt for CNN 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)
print(f"dm-dt map shape: {matrix.shape}") # (16, 16)
Embed the light curve with a pretrained Astromer2 transformer (model downloads on first use):
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)
model = Astromer2.from_hf(output="mean") # cached after first download
embedding = model(t, m).squeeze() # shape (256,)
print(f"Embedding shape: {embedding.shape}")
The package provides:
- 40+ feature extractors — amplitude, period, variability indices, parametric fits, and more. See the Features docs for a full list.
- ML embeddings — embed light curves with pretrained ONNX models (Astromer2, ATCAT). See the Embeddings docs.
- dm-dt maps — 2D histograms of Δm vs log-Δt for CNN input. See the dm-dt docs.
Installation
pip install 'light-curve[full]'
# or
conda install -c conda-forge light-curve-python
The full extra installs optional Python dependencies required by some features
(iminuit, scipy).
Binary wheels are available for Linux (x86-64, aarch64), macOS, and Windows. For the full platform support table and build-from-source instructions, see the Installation docs.
Developer guide
Prepare environment
Install a recent Rust toolchain and Python 3.10+.
Use rustup to install Rust and keep it updated with rustup update.
Clone the repository, then create and activate a virtual environment:
git clone https://github.com/light-curve/light-curve-python.git
cd light-curve-python/light-curve
python3 -m venv venv
source venv/bin/activate
Install the package in editable mode:
python -mpip install maturin
maturin develop --group dev
Run this command on initial setup. On subsequent runs, activate the environment with
source venv/bin/activate and rebuild Rust code with maturin develop.
Python-only changes require no rebuild.
Install pre-commit hooks:
pre-commit install
Run tests
python -mpytest
Benchmarks are disabled by default; enable them with --benchmark-enable.
Citation
If you found this project useful for your research, please cite Malanchev et al., 2021:
@ARTICLE{2021MNRAS.502.5147M,
author = {{Malanchev}, K.~L. and {Pruzhinskaya}, M.~V. and {Korolev}, V.~S. and {Aleo}, P.~D. and {Kornilov}, M.~V. and {Ishida}, E.~E.~O. and {Krushinsky}, V.~V. and {Mondon}, F. and {Sreejith}, S. and {Volnova}, A.~A. and {Belinski}, A.~A. and {Dodin}, A.~V. and {Tatarnikov}, A.~M. and {Zheltoukhov}, S.~G. and {(The SNAD Team)}},
title = "{Anomaly detection in the Zwicky Transient Facility DR3}",
journal = {\mnras},
keywords = {methods: data analysis, astronomical data bases: miscellaneous, stars: variables: general, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Solar and Stellar Astrophysics},
year = 2021,
month = apr,
volume = {502},
number = {4},
pages = {5147-5175},
doi = {10.1093/mnras/stab316},
archivePrefix = {arXiv},
eprint = {2012.01419},
primaryClass = {astro-ph.IM},
adsurl = {https://ui.adsabs.harvard.edu/abs/2021MNRAS.502.5147M},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file light_curve-0.12.5.tar.gz.
File metadata
- Download URL: light_curve-0.12.5.tar.gz
- Upload date:
- Size: 449.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bbece679e6e8c1fe41aa07d71461aab75eb18d50aeef80446b5ac9ec680cf72
|
|
| MD5 |
701864dd084d46c768b774210bcdb447
|
|
| BLAKE2b-256 |
603297df1cdc352cad8d603ab81da41e8fa22c81a41031a92dde939c09651fa7
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbbe4b95b45e8d78de23225b55b1b6244503b5ddf3c6eb4f5664f8650c46e416
|
|
| MD5 |
e2005068b008fd18d8dfe7b1f1b19d45
|
|
| BLAKE2b-256 |
f58a7af7b5db45a6de3e452d5ea359ae41f0ccea72d4992fe594ab4d14ec55ac
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 31.8 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f71e55f2ccf1e7430e69bde52a5dd471d67d5d69e32e29f8084e32d4db7225f0
|
|
| MD5 |
1a702a0e55654e515d7afa3b6a39722d
|
|
| BLAKE2b-256 |
f48611b2c7b6d0fd40755f978427d8d7318ae726cf4612f81f8e5375fea5b546
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 8.0 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d363bd5494bb89d1e00b31dcb6d26b41d3828d1929fcb07e2719640e7206df86
|
|
| MD5 |
48607d628f119b6ac8f67f8215ca2e95
|
|
| BLAKE2b-256 |
95a054c5426b5c22bf8cfc9891d7ea76532afde3645f3a9d1eb0b2afdde23a07
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 45.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ce44f8ccbf564101cf06b367e3d9bdbafda9a425e4c131c882da8f11c01591e
|
|
| MD5 |
35cd0952bd871a276991bccdf3529384
|
|
| BLAKE2b-256 |
35afe3f12f11a5af2876b8e82c5391b5ef41ef73faf7566e563ca593bae91542
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
- Upload date:
- Size: 6.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b74a14c66d3eefe6f08ac007738a4e7034574a87351ec5057322af9df9bc477
|
|
| MD5 |
f17273068481bc312010f79eeece5776
|
|
| BLAKE2b-256 |
ba31c83e094bf0bbcda593655ba2ee7c31891d151ce619d2101d8dcc1e88aae7
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-macosx_15_0_x86_64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-macosx_15_0_x86_64.whl
- Upload date:
- Size: 7.6 MB
- Tags: CPython 3.10+, macOS 15.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
377e57c7b182ccc3d5ceecfd499e1fc6efdb0a2b664dce3b3af92a397df37805
|
|
| MD5 |
30b599b684a50f1640a055661b44d69c
|
|
| BLAKE2b-256 |
90160f251eca907fde328045f76849ebf77f962e08bb07d41a5e5b3970089c0f
|
File details
Details for the file light_curve-0.12.5-cp310-abi3-macosx_14_0_arm64.whl.
File metadata
- Download URL: light_curve-0.12.5-cp310-abi3-macosx_14_0_arm64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.10+, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5482dcd619375590e099c6fd4aa664eb453bd44653dc50802cffc612179157f4
|
|
| MD5 |
9836a8154d786c76fcecf79b1f11460f
|
|
| BLAKE2b-256 |
34028c99545d706ee1e173fa9b9658072b4412cf82c4fe6f6737c7c5c2869350
|