You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: light-curve/README.md
+81-35Lines changed: 81 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# `light-curve` processing toolbox for Python
2
2
3
-
The Python wrapper for Rust [`light-curve-feature`](https://github.com/light-curve/light-curve-feature) and [`light-curve-dmdt`](https://github.com/light-curve/light-curve-dmdt) packages which gives a collection of high-performant time-series feature extractors.
3
+
The Python wrapper for Rust [`light-curve-feature`](https://github.com/light-curve/light-curve-feature)
4
+
and [`light-curve-dmdt`](https://github.com/light-curve/light-curve-dmdt) packages which gives a collection of
|**x86-64**| wheel (MKL) | wheel (MKL) | wheel | wheel (no Ceres, no GSL) |
27
-
|**i686**| src | src | — | not tested |
28
-
|**aarch64**| wheel | wheel | wheel | not tested |
29
-
|**ppc64le**| wheel | not tested (no Rust toolchain) | — | — |
30
-
31
-
- "wheel": binary wheel is available on pypi.org, local building is not required for the platform, the only pre-requirement is a recent `pip` version. For Linux x86-64 we provide binary wheels built with Intel MKL for better periodogram performance, which is not a default build option. For Windows x86-64 we provide wheel with no Ceres and no GSL support, which is not a default build option.
32
-
- "src": the package is confirmed to be built and pass unit tests locally, but testing and package building is not supported by CI. It is required to have the [GNU scientific library (GSL)](https://www.gnu.org/software/gsl/) v2.1+ and the [Rust toolchain](https://rust-lang.org) v1.67+ to install it via `pip install`. `ceres-solver` and `fftw` may be installed locally or built from source, in the later case you would also need C/C++ compiler and `cmake`.
28
+
| Arch \ OS | Linux glibc 2.17+ | Linux musl 1.2+ | macOS | Windows https://github.com/light-curve/light-curve-python/issues/186|
|**ppc64le**| wheel | not tested (no Rust toolchain) | — | — |
34
+
35
+
- "wheel": binary wheel is available on pypi.org, local building is not required for the platform, the only
36
+
pre-requirement is a recent `pip` version. For Linux x86-64 we provide binary wheels built with Intel MKL for better
37
+
periodogram performance, which is not a default build option. For Windows x86-64 we provide wheel with no Ceres and no
38
+
GSL support, which is not a default build option.
39
+
- "src": the package is confirmed to be built and pass unit tests locally, but testing and package building is not
40
+
supported by CI. It is required to have the [GNU scientific library (GSL)](https://www.gnu.org/software/gsl/) v2.1+
41
+
and the [Rust toolchain](https://rust-lang.org) v1.67+ to install it via `pip install`. `ceres-solver` and `fftw` may
42
+
be installed locally or built from source, in the later case you would also need C/C++ compiler and `cmake`.
33
43
- "not tested": building from the source code is not tested, please report us building status via issue/PR/email.
34
44
35
-
We stopped publishing PyPy wheels (https://github.com/light-curve/light-curve-python/issues/345), please feel free to open an issue if you need them.
45
+
macOS wheels require relatively new OS versions, please open an issue if you have any problems with them,
46
+
see https://github.com/light-curve/light-curve-python/issues/376 for the details.
47
+
48
+
We stopped publishing PyPy wheels (https://github.com/light-curve/light-curve-python/issues/345), please feel free to
49
+
open an issue if you need them.
36
50
37
51
## Feature evaluators
38
52
39
53
Most of the classes implement various feature evaluators useful for light-curve based
40
54
astrophysical source classification and characterisation.
41
55
42
56
<!-- name: test_feature_evaluators_basic -->
57
+
43
58
```python
44
59
import light_curve as lc
45
60
import numpy as np
@@ -82,6 +97,7 @@ Note that if your inputs are not valid and are not validated by
82
97
83
98
Print feature classes list
84
99
<!-- name: test_feature_evaluators_list -->
100
+
85
101
```python
86
102
import light_curve as lc
87
103
@@ -90,19 +106,22 @@ print([x for x in dir(lc) if hasattr(getattr(lc, x), "names")])
90
106
91
107
Read feature docs
92
108
<!-- name: test_feature_evaluators_help -->
109
+
93
110
```python
94
111
import light_curve as lc
95
112
96
113
help(lc.BazinFit)
97
114
```
98
115
99
-
100
116
### Available features
101
117
102
-
See the complete list of available feature evaluators and documentation in [`light-curve-feature` Rust crate docs](https://docs.rs/light-curve-feature/latest/light_curve_feature/features/index.html).
118
+
See the complete list of available feature evaluators and documentation
119
+
in [`light-curve-feature` Rust crate docs](https://docs.rs/light-curve-feature/latest/light_curve_feature/features/index.html).
103
120
Italic names are experimental features.
104
-
While we usually say "magnitude" and use "m" as a time-series value, some of the features are supposed to be used with flux light-curves.
105
-
The last column indicates whether the feature should be used with flux light curves only, magnitude light curves only, or any kind of light curves.
121
+
While we usually say "magnitude" and use "m" as a time-series value, some of the features are supposed to be used with
122
+
flux light-curves.
123
+
The last column indicates whether the feature should be used with flux light curves only, magnitude light curves only,
Meta-features can accept other feature extractors and apply them to pre-processed data.
416
436
417
437
#### Periodogram
418
438
419
-
This feature transforms time-series data into the Lomb-Scargle periodogram, providing an estimation of the power spectrum. The peaks argument corresponds to the number of the most significant spectral density peaks to return. For each peak, its period and "signal-to-noise" ratio are returned.
439
+
This feature transforms time-series data into the Lomb-Scargle periodogram, providing an estimation of the power
440
+
spectrum. The peaks argument corresponds to the number of the most significant spectral density peaks to return. For
441
+
each peak, its period and "signal-to-noise" ratio are returned.
420
442
421
443
$$
422
444
\text{signal to noise of peak} \equiv \frac{P(\omega_\mathrm{peak}) - \langle P(\omega) \rangle}{\sigma\_{P(\omega)}}
423
445
$$
424
446
425
-
The optional features argument accepts a list of additional feature evaluators, which are applied to the power spectrum: frequency is passed as "time," power spectrum is passed as "magnitude," and no uncertainties are set.
447
+
The optional features argument accepts a list of additional feature evaluators, which are applied to the power spectrum:
448
+
frequency is passed as "time," power spectrum is passed as "magnitude," and no uncertainties are set.
426
449
427
450
#### Bins
428
451
429
452
Binning time series to bins with width $\mathrm{window}$ with respect to some $\mathrm{offset}$.
430
-
$j-th$ bin boundaries are $[j \cdot \mathrm{window} + \mathrm{offset}; (j + 1) \cdot \mathrm{window} + \mathrm{offset}]$.
Note, that while we don't use precise physical constant values to generate the data, `RainbowFit` uses CODATA 2018 values.
539
+
Note, that while we don't use precise physical constant values to generate the data, `RainbowFit` uses CODATA 2018
540
+
values.
511
541
512
542
### Experimental extractors
513
543
514
-
From the technical point of view the package consists of two parts: a wrapper for [`light-curve-feature` Rust crate](https://crates.io/crates/light-curve-feature) (`light_curve_ext` sub-package) and pure Python sub-package `light_curve_py`.
515
-
We use the Python implementation of feature extractors to test Rust implementation and to implement new experimental extractors.
516
-
Please note, that the Python implementation is much slower for most of the extractors and doesn't provide the same functionality as the Rust implementation.
544
+
From the technical point of view the package consists of two parts: a wrapper
545
+
for [`light-curve-feature` Rust crate](https://crates.io/crates/light-curve-feature) (`light_curve_ext` sub-package) and
546
+
pure Python sub-package `light_curve_py`.
547
+
We use the Python implementation of feature extractors to test Rust implementation and to implement new experimental
548
+
extractors.
549
+
Please note, that the Python implementation is much slower for most of the extractors and doesn't provide the same
550
+
functionality as the Rust implementation.
517
551
However, the Python implementation provides some new feature extractors you can find useful.
518
552
519
553
You can manually use extractors from both implementations:
520
554
521
555
<!-- name: test_experimental_extractors -->
556
+
522
557
```python
523
558
import numpy as np
524
559
from numpy.testing import assert_allclose
@@ -540,31 +575,41 @@ This should print a warning about experimental status of the Python class
540
575
541
576
### Benchmarks
542
577
543
-
You can run all benchmarks from the Python project folder with `python3 -mpytest --benchmark-enable tests/test_w_bench.py`, or with slow benchmarks disabled `python3 -mpytest -m "not (nobs or multi)" --benchmark-enable tests/test_w_bench.py`.
578
+
You can run all benchmarks from the Python project folder
579
+
with `python3 -mpytest --benchmark-enable tests/test_w_bench.py`, or with slow benchmarks
580
+
disabled `python3 -mpytest -m "not (nobs or multi)" --benchmark-enable tests/test_w_bench.py`.
544
581
545
-
Here we benchmark the Rust implementation (`rust`) versus [`feets`](https://feets.readthedocs.io/en/latest/) package and our own Python implementation (`lc_py`) for a light curve having n=1000 observations.
582
+
Here we benchmark the Rust implementation (`rust`) versus [`feets`](https://feets.readthedocs.io/en/latest/) package and
583
+
our own Python implementation (`lc_py`) for a light curve having n=1000 observations.
546
584
547
585

548
586
549
587
The plot shows that the Rust implementation of the package outperforms other ones by a factor of 1.5—50.
550
588
This allows to extract a large set of "cheap" features well under one ms for n=1000.
551
-
The performance of parametric fits (`BazinFit` and `VillarFit`) and `Periodogram` depend on their parameters, but the typical timescale of feature extraction including these features is 20—50 ms for few hundred observations.
589
+
The performance of parametric fits (`BazinFit` and `VillarFit`) and `Periodogram` depend on their parameters, but the
590
+
typical timescale of feature extraction including these features is 20—50 ms for few hundred observations.
552
591
553
592

554
593
555
-
Benchmark results of several features for both the pure-Python and Rust implementations of the "light-curve" package, as a function of the number of observations in a light curve. Both the x-axis and y-axis are on a logarithmic scale.
594
+
Benchmark results of several features for both the pure-Python and Rust implementations of the "light-curve" package, as
595
+
a function of the number of observations in a light curve. Both the x-axis and y-axis are on a logarithmic scale.
556
596
557
597

558
598
559
-
Processing time per a single light curve for extraction of features subset presented in first benchmark versus the number of CPU cores used. The dataset consists of 10,000 light curves with 1,000 observations in each.
599
+
Processing time per a single light curve for extraction of features subset presented in first benchmark versus the
600
+
number of CPU cores used. The dataset consists of 10,000 light curves with 1,000 observations in each.
560
601
561
-
See benchmarks' descriptions in more details in ["Performant feature extraction for photometric time series"](https://arxiv.org/abs/2302.10837).
602
+
See benchmarks' descriptions in more details
603
+
in ["Performant feature extraction for photometric time series"](https://arxiv.org/abs/2302.10837).
562
604
563
605
## dm-dt map
564
606
565
-
Class `DmDt` provides dm–dt mapper (based on [Mahabal et al. 2011](https://ui.adsabs.harvard.edu/abs/2011BASI...39..387M/abstract), [Soraisam et al. 2020](https://ui.adsabs.harvard.edu/abs/2020ApJ...892..112S/abstract)). It is a Python wrapper for [`light-curve-dmdt` Rust crate](https://crates.io/crates/light-curve-dmdt).
607
+
Class `DmDt` provides dm–dt mapper (based
608
+
on [Mahabal et al. 2011](https://ui.adsabs.harvard.edu/abs/2011BASI...39..387M/abstract), [Soraisam et al. 2020](https://ui.adsabs.harvard.edu/abs/2020ApJ...892..112S/abstract)).
609
+
It is a Python wrapper for [`light-curve-dmdt` Rust crate](https://crates.io/crates/light-curve-dmdt).
If you found this project useful for your research please cite [Malanchev et al., 2021](https://ui.adsabs.harvard.edu/abs/2021MNRAS.502.5147M/abstract)
636
+
If you found this project useful for your research please
637
+
cite [Malanchev et al., 2021](https://ui.adsabs.harvard.edu/abs/2021MNRAS.502.5147M/abstract)
0 commit comments