FittingWithOutlierRemoval¶

class
astropy.modeling.fitting.
FittingWithOutlierRemoval
(fitter, outlier_func, niter=3, **outlier_kwargs)[source]¶ Bases:
object
This class combines an outlier removal technique with a fitting procedure. Basically, given a number of iterations
niter
, outliers are removed and fitting is performed for each iteration.Parameters:  fitter : An Astropy fitter
An instance of any Astropy fitter, i.e., LinearLSQFitter, LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter. For model set fitting, this must understand masked input data (as indicated by the fitter class attribute
supports_masked_input
). outlier_func : function
A function for outlier removal. If this accepts an
axis
parameter like thenumpy
functions, the appropriate value will be supplied automatically when fitting model sets (unless overridden inoutlier_kwargs
), to find outliers for each model separately; otherwise, the same filtering must be performed in a loop over models, which is almost an order of magnitude slower. niter : int (optional)
Number of iterations.
 outlier_kwargs : dict (optional)
Keyword arguments for outlier_func.
Methods Summary
__call__
(self, model, x, y[, z, weights])Parameters: Methods Documentation

__call__
(self, model, x, y, z=None, weights=None, **kwargs)[source]¶ Parameters:  model :
FittableModel
An analytic model which will be fit to the provided data. This also contains the initial guess for an optimization algorithm.
 x : arraylike
Input coordinates.
 y : arraylike
Data measurements (1D case) or input coordinates (2D case).
 z : arraylike (optional)
Data measurements (2D case).
 weights : arraylike (optional)
Weights to be passed to the fitter.
 kwargs : dict (optional)
Keyword arguments to be passed to the fitter.
Returns:  fitted_model :
FittableModel
Fitted model after outlier removal.
 mask :
numpy.ndarray
Boolean mask array, identifying which points were used in the final fitting iteration (False) and which were found to be outliers or were masked in the input (True).
 model :