| AHELP for CIAO 4.5 Sherpa v1 | get_bkg_scale |
Context: data |
Synopsis
Returns the complete background scaling factor
Syntax
get_bkg_scale( [id] )
Description
The get_bkg_scale() function - not to be confused with the get_backscal() function - returns the value of the coefficient which is used to scale background counts during background subtraction of a source spectrum or a simultaneous fit of source and background spectra (get_backscal() returns the value associated with the OGIP PHA header keyword BACKSCAL, which is only one component of the complete scaling factor). The complete scaling factor used to scale the background counts in these cases consists of the product of the source-to-background exposure and backscal (extraction region area) ratios:
Background-subtracted spectrum (cts/s) = SOURCE_COUNTS/SOURCE_EXPOSURE - BGD_COUNTS/BGD_EXPOSURE/BGD_BACKSCAL*SOURCE_BACKSCAL.
Background scale factor = (SOURCE_EXPOSURE/BACKGROUND_EXPOSURE)*(SOURCE_BACKSCAL/BACKGROUND_BACKSCAL)
This function is useful for manually defining a complete source-plus-background model expression with the set_full_model() and set_bkg_full_model() functions, where the background scale factor is not automatically entered for the user (as is done by the set_model()/set_bkg_model() functions normally used for setting source and background models).
- id - the id of the data set to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
Example 1
sherpa> get_bkg_scale()
When called with no arguments, get_bkg_scale() returns the product of the ratios of the source-to-background spatial extraction region areas (backscal) and exposure times in the default data set (id=1). The exposure and backscal values used in the calculation of the background scale factor may be checked with the get_exposure() and get_backscal() functions.
sherpa> get_bkg_scale() 0.293520462273 sherpa> manual_bkg_scale_check = get_exposure()*get_backscal()/get_exposure(bkg_id=1)/get_backscal(bkg_id=1) sherpa> print manual_bkg_scale_check 0.293520462273
Example 2
sherpa> rsp = get_response() sherpa> bkg_rsp = get_response(bkg_id=1) sherpa> bkg_scale = get_bkg_scale() sherpa> set_full_model(rsp(xsphabs.abs1*powlaw1d.p1) + bkg_scale*bkg_rsp(abs1*powlaw1d.p2)) sherpa> set_bkg_full_model(bkg_rsp(abs1*p2))
The complete convolved model for the source is set, which includes a corresponding background component scaled by the source-to-background exposure and backscal ratios, returned by the get_bkg_scale() function. The function set_bkg_full_model is then used to define the complete convolved background model. This series of commands allows the source and background components to be fitted simultaneously (compare with a background fit using set_source and set_bkg_source, by calling 'print get_model()' and 'print get_bkg_model()').
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- confidence
- get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
- contrib
- get_chart_spectrum
- data
- get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg, get_bkg_plot, get_coord, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_exposure, get_grouping, get_indep, get_quality, get_rmf, get_specresp, get_staterror, get_syserror
- filtering
- get_filter
- fitting
- calc_stat_info, get_fit, get_stat_info
- info
- get_default_id, list_stats
- methods
- get_draws, get_iter_method_name, get_iter_method_opt, get_method
- modeling
- get_model, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_order_plot, get_par, get_pileup_model, get_response, get_source, get_source_component_image, get_source_component_plot, image_source
- plotting
- get_split_plot
- psfs
- get_kernel, get_psf
- statistics
- get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
- utilities
- get_analysis, get_rate
- visualization
- get_ratio, get_resid, image_getregion

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)