PolynomialFitter#

class glue.core.fitters.PolynomialFitter(**params)[source]#

Bases: BaseFitter1D

A polynomial model.

The degree of the polynomial is specified by degree

Attributes Summary

degree

An integer-valued option.

label

A short label for the fit, used by the GUI

Methods Summary

fit(x, y, dy, constraints[, degree])

Fit a polynomial of order degree to the data.

predict(fit_result, x)

Evaluate the model at a set of locations.

summarize(fit_result, x, y[, dy])

Return a textual summary of the fit.

Attributes Documentation

degree#

An integer-valued option.

Parameters:
minint, optional

The minimum valid value

maxint, optional

The maximum valid value

defaultint, optional

The default value

labelstr, optional

A short label for this option

label = 'Polynomial'#

A short label for the fit, used by the GUI

Methods Documentation

fit(x, y, dy, constraints, degree=2)[source]#

Fit a polynomial of order degree to the data.

predict(fit_result, x)[source]#

Evaluate the model at a set of locations.

This must be overridden in a subclass.

Parameters:
  • fit_result – The result from the fit method

  • x (numpy.ndarray) – Locations to evaluate model at

Returns:

model(x)

Return type:

numpy.ndarray

summarize(fit_result, x, y, dy=None)[source]#

Return a textual summary of the fit.

Parameters:
  • fit_result – The return value from fit()

  • x – The x values passed to fit()

Returns:

A description of the fit result

Return type:

str