get_response

sherpa.astro.ui.get_response(id=None, bkg_id=None)

Return the respone information applied to a PHA data set.

For a PHA data set, the source model - created by set_model - is modified by a model representing the instrumental effects - such as the effective area of the mirror, the energy resolution of the detector, and any model of pile up - which is collectively known as the instrument response.

Parameters:
  • id (int or str, optional) – The data set containing the instrument response. If not given then the default identifier is used, as returned by get_default_id.
  • bkg_id (int or str, optional) – If given, return the response for the given background component, rather than the source.
Returns:

The return value depends on whether an ARF, RMF, or pile up model has been associated with the data set.

Return type:

response

Raises:

sherpa.utils.err.ArgumentErr – If the data set does not contain PHA data.

See also

get_arf()
Return the ARF associated with a PHA data set.
get_pileup_model()
Return the pile up model for a data set.
get_rmf()
Return the RMF associated with a PHA data set.
set_bkg_full_model()
Define the convolved background model expression for a PHA data set.
set_full_model()
Define the convolved model expression for a data set.

Examples

Create an empty PHA data set, load in an ARF and RMF, and then retrieve the response. The response is then used to model the instrument response applied to a powlaw1d model component:

>>> dataspace1d(1, 1024, 1, dstype=DataPHA)
>>> load_arf('src.arf')
>>> load_rmf('src.rmf')
>>> rsp = get_response()
>>> mdl = rsp(powlaw1d.pl)