LinearLSQFitter¶

class
astropy.modeling.fitting.
LinearLSQFitter
[source] [edit on github]¶ Bases:
object
A class performing a linear least square fitting.
Uses
numpy.linalg.lstsq
to do the fitting. Given a model and data, fits the model to the data and changes the model’s parameters. Keeps a dictionary of auxiliary fitting information.Notes
Note that currently LinearLSQFitter does not support compound models.
Attributes Summary
supported_constraints
supports_masked_input
Methods Summary
__call__
(model, x, y[, z, weights, rcond])Fit data to this model. Attributes Documentation

supported_constraints
= ['fixed']¶

supports_masked_input
= True¶
Methods Documentation

__call__
(model, x, y, z=None, weights=None, rcond=None)[source] [edit on github]¶ Fit data to this model.
Parameters:  model :
FittableModel
model to fit to x, y, z
 x : array
Input coordinates
 y : arraylike
Input coordinates
 z : arraylike (optional)
Input coordinates. If the dependent (
y
orz
) coordinate values are provided as anumpy.ma.MaskedArray
, any masked points are ignored when fitting. Note that model set fitting is significantly slower when there are masked points (not just an empty mask), as the matrix equation has to be solved for each model separately when their coordinate grids differ. weights : array (optional)
Weights for fitting. For data with Gaussian uncertainties, the weights should be 1/sigma.
 rcond : float, optional
Cutoff ratio for small singular values of
a
. Singular values are set to zero if they are smaller thanrcond
times the largest singular value ofa
. equivalencies : list or None, optional and keywordonly argument
List of additional equivalencies that are should be applied in case x, y and/or z have units. Default is None.
Returns:  model_copy :
FittableModel
a copy of the input model with parameters set by the fitter
 model :
