tape.analysis.structure_function.sf_light_curve#

Module Contents#

Classes#

StructureFunctionLightCurve

This base class is meant to support various analysis routines and be

Attributes#

MIN_OBSERVATIONS_REQUIRED_FOR_SF

MIN_OBSERVATIONS_REQUIRED_FOR_SF = 3[source]#
class StructureFunctionLightCurve(times: numpy.ndarray, fluxes: numpy.ndarray, errors: numpy.ndarray)[source]#

Bases: tape.analysis.light_curve.LightCurve

This base class is meant to support various analysis routines and be extended as needed. (Hence it’s location in the analysis package.)

The base class ensures that the data for a single lightcurve is well formed. Namely that the input data is all of the same length, with NaN’s removed and that there are enough observations to perform a given analysis.

_calculate_differences()[source]#

Calculate the difference between all possible pairs of time and flux. Also calculate the sum of all possible pairs of error^2. To avoid duplicate values, we filter out any differences that correspond to a time difference less than 0.

select_difference_samples(number_of_samples: int | None = None, random_generator: numpy.random.Generator | None = None)[source]#

Take a random sample of time and flux differences and the sum of squared errors. The samples are selected without replacement. The resulting sub-sample is not guaranteed to have the same order as the input differences.

Parameters:
  • number_of_samples (int, optional) – Defines the number of samples to be randomly selected from the total number of difference values. If not specified, take all of the avaliable values

  • random_generator (np.random.Generator, optional) – A Numpy random.Generator to sample the lightcurve difference. This allows for repeatable random samples to be selected. By default None.

Raises:

ValueError – If samples are requested than are present in the light curve raise ValueError.