Skip to content

Commit ae90cf5

Browse files
committed
Set MACOSX_DEPLOYMENT_TARGET
1 parent e090532 commit ae90cf5

File tree

2 files changed

+90
-38
lines changed

2 files changed

+90
-38
lines changed

.github/workflows/publish.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- uses: actions/checkout@v4
6666

6767
- name: Set up QEMU on Linux
68-
if: ${{ matrix.os == 'ubuntu-20.04' }}
68+
if: ${{ runner.os == 'Linux' }}
6969
uses: docker/setup-qemu-action@v3
7070
with:
7171
platforms: all
@@ -77,15 +77,21 @@ jobs:
7777
echo "CPATH=$(brew --prefix)/include:$(brew --prefix)/include/eigen3:${CPATH}" >> $GITHUB_ENV
7878
echo "LIBRARY_PATH=$(brew --prefix)/lib:$(brew --prefix)/lib64:${LIBRARY_PATH}" >> $GITHUB_ENV
7979
80+
- name: Set MACOSX_DEPLOYMENT_TARGET to the current macOS version
81+
if: ${{ runner.os == 'macOS' }}
82+
run: |
83+
export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | awk -F '.' '{print $1"."0}')
84+
echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" >> $GITHUB_ENV
85+
8086
# We only support AMD64 architecture for Windows, so we hard-code it here.
8187
- name: Set CIBW envs on Windows
82-
if: ${{ matrix.os == 'windows-2019' }}
88+
if: ${{ runner.os == 'Windows' }}
8389
run: |
8490
"CIBW_BUILD=${{ matrix.cibw_build }}" >> $env:GITHUB_ENV
8591
"CIBW_ARCHS=AMD64" >> $env:GITHUB_ENV
8692
8793
- name: Set CIBW envs on Linux or macOS
88-
if: ${{ matrix.os != 'windows-2019' }}
94+
if: ${{ runner.os != 'Windows' }}
8995
run: |
9096
echo "CIBW_BUILD=${{ matrix.cibw_build }}" >> $GITHUB_ENV
9197
CIBW_ARCHS=$(echo ${{ matrix.cibw_build }} | cut -d'_' -f2,3)

light-curve/README.md

Lines changed: 81 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# `light-curve` processing toolbox for Python
22

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
5+
high-performant time-series feature extractors.
46

