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 Astropymodel
andfitter
classes.In addition, they should override
label
with a better label, andparameter_guesses()
to generate initial guessesAttributes Summary
class to fit the model
UI Label
class describing the model
Built-in mutable sequence.
Methods Summary
fit
(x, y, dy, constraints)Fit the model to data.
parameter_guesses
(x, y, dy)Provide initial guesses for each model parameter.
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
- fitting_cls = None¶
class to fit the model
- label = 'Base Astropy Fitter'¶
UI Label
- model_cls = None¶
class describing the model
Methods Documentation
- fit(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 datay (
numpy.ndarray
) – The y values of the datady (
numpy.ndarray
) – 1 sigma uncertainties on each datum (optional)constraints – The current value of the
constraints
propertyoptions – kwargs for model hyperparameters.
- Returns
An object representing the fit result.
- parameter_guesses(x, y, dy)[source]¶
Provide initial guesses for each model parameter.
The base implementation does nothing, and should be overridden
- Parameters
x (
numpy.ndarray
) – X - values of the datay (
numpy.ndarray
) – Y - values of the datady (
numpy.ndarray
) – uncertainties on Y(assumed to be 1 sigma)
- Returns
A dict mapping
{parameter_name: value guess}
for each parameter
- 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