fit_generic_continuum#

specutils.fitting.fit_generic_continuum(spectrum, median_window=3, model=<Chebyshev1D(3, c0=0., c1=0., c2=0., c3=0.)>, fitter=<astropy.modeling.fitting.TRFLSQFitter object>, exclude_regions=None, weights=None)[source]#

Basic fitting of the continuum of an input spectrum. The input spectrum is smoothed using a median filter to remove the spikes.

Parameters:
spectrumSpectrum1D

The spectrum object whose continuum will be fitted.

modelModel or list of Model

The model or list of models that contain the initial guess.

median_windowfloat

The width of the median smoothing kernel used to filter the data before fitting the continuum. See the kernel_size parameter of medfilt for more information.

fitterFitter

The astropy fitter to use for fitting the model. Default: TRFLSQFitter

exclude_regionsSpectralRegion or None

List of regions to exclude in the fitting. Passed through to the fitmodels routine.

weightslist (NOT IMPLEMENTED YET)

List of weights to define importance of fitting regions.

Returns:
continuum_model

Fitted continuum as a model of whatever class model provides.

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.