Synopsis
Set the background for a PHA data set.
Syntax
set_bkg(id, bkg=None, bkg_id=None)
Description
The background can either be fit with a model - using `set_bkg_model` - or removed from the data before fitting, using `subtract` .
Examples
Example 1
Copy the background from the default data set to data set 2:
>>> bkg1 = get_bkg() >>> set_bkg(2, bkg1)
Example 2
Read in the PHA data from the file 'bkg.pi' and set it as the second background component of data set "core":
>>> bkg = unpack_pha('bkg.pi') >>> set_bkg('core', bkg, bkg_id=2)
PARAMETERS
The parameters for this function are:
Parameter | Type information | Definition |
---|---|---|
id | int or str, optional | The data set to use. If not given then the default identifier is used, as returned by `get_default_id` . |
bkg | A PHA data set, such as returned by `get_data` or `unpack_pha` . | |
bkg_id | int, str, or None, optional | The identifier for this background, which is needed if there are multiple background estimates for the source. |
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 `bkg` parameter. If given two un-named arguments, then they are interpreted as the `id` and `bkg` parameters, respectively. The remaining parameters are expected to be given as named arguments.
If the background has no grouping of quality arrays then they are copied from the source region. If the background has no response information (ARF or RMF) then the response is copied from the source region.
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- confidence
- set_conf_opt, set_covar_opt, set_proj_opt
- data
- get_bkg, get_bkg_arf, get_bkg_model, get_bkg_rmf, get_bkg_source, set_areascal, set_arf, set_backscal, set_coord, set_counts, set_data, set_dep, set_exposure, set_grouping, set_quality, set_rmf, set_staterror, set_syserror, subtract, unsubtract
- filtering
- set_filter
- info
- list_bkg_ids, show_bkg_model, show_bkg_source
- methods
- set_iter_method, set_iter_method_opt, set_method, set_method_opt
- modeling
- delete_bkg_model, get_par, set_bkg_model, set_bkg_source, set_full_model, set_model, set_par, set_pileup_model, set_source
- plotting
- plot_bkg, plot_bkg_chisqr, plot_bkg_delchi, plot_bkg_fit, plot_bkg_fit_delchi, plot_bkg_fit_resid, plot_bkg_model, plot_bkg_ratio, plot_bkg_resid, plot_bkg_source
- statistics
- set_prior, set_sampler, set_sampler_opt, set_stat
- utilities
- set_analysis, set_default_id
- visualization
- image_setregion