57
[![PyPI version](https://badge.fury.io/py/light-curve.svg)](https://pypi.org/project/light-curve/)
68
![testing](https://github.com/light-curve/light-curve-python/actions/workflows/test.yml/badge.svg)
@@ -16,30 +18,43 @@ python3 -mpip install 'light-curve[full]'
1618
We also provide `light-curve-python` package which is just an "alias" to the main `light-curve[full]` package.
1719

1820
Minimum supported Python version is 3.8.
19-
We provide binary CPython wheels via [PyPi](https://pypi.org/project/light-curve/) for a number of platforms and architectures.
20-
We also provide binary wheels for stable CPython ABI, so the package is guaranteed to work with all future CPython3 versions.
21+
We provide binary CPython wheels via [PyPi](https://pypi.org/project/light-curve/) for a number of platforms and
22+
architectures.
23+
We also provide binary wheels for stable CPython ABI, so the package is guaranteed to work with all future CPython3
24+
versions.
2125

2226
### Support matrix
2327

24-
| Arch \ OS | Linux glibc | Linux musl | macOS | Windows https://github.com/light-curve/light-curve-python/issues/186 |
25-
| ----------- |-------------|--------------------------------|----------------------------------------------------------------|----------------------------------------------------------------------|
26-
| **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 |
29+
|-------------|-------------------|--------------------------------|-----------|----------------------------------------------------------------------|
30+
| **x86-64** | wheel (MKL) | wheel (MKL) | wheel 12+ | wheel (no Ceres, no GSL) |
31+
| **i686** | src | src || not tested |
32+
| **aarch64** | wheel | wheel | wheel 14+ | not tested |
33+
| **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`.
3343
- "not tested": building from the source code is not tested, please report us building status via issue/PR/email.
3444

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

3751
## Feature evaluators
3852

3953
Most of the classes implement various feature evaluators useful for light-curve based
4054
astrophysical source classification and characterisation.
4155

4256
<!-- name: test_feature_evaluators_basic -->
57+
4358
```python
4459
import light_curve as lc
4560
import numpy as np
@@ -82,6 +97,7 @@ Note that if your inputs are not valid and are not validated by
8297

8398
Print feature classes list
8499
<!-- name: test_feature_evaluators_list -->
100+
85101
```python
86102
import light_curve as lc
87103

@@ -90,19 +106,22 @@ print([x for x in dir(lc) if hasattr(getattr(lc, x), "names")])
90106

91107
Read feature docs
92108
<!-- name: test_feature_evaluators_help -->
109+
93110
```python
94111
import light_curve as lc
95112

96113
help(lc.BazinFit)
97114
```
98115

99-
100116
### Available features
101117

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).
103120
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,
124+
or any kind of light curves.
106125

107126
<table>
108127
<tr>
@@ -412,22 +431,27 @@ where $f(t) -$ flux observation, $A, \gamma , \tau _{rise} , \tau _{fall} >0$,
412431
</table>
413432

414433
### Meta-features
434+
415435
Meta-features can accept other feature extractors and apply them to pre-processed data.
416436

417437
#### Periodogram
418438

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

421443
$$
422444
\text{signal to noise of peak} \equiv \frac{P(\omega_\mathrm{peak}) - \langle P(\omega) \rangle}{\sigma\_{P(\omega)}}
423445
$$
424446

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

427450
#### Bins
428451

429452
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}]$.
453+
$j-th$ bin boundaries
454+
are $[j \cdot \mathrm{window} + \mathrm{offset}; (j + 1) \cdot \mathrm{window} + \mathrm{offset}]$.
431455

432456
Binned time series is defined by
433457
$$t_j^* = (j + \frac12) \cdot \mathrm{window} + \mathrm{offset},$$
@@ -440,6 +464,7 @@ where $N_j$ is a number of sampling observations and all sums are over observati
440464
As of v0.8, experimental extractors (see below), support multi-band light-curve inputs.
441465

442466
<!-- name: test_multiband_experimental_features -->
467+
443468
```python
444469
import numpy as np
445470
from light_curve.light_curve_py import LinearFit
@@ -456,20 +481,24 @@ print(values)
456481
#### Rainbow Fit
457482

458483
Rainbow ([Russeil+23](https://arxiv.org/abs/2310.02916)) is a black-body parametric model for transient light curves.
459-
By default, it uses Bazin function as a model for bolometric flux evolution and a logistic function for the temperature evolution.
484+
By default, it uses Bazin function as a model for bolometric flux evolution and a logistic function for the temperature
485+
evolution.
460486
The user may customize the model by providing their own functions for bolometric flux and temperature evolution.
461487
This example demonstrates the reconstruction of a synthetic light curve with this model.
462488
`RainbowFit` requires `iminuit` package.
463489

464490
<!-- name: test_rainbow_fit_example -->
491+
465492
```python
466493
import numpy as np
467494
from light_curve.light_curve_py import RainbowFit
468495

496+
469497
def bb_nu(wave_aa, T):
470498
"""Black-body spectral model"""
471499
nu = 3e10 / (wave_aa * 1e-8)
472-
return 2 * 6.626e-27 * nu**3 / 3e10**2 / np.expm1(6.626e-27 * nu / (1.38e-16 * T))
500+
return 2 * 6.626e-27 * nu ** 3 / 3e10 ** 2 / np.expm1(6.626e-27 * nu / (1.38e-16 * T))
501+
473502

474503
# Effective wavelengths in Angstrom
475504
band_wave_aa = {"g": 4770.0, "r": 6231.0, "i": 7625.0, "z": 9134.0}
@@ -496,7 +525,7 @@ temp = Tmin + delta_T / (1.0 + np.exp((t - reference_time) / k_sig))
496525
lum = amplitude * np.exp(-(t - reference_time) / fall_time) / (1.0 + np.exp(-(t - reference_time) / rise_time))
497526

498527
# Spectral flux density for each given pair of time and passband
499-
flux = np.pi * bb_nu(waves, temp) / (5.67e-5 * temp**4) * lum
528+
flux = np.pi * bb_nu(waves, temp) / (5.67e-5 * temp ** 4) * lum
500529
# S/N = 5 for minimum flux, scale for Poisson noise
501530
flux_err = np.sqrt(flux * np.min(flux) / 5.0)
502531
flux += rng.normal(0.0, flux_err)
@@ -507,18 +536,24 @@ print(dict(zip(feature.names, values)))
507536
print(f"Goodness of fit: {values[-1]}")
508537
```
509538

510-
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.
511541

512542
### Experimental extractors
513543

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.
517551
However, the Python implementation provides some new feature extractors you can find useful.
518552

519553
You can manually use extractors from both implementations:
520554

521555
<!-- name: test_experimental_extractors -->
556+
522557
```python
523558
import numpy as np
524559
from numpy.testing import assert_allclose
@@ -540,31 +575,41 @@ This should print a warning about experimental status of the Python class
540575

541576
### Benchmarks
542577

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`.
544581

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

547585
![Benchmarks, Rust is much faster](https://github.com/light-curve/light-curve-python/raw/readme-benchs/light-curve/.readme/benchplot_v2.png)
548586

549587
The plot shows that the Rust implementation of the package outperforms other ones by a factor of 1.5—50.
550588
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.
552591

553592
![Benchmark for different number of observations](https://github.com/light-curve/light-curve-python/raw/readme-benchs/light-curve/.readme/nobs_bench_v2.png)
554593

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

557597
![Benchmark for multithreading and multiprocessing](https://github.com/light-curve/light-curve-python/raw/readme-benchs/light-curve/.readme/multi_bench_v2.png)
558598

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

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).
562604

563605
## dm-dt map
564606

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).
566610

567611
<!-- name: test_dmdt -->
612+
568613
```python
569614
import numpy as np
570615
from light_curve import DmDt
@@ -588,7 +633,8 @@ assert_array_equal(actual, desired)
588633

589634
## Citation
590635

591-
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)
592638

593639
```bibtex
594640
@ARTICLE{2021MNRAS.502.5147M,

0 commit comments

Comments
 (0)