Polynomial

class gdt.core.background.binned.Polynomial(counts, tstart, tstop, exposure)[source]

Bases: object

Class for performing a polynomial fit on Time-Energy data. The fit is performed over the time axis, treating each energy channel separately, although the fits are performed simultaneously.

Parameters:
  • counts (np.array) – The array of counts in each bin, shape (num_times, num_chans)

  • tstart (np.array) – The low-value edges of the time bins, shape (num_times,)

  • tstop (np.array) – The high-value edges of the time bins, shape (num_times,)

  • exposure (np.array) – The exposure of each bin, shape (num_times,)

Attributes Summary

dof

The degrees-of-freedom for each channel

statistic

The fit chi-squared statistic for each channel

statistic_name

'chisq'

Methods Summary

fit([order])

Fit the data with a polynomial.

interpolate(tstart, tstop)

Interpolation of the fitted polynomial

Attributes Documentation

dof

The degrees-of-freedom for each channel

Type:

(np.array)

statistic

The fit chi-squared statistic for each channel

Type:

(np.array)

statistic_name

‘chisq’

Type:

(str)

Methods Documentation

fit(order=0)[source]

Fit the data with a polynomial. Model variances are used for chi-squared via two fitting passes. Adapted from the RMfit polynomial fitter.

Parameters:

order (int) – The order of the polynomial

Returns:

(np.array, np.array) – The fitted model value and model uncertainty at each input bin

interpolate(tstart, tstop)[source]

Interpolation of the fitted polynomial

Parameters:
  • tstart (np.array) – The starting edge of each bin

  • tstop (np.array) – The ending edge of each bin

Returns:

(np.array, np.array) – The interpolated model value and model uncertainty in each bin