- 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_modeldoes for a source. This is for when the background is being fitted simultaneously to the source, rather than subtracted from it.
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.
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
modelparameter. If given two un-named arguments, then they are interpreted as the
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)