get_fitter

sofia_redux.toolkit.fitting.fitpeaks1d.get_fitter(fitter_class, robust=None, outlier_func=<function robust_masking>, outlier_iter=None, **kwargs)[source]

Creates the object fitting a model to data

Parameters:
fitter_classclass of fitting object

Typically a “solver” from scipy.optimize or astropy.modeling that when instatiated will create a solver such that:

fitted_model = solver(model, x, y)

robustdict or bool, optional

If supplied, sets the outlier rejection threshold during fitting. The outlier function itself may be specified via outlier_func.

outlier_funcfunction, optional

A function of the form data_out = outlier_func(data_in). You may do anything at all to the data such as clipping, but perhaps the simplest option is to convert the data to a np.ma.MaskedArray and set the mask (True=bad) while returning the original data untouched.

outlier_iterint, optional

The maximum number of iterations if rejecting outliers. Defaults to 3.

kwargsdict, optional

Additional keywords to pass into the solver during initialization.

Returns:
instance of fitting object or function