Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/set_bkg_full_model.html
Jump to: Description · Example · PARAMETERS · Notes · Bugs · See Also


AHELP for CIAO 4.16 Sherpa

set_bkg_full_model

Context: modeling

Synopsis

Define the convolved background model expression for a PHA data set.

Syntax

set_bkg_full_model(id, model=None, bkg_id=None)

id - int or str, optional
model - str or sherpa.models.Model object
bkg_id - int or str, optional

Description

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.


Example

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)

PARAMETERS

The parameters for this function are:

Parameter Definition
id The data set containing the source expression. If not given then the default identifier is used, as returned by `get_default_id` .
model This defines the model used to fit the data. It can be a Python expression or a string version of it.
bkg_id The identifier for the background of the data set, in cases where multiple backgrounds are provided.

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` .


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

fitting
fit