Skip to main content

light-curve

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.

PyPI version Conda Version testing pre-commit.ci status

Full documentation: light-curve.snad.space

Quick start

pip install 'light-curve[full]'
import light_curve as licu
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 = licu.Extractor(licu.Amplitude(), licu.BeyondNStd(nstd=1), licu.LinearFit())
result = extractor(t, m, err)
print("\n".join(f"{name} = {value:.4f}" for name, value in zip(extractor.names, result)))

# Multi-band: per-band features and cross-band color in one Extractor
band = np.tile(["g", "r"], 50)  # 50 interleaved g/r observations
ext_mb = licu.Extractor(licu.WeightedMean(bands=["g", "r"]), licu.ColorOfMedian(["g", "r"]))
result_mb = ext_mb(t, m, err, band=band)
print(dict(zip(ext_mb.names, result_mb)))

# dm-dt map — 2D histogram of Δmag vs log-Δt for CNN classifiers
dmdt = licu.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 (AstraCLR, Astromer2, ATAT, 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}
}

Metadata

Release files for light-curve 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for light-curve 0.14.0
File Size Uploaded Provenance Actions
light_curve-0.14.0.tar.gz 509.2 kB Without provenance Details for light_curve-0.14.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for light-curve 0.14.0
File Actions
light_curve-0.14.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for light_curve-0.14.0-cp310-abi3-win_amd64.whl
light_curve-0.14.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for light_curve-0.14.0-cp310-abi3-musllinux_1_2_x86_64.whl
light_curve-0.14.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for light_curve-0.14.0-cp310-abi3-musllinux_1_2_aarch64.whl
light_curve-0.14.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for light_curve-0.14.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
light_curve-0.14.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for light_curve-0.14.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
light_curve-0.14.0-cp310-abi3-macosx_15_0_x86_64.whl CPython 3.10 abi3 macOS 15.0+ x86-64 Details for light_curve-0.14.0-cp310-abi3-macosx_15_0_x86_64.whl
light_curve-0.14.0-cp310-abi3-macosx_15_0_arm64.whl CPython 3.10 abi3 macOS 15.0+ ARM64 Details for light_curve-0.14.0-cp310-abi3-macosx_15_0_arm64.whl

Total release size: 118.5 MB

Release files / light_curve-0.14.0.tar.gz

Download URL light_curve-0.14.0.tar.gz
Size 509.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb2103b4a873ae798a8ed9408bd7e9ce45340c36598c3b169545d5ca701aff26
BLAKE2b-256 checksum
How to use checksums
e222e85beaab093f81aae31e85465ba4a1bc63d33d93159304fb9661ec6fc5d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-win_amd64.whl

Download URL light_curve-0.14.0-cp310-abi3-win_amd64.whl
Size 7.3 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
33c20281f580bcf2b9f6945c19293e42167042e86a5cd6a22fb4bd66db9e638a
BLAKE2b-256 checksum
How to use checksums
b5a0f1fc41c82a2bd2eb91a73090455e76ee211426b543222526524d0c18fd43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL light_curve-0.14.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 32.8 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
23b36cd286c0d3134fb3fb920c2b7e2f40ddbe9aef11a8eca0fcbdade65c1cc8
BLAKE2b-256 checksum
How to use checksums
5071ffad3b662f1ad3a07ef5f231fdbdfc617ac12127cc7930bc1f2eb2db8229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL light_curve-0.14.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 8.8 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
6d3a2282d25319ea30f49c4e8531a554e18685ea2880a82d7f5429dfe3a4419d
BLAKE2b-256 checksum
How to use checksums
b5aca2e61011cbc25dbc47759a19643f5e0677e0ffedb03644bf9d473c8a01ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL light_curve-0.14.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 46.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
bb2e265de16f970e65d205d02318799de381e35314650fa0468ae0c0fc018227
BLAKE2b-256 checksum
How to use checksums
1d71cda59def69e9cc95bc2673f4169fca5fb033df5b3b813e906c39691c78a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL light_curve-0.14.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.9 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
7d1d0fdf8ec4c02452ae5c0180f07441465862a61d9cdf0b378a1539020e6c25
BLAKE2b-256 checksum
How to use checksums
7c1015931ed2ceb92936a67aa6533388f830136c91a5361b515da854cab1acc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-macosx_15_0_x86_64.whl

Download URL light_curve-0.14.0-cp310-abi3-macosx_15_0_x86_64.whl
Size 8.5 MB
Tags CPython 3.10 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
5136bcbac0986f1d8b4ac1c8c8dd225a0a9298a3c9cd32ff08eb324851a48b7d
BLAKE2b-256 checksum
How to use checksums
a826acccb7646ac90ac9e55901b6992ddcf641cd6b517301c3bdb0983468377d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / light_curve-0.14.0-cp310-abi3-macosx_15_0_arm64.whl

Download URL light_curve-0.14.0-cp310-abi3-macosx_15_0_arm64.whl
Size 7.2 MB
Tags CPython 3.10 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
5c27671fde376da5935ca7d80ba33ea2fe0fac1d62b5f7571763b9cecc8a56d6
BLAKE2b-256 checksum
How to use checksums
3d3054100239d987a1f7e8bc6c65524a5c7a412f4c04b2c0850897aa98126dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for light-curve 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.14.0 This release

8 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page