Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2014

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.9 Sherpa v1


Context: data


Load a PHA background spectrum


load_bkg( [id], filename|PHACrate, [use_errors=False], [bkg_id=None] )


The load_bkg command loads a PHA background spectrum from a FITS file or a PHACrate and assigns it to a source id. The background dataset if its source id is reassigned to a new dataset.

  • id - the id of the dataset to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
  • filename|PHACrate - the name of the file (with path) or PHACrate which contains the PHA data
  • use_errors - read the statistical errors from the PHA file? default=False
  • bkg_id - the id of the background, if the response is a background response; default=None

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 Responses

If the header keywords of the PHA file contain ARF and RMF information, the files are automatically read in and assigned as the background responses. Background response files may also be loaded manually with the load_bkg_arf ("ahelp load_bkg_arf") and load_bkg_rmf ("ahelp load_bkg_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_bkg("back.pha")

A background spectrum is loaded from the file back.pha and assigned to the default dataset.

Example 2

sherpa> load_bkg("src", "3c273_bkg.pi", use_errors="True", bkg_id="bkg")

Read the background spectrum from 3c273_bkg.pi, give it the id "bkg", and assign it to the dataset "src". The errors are read from the file as well.

Example 3

sherpa> backcr = read_pha("back.pi")
sherpa> load_bkg(backcr)

The background PHA file is read into a PHACrate (named "backcr") from back.pi. The background 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, load_arf, load_arrays, load_ascii, 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_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

Last modified: December 2014
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.