class xspec.FakeitSettings(response='', arf='', background='', exposure='', correction='', backExposure='', fileName='')

Fakeit command settings class.


To run fakeit, you call the AllData.fakeit() function (see the DataManager class description). FakeitSettings objects hold the information which gets passed to AllData.fakeit().

The AllData.fakeit function will apply 1 FakeitSettings object to every fake spectrum that is to be created. If the user does not explicitly supply their own FakeitSettings objects, AllData.fakeit will create its own as necessary, with default settings.


  • __init__


  • response

    Name of detector response file to use for creating the fake spectrum.

    When a fake spectrum is based on a pre-existing spectrum which already has a response, this should be left empty. If a name is given it will be IGNORED. However if the pre-existing spectrum has no response, then this MUST be filled.

    If the fake spectrum is not based on an existing spectrum, this may be filled or left empty. If it is empty, XSPEC will just use its built-in dummy response.

  • arf

    Name of optional arf to use with the response. This is ignored if no response is given.

  • background

    Name of optional background file to use when creating the fake spectrum.

    If based on an original spectrum, leave this empty to use the original spectrum's background settings.

  • exposure

    The fake spectrum exposure time.

  • correction

    Optional correction norm factor.

  • backExposure

    Optional background exposure time modifier.

    For exposure and correction, if left empty fakeit will use the values from the original spectrum, or 1.0 if not based on an original spectrum. Each of these may be entered as a string or float.

  • fileName

    Optional fake spectrum output file name.

    If left empty, fakeit will create a default file name based on the original spectrum, or the response name if no original spectrum. In the latter case, the default names will also have an incremented suffix to prevent file overwriting.

When writing to a multiple-spectrum output file (OGIP type-2), exposure, correction, backExposure, and fileName are applied to the entire file rather than a single spectrum. Therefore entries for these attributes will be IGNORED for all but the first fake spectrum in a type-2 output file.

__init__(response='', arf='', background='', exposure='', correction='', backExposure='', fileName='')

Create a FakeitSettings object.

All arguments are optional, and all may be entered as strings. The exposure and correction arguments may also be entered as floats.

This can also create a new copy of a pre-existing FakeitSettings object, in which case the pre-existing object should be the only argument entered.


fs1 = FakeitSettings("resp1.pha", exposure=1500.0)
# Reuse fs1's settings, but with a new fileName attribute:
fs2 = FakeitSettings(fs1)
fs2.fileName = "fakeit2.pha"
# Now generate 2 fake spectra
AllData.fakeit(2, [fs1, fs2])