:py:mod:`tape.analysis.feature_extractor`
=========================================

.. py:module:: tape.analysis.feature_extractor

.. autoapi-nested-parse::

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



Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   tape.analysis.feature_extractor.FeatureExtractor




.. py:class:: FeatureExtractor(feature: light_curve.light_curve_ext._FeatureEvaluator)


   Bases: :py:obj:`tape.analysis.base.AnalysisFunction`

   Apply light-curve package feature extractor to a light curve

   :param feature: Feature extractor to apply, see "light-curve" package for more details.
   :type feature: light_curve.light_curve_ext._FeatureEvaluator

   .. attribute:: feature

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

      :type: light_curve.light_curve_ext._FeatureEvaluator

   .. py:method:: cols(ens: Ensemble) -> List[str]

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

      :param ens: The ensemble object, it could be required to get column names of
                  the "special" columns like `ens._time_col` or `ens._err_col`.
      :type ens: Ensemble

      :returns: The column names to select and pass to .calculate() method.
                For example `[ens._time_col, ens._flux_col]`.
      :rtype: List[str]


   .. py:method:: meta(ens: Ensemble) -> pandas.DataFrame

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


   .. py:method:: on(ens: Ensemble) -> List[str]

      Return the columns to group source table by.

      :param ens: The ensemble object.
      :type ens: Ensemble

      :returns: The column names to group by. Typically, `[ens._id_col]`.
      :rtype: List[str]


   .. py:method:: __call__(time, flux, err, band, *, band_to_calc: str, **kwargs) -> pandas.DataFrame

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

      :param time: Time values
      :type time: `numpy.ndarray`
      :param flux: Brightness values, flux or magnitudes
      :type flux: `numpy.ndarray`
      :param err: Errors for "flux"
      :type err: `numpy.ndarray`
      :param band: Passband names.
      :type band: `numpy.ndarray`
      :param band_to_calc: 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.
      :type band_to_calc: `str` or `int` or `None`
      :param \*\*kwargs: Additional keyword arguments to pass to the feature extractor.
      :type \*\*kwargs: `dict`

      :returns: **features** -- Feature values for each band, dtype is a common type for input arrays.
      :rtype: pandas.DataFrame



