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

Return the response 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. The get_response function returns the instrument response model.

  • 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.


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

Return type:



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

See also


Return the ARF associated with a PHA data set.


Return the pile up model for a data set.


Return the RMF associated with a PHA data set.


Define the convolved background model expression for a PHA data set.


Define the convolved model expression for a data set.


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, along with a constant component (bgnd) that does not “pass through” the instrument response:

>>> dataspace1d(1, 1024, 1, dstype=DataPHA)
>>> load_arf('src.arf')
>>> load_rmf('src.rmf')
>>> rsp = get_response()
>>> set_full_model(rsp( + const1d.bgnd)