Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.11 Sherpa v1


Context: modeling


Get the associated instrument response model of a PHA data set by data ID




The get_response command returns the instrument response model associated with a PHA data set, by data set ID or background data set ID. The returned instrument model can be used to define complex convolved model expressions in Sherpa. For example, the instrument model can be used within the Sherpa model expressions of the set_full_model and set_bkg_full_model commands, which are used for explicitly convolving a source or background model with an associated response (see "ahelp set_full_model").


Example 1

sherpa> load_pha("soure.pi")
sherpa> load_arf("source.arf")
sherpa> load_rmf("source.rmf")
sherpa> rsp = get_response()
sherpa> set_full_model(rsp(

Obtain the instrument response model for data set 1 and convolve it with the source model for this data set, a 1-D powerlaw named "pl". Note that the get_arf() and get_rmf() commands can be used in a similar way, producing equivalent results:

sherpa> load_pha("soure.pi")
sherpa> load_arf("source.arf")
sherpa> load_rmf("source.rmf")
sherpa> arf = get_arf()
sherpa> rmf = get_rmf()
sherpa> set_full_model(rmf(arf(
sherpa> show_model()
Model: 1
apply_rmf(apply_arf((49429.2334679 * powlaw1d.p1)))
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   p1.gamma     thawed            1          -10           10           
   p1.ref       frozen            1 -3.40282e+38  3.40282e+38           
   p1.ampl      thawed            1            0  3.40282e+38           

Example 2

sherpa> load_pha("soure.pi")
sherpa> load_bkg("back.pi")
sherpa> rsp = get_response()
sherpa> bkg_rsp = get_response(bkg_id=1)
sherpa> bkg_scale =
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. (Note that it was not necessary to call load_arf/load_rmf and load_bkg_arf/load_bkg_rmf in this example; this is because the associated source and background response filenames were read from the headers of the source and background spectral files, and automatically loaded into the Sherpa session with load_pha and load_bkg.)

Example 3

sherpa> rsp = get_response("src")

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 "ahelp set_full model" for examples).


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

See Also

get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
get_chart_spectrum, get_marx_spectrum
get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg, get_bkg_plot, get_bkg_scale, 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, load_arf, load_bkg_arf, load_bkg_rmf, load_multi_arfs, load_multi_rmfs, load_rmf, set_arf, set_rmf, unpack_arf, unpack_rmf
calc_stat_info, get_fit, get_stat_info
get_default_id, list_response_ids, list_stats
get_draws, get_iter_method_name, get_iter_method_opt, get_method
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_source, get_source_component_image, get_source_component_plot, image_source
get_split_plot, plot_arf
get_kernel, get_psf
get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
get_analysis, get_rate
get_ratio, get_resid, image_getregion