Last modified: December 2020

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/unpack_pha.html
AHELP for CIAO 4.13 Sherpa v1

unpack_pha

Context: data

Synopsis

Create a PHA data structure.

Syntax

unpack_pha(arg, use_errors=False)

use_errors - bool, optional

Description

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.


Examples

Example 1

>>> pha1 = unpack_arf("src1.pi")
>>> pha2 = unpack_arf("field.pi")
>>> set_data(1, pha1)
>>> set_bkg(1, pha2)

Example 2

Read in a PHA file using Crates:

>>> cr = pycrates.read_file("src.fits")
>>> pha = unpack_pha(cr)

Example 3

Read in a PHA file using AstroPy:

>>> hdus = astropy.io.fits.open("src.fits")
>>> pha = unpack_pha(hdus)

PARAMETERS

The parameters for this function are:

Parameter Definition
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 tablecrate for crates, as used by CIAO, or a list of AstroPy HDU objects.
use_errors If True then the statistical errors are taken from the input data, rather than calculated by Sherpa from the count values. The default is False .

Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

data
dataspace1d, dataspace2d, datastack, fake, fake_pha, load_arf, load_arrays, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_data, load_grouping, load_image, load_multi_arfs, load_multi_rmfs, load_pha, load_quality, load_rmf, load_staterror, load_syserror, load_table, pack_image, pack_pha, pack_table, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_rmf, unpack_table
filtering
load_filter
info
get_default_id, list_bkg_ids, list_data_ids
modeling
add_model, add_user_pars, load_table_model, load_template_interpolator, load_template_model, load_user_model, save_model, save_source
saving
save_arrays, save_data, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table
statistics
load_user_stat