AstropyFitter1D

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

Bases: glue.core.fitters.BaseFitter1D

A base class for wrapping astropy.modeling.

Subclasses must override model_cls fitting_cls to point to the desired Astropy model and fitter classes.

In addition, they should override label with a better label, and parameter_guesses() to generate initial guesses

Attributes Summary

fitting_cls

class to fit the model

label

UI Label

model_cls

class describing the model

param_names

list() -> new empty list list(iterable) -> new list initialized from iterable’s items

Methods Summary

fit(self, x, y, dy, constraints)

Fit the model to data.

parameter_guesses(self, x, y, dy)

Provide initial guesses for each model parameter.

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

fitting_cls = None

class to fit the model

label = 'Base Astropy Fitter'

UI Label

model_cls = None

class describing the model

param_names[source]

list() -> new empty list list(iterable) -> new list initialized from iterable’s items

Methods Documentation

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

Fit the model to data.

This must be overriden by a subclass.

Parameters
  • x (numpy.ndarray) – The x values of the data

  • y (numpy.ndarray) – The y values of the data

  • dy (numpy.ndarray) – 1 sigma uncertainties on each datum (optional)

  • constraints – The current value of the constraints property

  • options – kwargs for model hyperparameters.

Returns

An object representing the fit result.

parameter_guesses(self, x, y, dy)[source]

Provide initial guesses for each model parameter.

The base implementation does nothing, and should be overridden

Parameters
Returns

A dict mapping {parameter_name: value guess} for each parameter

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