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

Jump to: Description · Examples · See Also

AHELP for CIAO 4.9 Sherpa v1


Context: data


Load statistical errors


load_staterror( [id=1], filename, [bkg_id], [options] )


The load_staterror command loads a user-input statistical error array from a FITS table or column-based text file for 1D data, or an error map from a FITS image for 2D data. The source dataset must be loaded before the statistical errors can be associated with it. The get_staterror command is available for accessing the array(s) of statistical error values.

Statistical errors are added in quadrature with systematic errors (if specified) to produce an overall error estimate in each data bin. If the statistical errors are not loaded, it is assumed that they are zero.

  • 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")
  • bkg_id - the id of the background, if the errors are for a background dataset; default=None
  • filename - the name of the FITS or column-based ASCII file (with path) which contains the error data
  • options - optional arguments. The allowed options depend on the file type.

Options for a FITS file: [ncols=2,colkeys=None]

  • ncols - number of columns to read; default=2
  • colkeys - list of column names; default=None

Options for an ASCII file: [ncols=2, colkeys=None, sep=" ", comment='#']

  • ncols - number of columns to read; default=2
  • colkeys - list of column names; default=None
  • sep - the column-separating character; default is a space (" ")
  • comment - character which indicates a comment line; default=#

Example 1

sherpa> load_data("src", "3c273.pi")
sherpa> load_staterror("src", "3c273.pi[cols channel,stat_err]")

A spectrum is loaded from the file 3c273.pi with data id "src". The statistical errors for the dataset are then loaded from the same input file by specifying the columns "channel" and "staterrs".

Example 2

sherpa> load_staterror("staterror.txt", bkg_id=1)

Statistical errors for the background with bkg_id=1 of the default dataset are read from the first two columns (the default) of the ASCII file staterror.txt.

Example 3

sherpa> load_image(3, "src_image.fits")
sherpa> load_staterror(3, "staterror_img.fits")

Source image data is loaded into the Sherpa session and assigned to data set ID 3 with the load_image command. The statistical errors map associated with the source image is loaded for data set 3 with the load_staterror command.

sherpa> load_image(3, "src_image.fits")
sherpa> load_staterror(3, "staterror_img.fits")

sherpa> show_data(3)
Data Set: 1
name = src_image.fits
x0 = Float64[56376]
x1 = Float64[56376]
y = Float64[56376]
shape = (216, 261)
staterror = Float64[56376]
syserror = None
sky = physical
crval = [ 3798.5 4019.5]
crpix = [ 0.5 0.5]
cdelt = [ 2. 2.]
eqpos = world
crval = [ 278.386 -10.5899]
crpix = [ 4096.5 4096.5]
cdelt = [-0.0001 0.0001]
crota = 0
epoch = 2000
equinox = 2000
coord = logical

See Also

dataspace1d, dataspace2d, datastack, fake, 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_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 2013
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.