Last modified: December 2014

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.12 Sherpa v1


Context: data


Load PHA source spectra


load_pha( [id], filename|PHACrate, [use_errors=False] )


The load_pha command loads a PHA spectrum from a type I or type II FITS file or a PHACrate and assigns it to a source id. An individual dataset is established for each spectrum in a PHA type II file; the generated ids can be listed with the list_data_ids command ("ahelp list_data_ids").

If the input PHA file contains grouping information, the data are automatically grouped. Sherpa also reads any quality information, allowing the user to filter out bad channels.

Loading Background and Responses

If the header keywords of the PHA file contain ARF, RMF, and background information, the files are automatically read in and assigned to the source dataset. Background and response files may also be loaded manually with the load_bkg ("ahelp load_bkg"), load_arf ("ahelp load_arf"), and load_rmf ("ahelp load_rmf") commands.

Loading Multiple Data Sets

Multiple data sets can be loaded using the datastack syntax, where 'id' is replaced by the datastack identifier ('[]' as default) and the list of data sets is contained in the filename and input as "@filename", e.g. load_*([],'@filename'). See 'datastack' ahelp file for the full description.


Example 1

sherpa> load_pha("source.pha")

A spectrum is loaded from the file source.pha with data id 1 by default.

Example 2

sherpa> load_pha("acis_459_pha2.fits")
sherpa> list_data_ids
sherpa> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

An ACIS/HETG type II PHA file is read into Sherpa, establishing twelve datasets (one for each row in the file).

Example 3

sherpa> load_pha("src", "3c273.pi", use_errors=True")

Read the spectrum from 3c273.pi and give it the id "src". The errors are read from the file as well.

Example 4

sherpa> srcr = read_pha("src.pi")
sherpa> load_pha(srcr)

The PHA file is read into a PHACrate (named "srcr") from src.pi. The source data is then loaded into Sherpa from the crate, using the default options.


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

See Also

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_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_pha, unpack_rmf, unpack_table
get_default_id, list_bkg_ids, list_data_ids
add_model, add_user_pars, load_table_model, load_template_model, load_user_model, save_model, save_source
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