sherpa.astro.ui.set_exposure(id, exptime=None, bkg_id=None)

Change the exposure time of a PHA data set.

The exposure time of a PHA data set is taken from the EXPOSURE keyword in its header, but it can be changed once the file has been loaded.

  • id (int or str, optional) – The identifier for the data set to use. If not given then the default identifier is used, as returned by get_default_id.

  • exptime (num) – The exposure time, in seconds.

  • bkg_id (int or str, optional) – Set to identify which background component to set. The default value (None) means that this is for the source component of the data set.

See also


Return the exposure time of a PHA data set.


Change the fractional area factor of a PHA data set.


Change the area scaling of a PHA data set.


The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the exptime parameter. If given two un-named arguments, then they are interpreted as the id and exptime parameters, respectively. The remaining parameters are expected to be given as named arguments.


Increase the exposure time of the default data set by 5 per cent.

>>> etime = get_exposure()
>>> set_exposure(etime * 1.05)

Use the EXPOSURE value from the ARF, rather than the value from the PHA file, for data set 2:

>>> set_exposure(2, get_arf(2).exposure)

Set the exposure time of the second background component of the ‘jet’ data set.

>>> set_exposure('jet', 12324.45, bkg_id=2)