PolynomialFitter

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

Bases: glue.core.fitters.BaseFitter1D

A polynomial model.

The degree of the polynomial is specified by degree

Attributes Summary

degree

An integer-valued option.

label

Methods Summary

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

Fit a polynomial of order degree to the data.

predict(self, fit_result, x)

Evaluate the model at a set of locations.

summarize(self, 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'

Methods Documentation

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

Fit a polynomial of order degree to the data.

predict(self, 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(self, 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