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.13.3

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.13.3
File Size Uploaded Provenance
light_curve-0.13.3.tar.gz 505.7 kB Without provenance Details

Built distributions (wheels)

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

Total release size: 116.9 MB

Release files / light_curve-0.13.3.tar.gz

Download URL light_curve-0.13.3.tar.gz
Size 505.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e8883064f577a600c781348be76f097e10595841080ba7b43d2944f3fbcefc56
BLAKE2b-256 checksum
How to use checksums
6a76a28e69fec0d6538920f5e73ed6c95bcca11feb3078effd6bc054db5f703c
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.13.3-cp310-abi3-win_amd64.whl

Download URL light_curve-0.13.3-cp310-abi3-win_amd64.whl
Size 7.0 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
99fe1fe5198e4c8aa70b9cfe0c56cc7aa38b0c8132039277a4a79393cd76eacd
BLAKE2b-256 checksum
How to use checksums
9bcea17bc52c79c2c7269c72add2b3fc9d5ad4f17edc6510a012f4c850012472
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.13.3-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL light_curve-0.13.3-cp310-abi3-musllinux_1_2_x86_64.whl
Size 32.5 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
80cc5e0a5411768f50dc7dcbb4096274cf6620bd98c397aef6af51a6bc017a6b
BLAKE2b-256 checksum
How to use checksums
e52082273563909711529f1838248654479ca948bd2dc7030a0ab716cfe3a116
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.13.3-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL light_curve-0.13.3-cp310-abi3-musllinux_1_2_aarch64.whl
Size 8.6 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
52cb15067ddee267f41f6ab77c6756648781fda9132f3be7058e86ebd1cef5c0
BLAKE2b-256 checksum
How to use checksums
d467021c6c4552261861a16a945a8abbbcca73bc11ae5772bae17ff3e283b715
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.13.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL light_curve-0.13.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 46.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
029dd601e65be4903e589821c14d062e2a52e5cd3f55777477eaa965b375cd49
BLAKE2b-256 checksum
How to use checksums
2b0b7a216b0ee1701c20cedcadb6c96ec921999397bece06292bfebc6c80217e
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.13.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL light_curve-0.13.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.7 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
ac2dd4a169df57686f110646225a39d428cfc6b91f61137b415d9928052d2548
BLAKE2b-256 checksum
How to use checksums
172131e045229ef4d1baa9682a4397273b6c1d2b87adc04827cff6ca69a0ac74
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.13.3-cp310-abi3-macosx_15_0_x86_64.whl

Download URL light_curve-0.13.3-cp310-abi3-macosx_15_0_x86_64.whl
Size 8.2 MB
Tags CPython 3.10 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
65ab59c4431e5be8f006b9c58c87353eb5439d540bb83a61867027bda1f1aec1
BLAKE2b-256 checksum
How to use checksums
635e6d87a4873d2e8c989fbdbfc991923d538c28da4fbe567a44b7eba469a7ee
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.13.3-cp310-abi3-macosx_14_0_arm64.whl

Download URL light_curve-0.13.3-cp310-abi3-macosx_14_0_arm64.whl
Size 7.0 MB
Tags CPython 3.10 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
efc85c129a1f91bf5ff3452c5ca918be8097b5724e2f423c79b2718b2a22a3ff
BLAKE2b-256 checksum
How to use checksums
0c7ad2f3bd297ec20a1bf309b4aecd29ec5b66509a8da312c96e4fc28f98293f
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.13.3

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.

Release history Release notifications | RSS feed

This release

0.13.3 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