set_bkg_full_model¶
-
sherpa.astro.ui.
set_bkg_full_model
(id, model=None, bkg_id=None)¶ Define the convolved background model expression for a PHA data set.
Set a model expression for a background data set in the same way that set_full_model does for a source. This is for when the background is being fitted simultaneously to the source, rather than subtracted from it.
Parameters: - id (int or str, optional) – The data set containing the source expression. If not given then the default identifier is used, as returned by get_default_id.
- model (str or sherpa.models.Model object) – This defines the model used to fit the data. It can be a Python expression or a string version of it.
- bkg_id (int or str, optional) – The identifier for the background of the data set, in cases where multiple backgrounds are provided.
See also
fit()
- Fit one or more data sets.
set_full_model()
- Define the convolved model expression for a data set.
set_pileup_model()
- Include a model of the Chandra ACIS pile up when fitting PHA data.
set_psf()
- Add a PSF model to a data set.
set_model()
- Set the source model expression for a data set.
Notes
The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the model parameter. If given two un-named arguments, then they are interpreted as the id and model parameters, respectively.
Some functions - such as plot_bkg_source - may not work for model expressions created by set_bkg_full_model.
Examples
The background is fit by two power laws - one that is passed through the instrument response (
gbgnd
) and one that is not (pbgnd
). The source is modelled byxsphabs * galabs
, together with the background model, scaled by the ratio of area and time. Note that the background component in the source expression uses the source response rather than background response.>>> rsp = get_response() >>> bresp = get_response(bkg_id=1) >>> bscale = get_bkg_scale() >>> smodel = xsphabs.galabs * xsapec.emiss >>> bmdl = brsp(powlaw1d.gbdng) + powlaw1d.pbgnd >>> smdl = rsp(smodel) + bscale*(rsp(gbgnd) + pbgnd) >>> set_full_model(smdl) >>> set_bkg_full_model(bmdl)