Meta — Extractor, Bins and Bootstrap¶
light_curve.Extractor
¶
Combine multiple feature extractors into a single callable.
Pass any number of feature objects; the result behaves like a single
feature whose output is the concatenation of all individual outputs.
Use :meth:__call__ for a single light curve or :meth:many for batch
processing. Especially efficient for cheap features because it avoids
repeated passes over the data and reduces Python–Rust call overhead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*features
|
feature objects
|
Any mix of Rust-backed or pure-Python feature instances. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
names |
list of str
|
Concatenated feature names from all sub-features. |
descriptions |
list of str
|
Concatenated descriptions from all sub-features. |
Examples:
>>> import numpy as np
>>> from light_curve import Extractor, Amplitude, StandardDeviation
>>> ext = Extractor(Amplitude(), StandardDeviation())
>>> t = np.array([0.0, 1.0, 2.0, 3.0, 4.0])
>>> m = np.array([15.1, 14.9, 15.2, 15.0, 14.8])
>>> ext(t, m)
array([...])
light_curve.Bins
¶
Bases: _FeatureEvaluator
Sampled time series meta-feature
Binning time series to bins with width \(\mathrm{window}\) with respect to some \(\mathrm{offset}\). \(j-th\) bin interval is \([j \cdot \mathrm{window} + \mathrm{offset}; (j + 1) \cdot \mathrm{window} + \mathrm{offset})\). Binned time series is defined by
where \(N_j\) is a number of sampling observations and all sums are over observations inside considering bin. Bins takes any other feature evaluators to extract features from sample time series
- Depends on: time, magnitude, magnitude error
- Minimum number of observations: as required by sub-features, but at least 1
- Number of features: as provided by sub-features
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
iterable
|
Features to extract from binned time-series |
required |
window
|
positive float
|
Width of binning interval in units of time |
required |
offset
|
float
|
Zero time moment |
required |
transform
|
None
|
Not supported, apply transformations to individual features |
None
|
bands
|
list of str or None
|
Passband names for multiband mode. If given, each single-band feature in
|
required |
Attributes:
| Name | Type | Description |
|---|---|---|
names |
list of str
|
Feature names |
descriptions |
list of str
|
Feature descriptions |
bands |
numpy.ndarray of str or None
|
Passband names for multiband mode, or None for single-band mode |
Methods:
| Name | Description |
|---|---|
__call__ |
Extract features and return them as a numpy array |
many |
Extract features from multiple light curves in parallel |
light_curve.Bootstrap
¶
Bases: _FeatureEvaluator
Bootstrap uncertainty meta-feature
Estimates the uncertainty of feature values by bagging: it draws n_bootstrap resamples of
the light curve, sampling observations with replacement and keeping the original length, and
evaluates the wrapped features on each resample. For every wrapped feature value it returns the
value on the original light curve, followed by a summary of that value's spread over the
resamples — either the sample standard deviation, or the levels given by quantiles.
In single-band mode all n_bootstrap resamples are always evaluated, so the uncertainty is
always defined. In multiband mode the 'rejection' strategy may collect too few valid
resamples, in which case the feature fails and fill_value applies as it does to any other
feature.
Features that cannot be evaluated on a resample are rejected with ValueError:
- features requiring sorting — bagging duplicates observations, which divides by a zero time interval for features that also read time and, even where time is not read, biases statistics built from consecutive differences, since duplicated points sort adjacent and contribute spurious zero-difference terms,
-
features requiring variability — a resample may be constant.
-
Depends on: as required by sub-features
- Minimum number of observations: as required by sub-features, but at least 1
- Number of features:
(1 + n_uncertainty)per sub-feature value, wheren_uncertaintyis 1 for the standard deviation, or the number of quantile levels
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
iterable
|
Features to estimate the bootstrap uncertainty of. Features requiring sorting or variability are rejected: bagging duplicates observations, and a resample may turn out constant |
required |
n_bootstrap
|
int
|
Number of resamples to draw, at least 2 |
100
|
seed
|
int
|
Seed of the random number generator drawing the resamples, which makes the output reproducible |
0
|
quantiles
|
sequence of float or None
|
Quantile levels in [0, 1] to summarise the spread of each feature over the
resamples, e.g. |
None
|
transform
|
None
|
Not supported, apply transformations to individual features |
None
|
bands
|
list of str or None
|
Passband names for multiband mode. If given, each single-band feature in
|
required |
band_strategy
|
str
|
How the multiband light curve is resampled, ignored unless
|
'stratified'
|
max_attempts_factor
|
int
|
Bounds the redrawing budget of the 'rejection' strategy at
|
100
|
Attributes:
| Name | Type | Description |
|---|---|---|
names |
list of str
|
Feature names |
descriptions |
list of str
|
Feature descriptions |
bands |
numpy.ndarray of str or None
|
Passband names for multiband mode, or None for single-band mode |
Methods:
| Name | Description |
|---|---|
__call__ |
Extract features and return them as a numpy array |
many |
Extract features from multiple light curves in parallel |