tape.analysis.structure_function.base_calculator#

Classes#

StructureFunctionCalculator

This is the base class from which all other Structure Function calculator

Module Contents#

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

Bases: 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.

_lightcurves[source]#
_argument_container[source]#
_bins[source]#
_binning_method[source]#
_bin_count_target[source]#
_equally_weight_lightcurves[source]#
_dts = [][source]#
_all_d_fluxes = [][source]#
_sum_error_squared = [][source]#
_difference_values_per_lightcurve: List[int] = [][source]#
abstract calculate()[source]#

Abstract method that must be implemented by the child class.

_bootstrap(random_generator=None)[source]#

This method creates the boostraped samples of difference values

_get_difference_values_per_lightcurve()[source]#

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

_bin_dts(dts)[source]#

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

Parameters:

dts (numpy.ndarray (N,)) – 1-d array of delta times to bin

Returns:

bins – The returned bins array.

Return type:

numpy.ndarray (N,)

_calculate_binned_statistics(sample_values=None, statistic_to_apply='mean')[source]#

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.

Parameters:
  • sample_values (np.ndarray, optional) – 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.

  • statistic_to_apply (str or function, optional) – The statistic to apply to the values in each delta_t bin, by default “mean”.

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.

Return type:

(List[float], List[float])

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.

static name_id() str[source]#
Abstractmethod:

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

static expected_argument_container() type[source]#
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.