tape.analysis.structure_function.base_calculator
================================================

.. py:module:: tape.analysis.structure_function.base_calculator


Classes
-------

.. autoapisummary::

   tape.analysis.structure_function.base_calculator.StructureFunctionCalculator


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

.. py:class:: StructureFunctionCalculator(lightcurves: List[tape.analysis.structure_function.sf_light_curve.StructureFunctionLightCurve], argument_container: tape.analysis.structure_function.base_argument_container.StructureFunctionArgumentContainer)

   Bases: :py:obj:`abc.ABC`


   This is the base class from which all other Structure Function calculator
   methods inherit. Extend this class if you want to create a new Structure
   Function calculation method.


   .. py:attribute:: _lightcurves


   .. py:attribute:: _argument_container


   .. py:attribute:: _bins


   .. py:attribute:: _binning_method


   .. py:attribute:: _bin_count_target


   .. py:attribute:: _equally_weight_lightcurves


   .. py:attribute:: _dts
      :value: []



   .. py:attribute:: _all_d_fluxes
      :value: []



   .. py:attribute:: _sum_error_squared
      :value: []



   .. py:attribute:: _difference_values_per_lightcurve
      :type:  List[int]
      :value: []



   .. py:method:: calculate()
      :abstractmethod:


      Abstract method that must be implemented by the child class.



   .. py:method:: _bootstrap(random_generator=None)

      This method creates the boostraped samples of difference values



   .. py:method:: _get_difference_values_per_lightcurve()

      Retrieves the number of difference values per lightcurve and stores
      them in an array.



   .. py:method:: _bin_dts(dts)

      Bin an input array of delta times (dts). Supports several binning
      schemes.

      :param dts: 1-d array of delta times to bin
      :type dts: `numpy.ndarray` (N,)

      :returns: **bins** -- The returned bins array.
      :rtype: `numpy.ndarray` (N,)



   .. py:method:: _calculate_binned_statistics(sample_values=None, statistic_to_apply='mean')

      This method will bin delta_t values stored in `self._dts` using the
      bin edges defined by `self._bins`. Then the corresponding `sample_values`
      in each bin will have a statistic measure applied.

      :param sample_values: The values that will be used to calculate the `statistic_to_apply`.
                            If None or not provided, will use `self._all_d_fluxes` by default.
      :type sample_values: `np.ndarray`, optional
      :param statistic_to_apply: The statistic to apply to the values in each delta_t bin, by default
                                 "mean".
      :type statistic_to_apply: str or function, optional

      :returns: A tuple of two lists.
                The first list contains the mean of the delta_t values in each bin.
                The second list contains the result of evaluating the
                statistic measure on the delta_flux values in each delta_t bin.
      :rtype: (`List[float]`, `List[float]`)

      .. rubric:: Notes

      1) Largely speaking this is a wrapper over Scipy's `binned_statistic`,
      so any of the statistics supported by that function are valid inputs here.

      2) It is expected that the shapes of `self._dts` and `sample_values` are
      the same. Additionally, any entry at the i_th index of `self._dts` must
      correspond to the same pair of observations as the entry at the i_th
      index of `sample_values`.



   .. py:method:: name_id() -> str
      :staticmethod:

      :abstractmethod:


      This method will return the unique name of the Structure Function
      calculation method.



   .. py:method:: expected_argument_container() -> type
      :staticmethod:

      :abstractmethod:


      This method will return the argument container class type (not an
      instance) that the Structure Function calculation method requires in
      order to perform it's calculations.



