Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: December 2013

URL: http://cxc.harvard.edu/sherpa/ahelp/get_response.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.6 Sherpa v1

get_response

Context: modeling

Synopsis

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

Syntax

get_response([id,bkg_id])

Description

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").

  • id - the ID of the data set; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
  • bkg_id - the ID of the background data set; if not given, uses the default background data set id (id=1, bkg_id=1)

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(powlaw1d.pl))

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(powlaw1d.pl)))
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 =
get_exposure()*get_backscal()/get_exposure(bkg_id=1)/get_backscal(bkg_id
=1)
sherpa>
set_full_model(rsp(xsphabs.abs1*powlaw1d.p1+bkg_scale*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. (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")
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 "ahelp set_full model" for examples).

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_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
filtering
get_filter
fitting
calc_stat_info, get_fit, get_stat_info
info
get_default_id, list_response_ids, 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_source, get_source_component_image, get_source_component_plot, image_source
plotting
get_split_plot, plot_arf
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

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.