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.3.tar.gz (505.7 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.3-cp310-abi3-win_amd64.whl (7.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

light_curve-0.13.3-cp310-abi3-musllinux_1_2_x86_64.whl (32.5 MB view details)

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

light_curve-0.13.3-cp310-abi3-musllinux_1_2_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

light_curve-0.13.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (46.4 MB view details)

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

light_curve-0.13.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (6.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

light_curve-0.13.3-cp310-abi3-macosx_15_0_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

light_curve-0.13.3-cp310-abi3-macosx_14_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for light_curve-0.13.3.tar.gz
Algorithm Hash digest
SHA256 e8883064f577a600c781348be76f097e10595841080ba7b43d2944f3fbcefc56
MD5 a60531fdcf8ed83a445b26cd1f2f26c7
BLAKE2b-256 6a76a28e69fec0d6538920f5e73ed6c95bcca11feb3078effd6bc054db5f703c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 99fe1fe5198e4c8aa70b9cfe0c56cc7aa38b0c8132039277a4a79393cd76eacd
MD5 5370924e11029cac78122e537e03ecfd
BLAKE2b-256 9bcea17bc52c79c2c7269c72add2b3fc9d5ad4f17edc6510a012f4c850012472

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 80cc5e0a5411768f50dc7dcbb4096274cf6620bd98c397aef6af51a6bc017a6b
MD5 ee725ae720705d68759c9812c4348bae
BLAKE2b-256 e52082273563909711529f1838248654479ca948bd2dc7030a0ab716cfe3a116

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 52cb15067ddee267f41f6ab77c6756648781fda9132f3be7058e86ebd1cef5c0
MD5 6fcc84fe7f65dd3fde5a605d85c68085
BLAKE2b-256 d467021c6c4552261861a16a945a8abbbcca73bc11ae5772bae17ff3e283b715

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 029dd601e65be4903e589821c14d062e2a52e5cd3f55777477eaa965b375cd49
MD5 9531eb112738f604227f01b0b391c14d
BLAKE2b-256 2b0b7a216b0ee1701c20cedcadb6c96ec921999397bece06292bfebc6c80217e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 ac2dd4a169df57686f110646225a39d428cfc6b91f61137b415d9928052d2548
MD5 e7bcde6593a725662e08c487b7e09b17
BLAKE2b-256 172131e045229ef4d1baa9682a4397273b6c1d2b87adc04827cff6ca69a0ac74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 65ab59c4431e5be8f006b9c58c87353eb5439d540bb83a61867027bda1f1aec1
MD5 b638451f4ef5ba6bee174fe2219129ea
BLAKE2b-256 635e6d87a4873d2e8c989fbdbfc991923d538c28da4fbe567a44b7eba469a7ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for light_curve-0.13.3-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 efc85c129a1f91bf5ff3452c5ca918be8097b5724e2f423c79b2718b2a22a3ff
MD5 fd29d8a7865d0ae03dc4d6194a42ebe1
BLAKE2b-256 0c7ad2f3bd297ec20a1bf309b4aecd29ec5b66509a8da312c96e4fc28f98293f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.13.3 This release

8 files

0.13.2

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