tape.analysis.feature_extractor#

Auxiliary code for time-series feature extraction with “light-curve” package

Classes#

FeatureExtractor

Apply light-curve package feature extractor to a light curve

Module Contents#

class FeatureExtractor(feature: light_curve.light_curve_ext._FeatureEvaluator)[source]#

Bases: tape.analysis.base.AnalysisFunction

Apply light-curve package feature extractor to a light curve

Parameters:

feature (light_curve.light_curve_ext._FeatureEvaluator) – Feature extractor to apply, see “light-curve” package for more details.

feature[source]#

Feature extractor to apply, see “light-curve” package for more details.

Type:

light_curve.light_curve_ext._FeatureEvaluator

feature[source]#
cols(ens: Ensemble) List[str][source]#

Return the column names that the analysis function takes as input.

Parameters:

ens (Ensemble) – The ensemble object, it could be required to get column names of the “special” columns like ens._time_col or ens._err_col.

Returns:

The column names to select and pass to .calculate() method. For example [ens._time_col, ens._flux_col].

Return type:

List[str]

meta(ens: Ensemble) pandas.DataFrame[source]#

Return the schema of the analysis function output.

It always returns a pandas.DataFrame with the same columns as self.feature.names and dtype np.float64. However, if input columns are all single precision floats then the output dtype will be np.float32.

on(ens: Ensemble) List[str][source]#

Return the columns to group source table by.

Parameters:

ens (Ensemble) – The ensemble object.

Returns:

The column names to group by. Typically, [ens._id_col].

Return type:

List[str]

__call__(time, flux, err, band, *, band_to_calc: str, **kwargs) pandas.DataFrame[source]#

Apply a feature extractor to a light curve, concatenating the results over all bands.

Parameters:
  • time (numpy.ndarray) – Time values

  • flux (numpy.ndarray) – Brightness values, flux or magnitudes

  • err (numpy.ndarray) – Errors for “flux”

  • band (numpy.ndarray) – Passband names.

  • band_to_calc (str or int or None) – Name of the passband to calculate features for, usually a string like “g” or “r”, or an integer. If None, then features are calculated for all sources - band is ignored.

  • **kwargs (dict) – Additional keyword arguments to pass to the feature extractor.

Returns:

features – Feature values for each band, dtype is a common type for input arrays.

Return type:

pandas.DataFrame