threeML.utils.time_series.polynomial module

class threeML.utils.time_series.polynomial.Polynomial(coefficients: Iterable[float], is_integral: bool = False)[source]

Bases: object

property coefficients

Gets or sets the coefficients of the polynomial.

property covariance_matrix: ndarray
property degree: int

the polynomial degree :return:

property error

the error on the polynomial coefficients :return:

classmethod from_previous_fit(coefficients, covariance) Polynomial[source]
integral(xmin, xmax) float[source]

Evaluate the integral of the polynomial between xmin and xmax

integral_error(xmin, xmax) float[source]

computes the integral error of an interval :param xmin: start of the interval :param xmax: stop of the interval :return: interval error

set_covariace_matrix(matrix) None[source]
threeML.utils.time_series.polynomial.polyfit(x: Iterable[float], y: Iterable[float], grade: int, exposure: Iterable[float], bayes: bool | None = False) Tuple[Polynomial, float][source]

function to fit a polynomial to data. not a member to allow parallel computation

Parameters:
  • x – the x coord of the data

  • y – the y coord of the data

  • grade – the polynomical order or grade

  • expousure – the exposure of the interval

  • bayes – to do a bayesian fit or not

threeML.utils.time_series.polynomial.unbinned_polyfit(events: Iterable[float], grade: int, t_start: Iterable[float], t_stop: Iterable[float], exposure: float, bayes: bool) Tuple[Polynomial, float][source]

function to fit a polynomial to unbinned event data. not a member to allow parallel computation

Parameters:
  • events – the events to fit

  • grade – the polynomical order or grade

  • t_start – the start time to fit over

  • t_stop – the end time to fit over

  • expousure – the exposure of the interval

  • bayes – to do a bayesian fit or not