tape.analysis.structurefunction2
================================

.. py:module:: tape.analysis.structurefunction2


Attributes
----------

.. autoapisummary::

   tape.analysis.structurefunction2.calc_sf2


Classes
-------

.. autoapisummary::

   tape.analysis.structurefunction2.StructureFunction2


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

.. py:class:: StructureFunction2

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


   Calculate structure function squared


   .. 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) -> Dict[str, type]

      Return the schema of the analysis function output.

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

      :returns: **pd.DataFrame or (str, dtype) tuple or {str** -- Dask meta, for example
                `pd.DataFrame(columns=['x', 'y'], dtype=float)`.
      :rtype: dtype} dictionary



   .. 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=None, band=None, lc_id=None, *, sf_method='basic', argument_container=None) -> pandas.DataFrame

      Calculate structure function squared using one of a variety of structure
      function calculation methods defined by the input argument `sf_method`, or
      in the argument container object.


      :param time: Array of times when measurements were taken. If all array values are
                   `None` or if a scalar `None` is provided, then equidistant time between
                   measurements is assumed.
      :type time: `numpy.ndarray` (N,) or `None`
      :param flux: Array of flux/magnitude measurements.
      :type flux: `numpy.ndarray` (N,)
      :param err: Array of associated flux/magnitude errors. If a scalar value is provided
                  we assume that error for all measurements. If `None` is provided, we
                  assume all errors are 0. By default None
      :type err: `numpy.ndarray` (N,), `float`, or `None`, optional
      :param band: Array of associated band labels, by default None
      :type band: `numpy.ndarray` (N,), optional
      :param lc_id: Array of lightcurve ids per data point. By default None
      :type lc_id: `numpy.ndarray` (N,), optional
      :param sf_method: The structure function calculation method to be used, by default "basic".
      :type sf_method: str, optional
      :param argument_container: Container object for additional configuration options, by default None.
      :type argument_container: StructureFunctionArgumentContainer, optional

      :returns: **sf2** -- Structure function squared for each of input bands.
      :rtype: `pandas.DataFrame`

      .. rubric:: Notes

      In case that no value for `band_to_calc` is passed, the function is
      executed on all available bands in `band`.



.. py:data:: calc_sf2

