fit_bkg¶
- sherpa.astro.ui.fit_bkg(id=None, *otherids, **kwargs)¶
Fit a model to one or more background PHA data sets.
Fit only the backgound components of PHA data sets. This can be used to find the best-fit background parameters, which can then be frozen before fitting the data, or to ensure that these parameters are well defined before performing a simultaneous source and background fit.
- Parameters
id (int or str, optional) – The data set that provides the background data. If not given then all data sets with an associated background model are fit simultaneously.
*otherids (sequence of int or str, optional) – Other data sets to use in the calculation.
outfile (str, optional) – If set, then the fit results will be written to a file with this name. The file contains the per-iteration fit results.
clobber (bool, optional) – This flag controls whether an existing file can be overwritten (
True) or if it raises an exception (False, the default setting).
- Raises
sherpa.utils.err.FitErr – If filename already exists and clobber is
False.
See also
confEstimate the confidence intervals using the confidence method.
contour_fitContour the fit to a data set.
covarEstimate the confidence intervals using the confidence method.
fitFit a model to one or more data sets.
freezeFix model parameters so they are not changed by a fit.
get_fit_resultsReturn the results of the last fit.
plot_fitPlot the fit results (data, model) for a data set.
image_fitDisplay the data, model, and residuals for a data set in the image viewer.
set_statSet the statistical method.
set_methodChange the optimization method.
set_method_optChange an option of the current optimization method.
set_bkg_full_modelDefine the convolved background model expression for a PHA data set.
set_bkg_modelSet the background model expression for a PHA data set.
set_full_modelDefine the convolved model expression for a data set.
set_iter_methodSet the iterative-fitting scheme used in the fit.
set_modelSet the model expression for a data set.
show_bkg_sourceDisplay the background model expression for a data set.
show_bkg_modelDisplay the background model expression used to fit a data set.
show_fitSummarize the fit results.
thawAllow model parameters to be varied during a fit.
Notes
This is only for PHA data sets where the background is being modelled, rather than subtracted from the data.
Examples
Simultaneously fit all background data sets with models and then store the results in the variable fres:
>>> fit_bkg() >>> fres = get_fit_results()
Fit the background for data sets 1 and 2, then do a simultaneous fit to the source and background data sets:
>>> fit_bkg(1,2) >>> fit(1,2)