https://github.com/light-curve/light-curve-feature
Time-series feature extraction Rust crate
Science Score: 39.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.3%) to scientific vocabulary
Repository
Time-series feature extraction Rust crate
Basic Info
- Host: GitHub
- Owner: light-curve
- License: gpl-3.0
- Language: Rust
- Default Branch: master
- Size: 1.31 MB
Statistics
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 40
- Releases: 0
Metadata Files
README.md
light-curve-feature
light-curve-feature is a part of light-curve family that
implements extraction of numerous light curve features used in astrophysics.
If you are looking for Python bindings for this package, please see https://github.com/light-curve/light-curve-python
All features are available in Feature enum, and the recommended way to extract multiple features at
once is FeatureExtractor struct built from a Vec<Feature>. Data is represented by
TimeSeries struct built from time, magnitude (or flux) and weight arrays, all having the same length. Note
that multiple features interpret weight array as inversed squared observation errors.
```rust use lightcurvefeature::prelude::*;
// Let's find amplitude and reduced Chi-squared of the light curve
let fe = FeatureExtractor::fromfeatures(vec![
Amplitude::new().into(),
ReducedChi2::new().into()
]);
// Define light curve
let time = [0.0, 1.0, 2.0, 3.0, 4.0];
let magn = [-1.0, 2.0, 1.0, 3.0, 4.5];
let weights = [5.0, 10.0, 2.0, 10.0, 5.0]; // inverse squared magnitude errors
let mut ts = TimeSeries::new(&time, &magn, &weights);
// Get results and print
let result = fe.eval(&mut ts)?;
let names = fe.getnames();
println!("{:?}", names.iter().zip(result.iter()).collect::
Ok::<(), EvaluatorError>(())
```
There are a couple of meta-features, which transform a light curve before feature extraction. For example Bins feature accumulates data inside time-windows and extracts features from this new light curve.
```rust use lightcurvefeature::prelude::*; use ndarray::Array1;
// Define features, "raw" MaximumSlope and binned with zero offset and 1-day window let maxslope: Feature<> = MaximumSlope::default().into(); let bins: Feature<> = { let mut bins = Bins::new(1.0, 0.0); bins.addfeature(maxslope.clone()); bins.into() }; let fe = FeatureExtractor::fromfeatures(vec![maxslope, bins]); // Define light curve let time = [0.1, 0.2, 1.1, 2.1, 2.1]; let magn = [10.0, 10.1, 10.5, 11.0, 10.9]; // We don't need weight for MaximumSlope, this would assign unity weight let mut ts = TimeSeries::newwithout_weight(&time, &magn); // Get results and print let result = fe.eval(&mut ts)?; println!("{:?}", result);
Ok::<(), EvaluatorError>(())
```
Cargo features
The crate is configured with the following Cargo features:
- ceres-system and ceres-source - enable Ceres Solver support for non-linear fitting. The former
uses system-wide installation of Ceres, the latter builds Ceres from source and links it statically. The latter overrides the former. See ceres-solver-rs crate for details
- fftw-system, fftw-source (enabled by default) and fftw-mkl - enable FFTW support for Fourier transforms needed by Periodogram. The
first uses system-wide installation of FFTW, the second builds FFTW from source and links it statically, the last downloads and links statically Intel MKL instead of FFTW.
- gsl - enables GNU Scientific Library support for non-linear fitting.
- default - enables fftw-source feature only, has no side effects.
Development
Setting up
Install Rust toolchain, the preferred way is rustup.
Install the required system libraries. For main project you need Ceres Solver, FFTW and GSL, as well as C++ compiler and CMake. The example script plots some stuff so it requires fontconfig. ```bash
On macOS:
brew install ceres-solver cmake fftw gsl fontconfig
On Debian-like:
apt install build-essential cmake libceres-dev libfftw3-dev libgsl-dev libfontconfig-dev ```
Clone the repository with submodules and run compiler checks:
bash
git clone --recursive https://github.com/light-curve/light-curve-feature
cd light-curve-feature
Run tests with native libraries.
Note that Ceres could require manual CPATH specification on some systems, like CPATH=/opt/homebrew/include on ARM macOS:
bash
cargo test --no-default-features --features ceres-system,fftw-system,gsl
You may also run benchmarks, but be patient
bash
cargo bench --no-default-features --features ceres-system,fftw-system,gsl
See examples, .github/workflows and tests for examples of the code usage.
Formatting and linting
We format and check the code with the standard Rust tools: cargo fmt and cargo clippy.
Please use clippy's #[allow] as precise as possible and leave code comments if it is not obvious why its usage is required.
We use pre-commit for running some linters locally before commiting.
Please consider installing it and initializing in the repo with pre-commit init.
However pre-commit.ci and GitHub Actions will varify cargo fmt and cargo clippy for PRs.
Generally, we are aimed to test all user-level code, add unit-tests to your non-trivial PRs.
Currently we have no unsafe code in this repo and we are aimed to avoid it in the future.
Implementing a new feature evaluator
Your new feature evaluator code should go to at least three files:
- New file inside
src/featuresdirectory - Publically import the new struct inside
src/features/mod.rs - Add it as a new variant of
Featureenum insidesrc/feature.rs
Citation
If you found this project useful for your research please cite Malanchev et al., 2021
bibtex
@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}
}
Owner
- Name: light-curve
- Login: light-curve
- Kind: organization
- Repositories: 6
- Profile: https://github.com/light-curve
GitHub Events
Total
- Issues event: 7
- Delete event: 21
- Issue comment event: 20
- Push event: 34
- Pull request event: 48
- Create event: 29
Last Year
- Issues event: 7
- Delete event: 21
- Issue comment event: 20
- Push event: 34
- Pull request event: 48
- Create event: 29
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Konstantin Malanchev | h****t@g****m | 868 |
| stlavrukhina | l****d@g****m | 35 |
| dependabot[bot] | 4****]@u****m | 9 |
| pre-commit-ci[bot] | 6****]@u****m | 7 |
| Anastasia Lavrukhina | 4****a@u****m | 5 |
| Anastasia Lavrukhina | 4****a@u****m | 1 |
| LingMan | L****n@u****m | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 53
- Total pull requests: 171
- Average time to close issues: 8 months
- Average time to close pull requests: about 1 month
- Total issue authors: 4
- Total pull request authors: 6
- Average comments per issue: 0.36
- Average comments per pull request: 0.71
- Merged pull requests: 116
- Bot issues: 0
- Bot pull requests: 70
Past Year
- Issues: 8
- Pull requests: 54
- Average time to close issues: N/A
- Average time to close pull requests: 4 days
- Issue authors: 1
- Pull request authors: 3
- Average comments per issue: 0.13
- Average comments per pull request: 0.72
- Merged pull requests: 40
- Bot issues: 0
- Bot pull requests: 15
Top Authors
Issue Authors
- hombit (49)
- erusseil (2)
- matwey (1)
- anlava (1)
Pull Request Authors
- hombit (107)
- dependabot[bot] (77)
- pre-commit-ci[bot] (8)
- anlava (2)
- GaluTi (2)
- erusseil (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cargo 154,357 total
- Total dependent packages: 0
- Total dependent repositories: 3
- Total versions: 94
- Total maintainers: 1
crates.io: light-curve-feature
Feature extractor from noisy time series
- Documentation: https://docs.rs/light-curve-feature/
- License: GPL-3.0-or-later
-
Latest release: 0.10.0
published 9 months ago
Rankings
Maintainers (1)
Dependencies
- approx ^0.5 development
- chfft ^0.3.4 development
- clap 3.2.6 development
- criterion ^0.3 development
- hyperdual ^0.5.0 development
- light-curve-common 0.1.0 development
- plotters ^0.3.1 development
- plotters-bitmap ^0.3.1 development
- rand ^0.7 development
- rand_distr ^0.2 development
- rayon ~1.5.1 development
- realfft ^1.1 development
- rustfft ^5.0 development
- serde_json ^1.0 development
- serde_test ^1.0 development
- serde_type_name 0.2.0 development
- GSL ~6.0.0
- anyhow <1.0.49
- conv ^0.3.3
- emcee ^0.3.0
- emcee_rand ^0.3.15
- enum_dispatch ^0.3.7
- fftw 0.7.0
- itertools ^0.10.0
- lazy_static ^1.4.0
- libm ~0.2.1
- macro_const 0.1.0
- ndarray ^0.15.3
- ndarray-stats ^0.5
- num-complex ^0.3
- num-traits ^0.2
- schemars ^0.8.3
- serde ^1.0
- thiserror ^1.0
- thread_local ^1.1
- unzip3 ^1.0
- actions/checkout v3 composite
- dtolnay/rust-toolchain master composite