fit_lines¶
- specutils.fitting.fit_lines(spectrum, model, fitter=<astropy.modeling.fitting.TRFLSQFitter object>, exclude_regions=None, exclude_region_upper_bounds=False, weights=None, window=None, get_fit_info=False, **kwargs)[source]¶
Fit the input models to the spectrum. The parameter values of the input models will be used as the initial conditions for the fit.
- Parameters:
- spectrum
Spectrum1D
The spectrum object over which the equivalent width will be calculated.
- model: `~astropy.modeling.Model` or list of `~astropy.modeling.Model`
The model or list of models that contain the initial guess.
- fitter
Fitter
, optional Fitter instance to be used when fitting model to spectrum.
- exclude_regionslist of
SpectralRegion
List of regions to exclude in the fitting.
- exclude_region_upper_boundsbool, optional
Set to True to override the default pythonic slicing on the excluded regions (inclusive lower bound, exclusive upper bound) and remove spectral values less than or equal to the upper bound of the region rather than strictly less than the upper bound.
- weightsarray-like or ‘unc’, optional
If ‘unc’, the uncertainties from the spectrum object are used to to calculate the weights. If array-like, represents the weights to use in the fitting. Note that if a mask is present on the spectrum, it will be applied to the
weights
as it would be to the spectrum itself.- window
SpectralRegion
,Quantity
, or list of either Regions of the spectrum to use in the fitting. If None, then the whole spectrum will be used in the fitting. If a single
Quantity
is input, it will be used as the width of the region around the model mean.- get_fit_infobool, optional
Flag to return the
fit_info
from the underlying scipy optimizer used in the fitting. If True, the returned model will have afit_info
key populated in itsmeta
dictionary.- Additional keyword arguments are passed directly into the call to the
- ``fitter``.
- spectrum
- Returns:
- modelsCompound model of
Model
A compound model of models with fitted parameters.
- modelsCompound model of
Notes
Could add functionality to set the bounds in
model
if they are not set.- The models in the list of
model
are added together and passed as a compound model to the
Fitter
class instance.
- The models in the list of