- sherpa.astro.ui.unpack_bkg(arg, use_errors=False)
Create a PHA data structure for a background data set.
Any instrument information referenced in the header of the PHA file - e.g. with the ANCRFILE and RESPFILE, keywords - will also be loaded. Unlike
unpack_pha, background files will not 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_bkg("field.pi") >>> set_data(1, pha1) >>> set_bkg(1, pha2)
Read in a PHA file using Crates:
>>> cr = pycrates.read_file("bg.fits") >>> pha = unpack_pha(cr)
Read in a PHA file using AstroPy:
>>> hdus = astropy.io.fits.open("bg.fits") >>> pha = unpack_pha(hdus)