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}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

light_curve-0.13.2.tar.gz (499.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

light_curve-0.13.2-cp310-abi3-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

light_curve-0.13.2-cp310-abi3-musllinux_1_2_x86_64.whl (32.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

light_curve-0.13.2-cp310-abi3-musllinux_1_2_aarch64.whl (8.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

light_curve-0.13.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (46.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

light_curve-0.13.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (6.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

light_curve-0.13.2-cp310-abi3-macosx_15_0_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

light_curve-0.13.2-cp310-abi3-macosx_14_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

Details for the file light_curve-0.13.2.tar.gz.

File metadata

  • Download URL: light_curve-0.13.2.tar.gz
  • Upload date:
  • Size: 499.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for light_curve-0.13.2.tar.gz
Algorithm Hash digest
SHA256 04983b81d4e74c80b48a5598efa9b7a8a1c49d6b9310dd881cc23c3665542c25
MD5 5af6193d67cff92e79517202cb9f6b46
BLAKE2b-256 108f837f7b91e198eabadf16f6b81f7644a0b36ade9e34cf9330fa7ff7483a6c

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4a53a95beb1739d48e598cb277e6e105cafa280ae09a722193eee871fb4fa852
MD5 b397316e4906823ea21ba014d38456f4
BLAKE2b-256 743b8ef084f3f1d7b1f8c164b9611985eebb01605932ac8ac39c65c41fcb41d7

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1891ceeef295a910445478ff97b70f33c0b8a6c4f92880993ba4e37e97fd9b09
MD5 f4a05615632124cfc84a1e36aa965885
BLAKE2b-256 23f21a14ee207abd641733fd0bdcf49e2b66d5697e80f6b6bb21fc909a6c6f3b

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7e28307d0c5a044136d99b7f258c2c37d516226804221ba519f0fb183de886a4
MD5 739d655e2dfc12045358a6c8f5266350
BLAKE2b-256 ffbe33e0d5d819bb72798fd991cb99e0449b9885183ef82bea43ca4ebcfbb99b

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a7766163d743cd7bb77bd5f2d9a173dd8220ef8f1cdaf3fe6d91f1d116af3c30
MD5 a9a6f8263782e541230307d975de36f9
BLAKE2b-256 504223146245a811d6c956ae11b8bc17492522ab384c9f6a3a26b2cba05dd3fd

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 944416500d43d8c0e40f7a7dbaf212d54f467c43eaa54bff4f876f174edb8c8a
MD5 599113aca6218ffa55ea19eab4eccf0a
BLAKE2b-256 b9bc1c2fe30f922da3ed90e7f3d1619355b4d3e789081a04c8878223c43f8996

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 a4f87fe25bbdbb5788b6dad6b269e0cab5973e7ff94a48c2191e5cb5bcc20c11
MD5 1bb6ebff5bd7b940fafda84386ca0f17
BLAKE2b-256 324ec3b9169863afa56bae07e4c06b9a66c25111ad53f2eb75e7eb34b2a91f67

See more details on using hashes here.

File details

Details for the file light_curve-0.13.2-cp310-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for light_curve-0.13.2-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c2470926381c88e165eeaf55ae827d43a975d1702fc33fdc79617f1efa2dc204
MD5 1ff1a50f45190301c69cb41db89bd899
BLAKE2b-256 4fe8f92f18dab23972927d05b8c9b472bcd8fe425d1e928dfae23bec65ede63d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.13.3

8 files

This release

0.13.2 This release

8 files

0.13.1

8 files

0.13.0

8 files

0.12.5

8 files

0.12.4

8 files

0.12.3

8 files

0.12.2

8 files

0.12.1

8 files

0.12.0

8 files

0.11.1

8 files

0.11.0

8 files

0.10.5

8 files

0.10.4

8 files

0.10.3

8 files

0.10.2

8 files

0.10.0

9 files

0.9.6

9 files

0.9.5

9 files

0.9.4

9 files

0.9.3

9 files

0.9.2

9 files

0.9.1

9 files

0.9.0

24 files

0.8.2

61 files

0.8.1

66 files

0.8.0

60 files

0.7.3

55 files

0.7.2

54 files

0.7.1

44 files

0.7.0

44 files

0.6.6

39 files

0.6.5

44 files

0.6.4

44 files

0.6.3

44 files

0.6.2

44 files

0.6.1

44 files

0.6.0

37 files

0.5.9

37 files

0.5.8

37 files

0.5.7

37 files

0.5.6

37 files

0.5.5

30 files

0.5.4

21 files

0.5.3

21 files

0.5.2

17 files

0.5.1

17 files

0.5.0

17 files

0.4.1

17 files

0.4.0

17 files

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