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.

  • 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 one or more data sets.


Define the convolved model expression for a data set.


Include a model of the Chandra ACIS pile up when fitting PHA data.


Add a PSF model to a data set.


Set the source model expression for a data set.


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.


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 by xsphabs * 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)