get_response
- sherpa.astro.ui.get_response(id: IdType | None = None, bkg_id: IdType | None = 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. Theget_responsefunction returns the instrument response model.- Parameters:
id (int, str, or None, 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, str, or None, 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_arfReturn the ARF associated with a PHA data set.
get_pileup_modelReturn the pile up model for a data set.
get_rmfReturn the RMF associated with a PHA data set.
set_bkg_full_modelDefine the convolved background model expression for a PHA data set.
set_full_modelDefine 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
powlaw1dmodel 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(powlaw1d.pl) + const1d.bgnd)