Set the complete convolved source and background model expressions to be used for fitting a data set
set_full_model([id], model) set_bkg_full_model([id], model)
The functions set_full_model() and set_bkg_full_model() allow users to define model expressions that apply instrument responses, or PSFs, to some model components, while not applying the response or the PSF to other model components in the model expression. An example of this kind of model is an expression where a spectral model is defined in energy space, and folded through a response matrix; then, a background model defined in *counts*, which is *not* folded through the response, is added to the model expression.
The set_full_model command allows the user to explicitly set the complete convolved model expression to be used for fitting a data set, e.g., in place of the automatic version of the function, set_source. It may be used to establish complex convolution model components to model specific background features, e.g., in the scenario in which the background emission cannot be disentangled from the source emission in a diffuse source. The set_bkg_full_model command is available for simultaneously fitting a source data set and its corresponding background data set.
Users should note that the Sherpa functions which are related to a source or background model defined with set_source or set_bkg_source, such as plot_source/plot_bkg_source or calc_energy_flux, are not compatible with the complete model expression defined by the set_full_model or set_bkg_full_model functions. In order to use these Sherpa functions, users should define source and background models in the usual way with the automatic functions set_source and set_bkg_source. Similarly, if a PSF model is explicitly convolved with a source model in a set_full_model expression - which does not require a call to set_psf - then the functions show_psf, show_kernel, image_kernel, plot_psf, and other Sherpa PSF functions will not work. To use these functions, the PSF model should be added to the instrument list in the usual way with set_psf (see "ahelp set_psf"), and the source model defined with set_source.
- id - the id of the data set; if not given, uses the default data set id (id=1 by default, see "ahelp get_default_id")
- model - the complete convolved model expression to use as the full model; for a list of all available models, see "ahelp models"
sherpa> rsp = get_response() sherpa> set_full_model(rsp(powlaw1d.pl))
Obtain the instrument response for default data set id=1 using get_response(), and convolve it with the source model of data set 1, a 1-D powerlaw named "pl". This series of commands is the manual-equivalent of the command 'set_source("powlaw1d.pl")', which automatically convolves the response associated with data set 1 with the specified source model.
sherpa> rmf = get_rmf(2) sherpa> arf = get_arf(2) sherpa> set_full_model(2, rmf(arf(xswabs.a1 * xsbbody.b2)))
Use both the get_rmf() and get_arf() commands (in lieu of get_response()) to obtain the instrument response, and convolve it with the source model for data set 2 in the set_full_model expression.
sherpa> rsp = get_response("src") sherpa> set_full_model("src","rsp(bbody.bb+powlaw1d.pl)+gauss1d.line1+gauss1d.li ne2")
The complete convolved model for data set "src" is built from four different model components plus an instrument response. The black-body and power-law model components are convolved with the response, whereas the Gaussian model components are not convolved with the response. Note that in this instance the model components which are convolved with the response are in energy space, while the unconvolved components are in channel space. The use of set_full_model in this way is especially useful in the context where a separate background spectrum is not available, e.g., to model the instrumental background emission contributing to a diffuse source which covers the entire field of view of the observation. The set_bkg_full_model function ought to be used where a separate background file is available (see Example 5 below).
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 backscale ratios. 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()').
sherpa> load_image("subimage_bin.fits") sherpa> load_psf("psf1","psf.fits") sherpa> set_full_model(psf1(gauss2d.g1) + beta2d.b1+const2d.c1)
An image data set is loaded into Sherpa along with a PSF model from file. The set_full_model function is used to explicitly convolve the PSF model with one component of the full, multi-component source model expression. When a PSF is explicitly convolved with a source model using the set_full_model function, it is not necessary to add the PSF to the instrument with set_psf (see "ahelp set_psf").
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
- set_conf_opt, set_covar_opt, set_proj_opt
- get_bkg_plot, set_areascal, set_arf, set_backscal, set_bkg, set_coord, set_counts, set_data, set_exposure, set_grouping, set_quality, set_rmf, set_staterror, set_syserror
- list_model_ids, show_bkg_model, show_bkg_source
- set_iter_method, set_iter_method_opt, set_method, set_method_opt
- add_model, add_user_pars, clean, create_model_component, delete_bkg_model, delete_model, delete_model_component, get_model, get_model_autoassign_func, 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_source, get_source_component_image, get_source_component_plot, image_model, image_model_component, image_source, image_source_component, integrate, integrate1d, link, load_table_model, load_template_model, load_user_model, normal_sample, reset, save_model, save_source, set_bkg_model, set_model_autoassign_func, set_par, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset, t_sample, uniform_sample
- get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, plot_cdf, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
- delete_psf, load_conv
- save_delchi, save_resid
- set_prior, set_sampler, set_sampler_opt, set_stat
- calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth, set_analysis, set_default_id
- contour_model, contour_ratio, contour_resid, get_ratio, get_resid, image_setregion