Response1D

class sherpa.astro.instrument.Response1D(pha)[source] [edit on github]

Bases: NoNewAttributesAfterInit

A factory class for generating the instrument response.

This should not be used when a pileup model is required.

Parameters:

pha (sherpa.astro.data.DataPHA instance) – The data object which defines the channel grid and instrument response. There must be either an ARF or RMF associated with the dataset.

Raises:

sherpa.utils.err.DataErr – The argument does not contain any response information (it is missing an ARF and a RMF).

Notes

When the object is called it can be sent a session parameter, which defines the session to use when converting a string model to a ArithmeticModel instance. It is not used for any other function. The default value for this parameter is None, in which case the code uses the sherpa.astro.ui._session object.

The response will include the exposure time if is is defined in either the PHA or ARF datasets (PHA taking precedence). The final response will be one of RSPModelPHA, ARFModelPHA, or RMFModelPHA.

Examples

Add the response to a model (src_model) and then evaluate it. The response will ignore the input argument, and evaluate it for all channels (hence the use of a dummy argument [1]):

>>> rsp = Response1D(pha)
>>> full_model = rsp(src_model)
>>> ycnts = full_model([1])