- sherpa.astro.ui.unpack_pha(arg, use_errors=False)¶
Create a PHA data structure.
Any instrument or background data sets referenced in the header of the PHA file - e.g. with the ANCRFILE, RESPFILE, and BACKFILE keywords - will also be loaded.
arg – Identify the PHA file: a file name, or a data structure representing the data to use, as used by the I/O backend in use by Sherpa: a
TABLECratefor crates, as used by CIAO, or a list of AstroPy HDU objects.
use_errors (bool, optional) – If
Truethen the statistical errors are taken from the input data, rather than calculated by Sherpa from the count values. The default is
- Return type
>>> pha1 = unpack_arf("src1.pi") >>> pha2 = unpack_arf("field.pi") >>> set_data(1, pha1) >>> set_bkg(1, pha2)
Read in a PHA file using Crates:
>>> cr = pycrates.read_file("src.fits") >>> pha = unpack_pha(cr)
Read in a PHA file using AstroPy:
>>> hdus = astropy.io.fits.open("src.fits") >>> pha = unpack_pha(hdus)