Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 13 March 2017

How can I specify which measurement errors to use in fitting a PHA data set?


If the measurement, or statistical, errors associated with a PHA data set are present in the spectrum file to be loaded into Sherpa, they can be loaded in association with the PHA data values by using the load_pha command with its use_errors argument set to "True". Otherwise, the load_staterror command may be used to read in an array of statistical errors.

For example:

sherpa> load_pha("src", "3c273.pi", use_errors=True)
read ARF file 3c273.arf
read RMF file 3c273.rmf
read background file 3c273_bg.pi

sherpa> get_staterror("src")

array([ 4.12310563,  3.87298335, ....,  3.87298335, 4.47213595])


OR


sherpa> load_pha("3c273.pi")
WARNING: systematic errors were not found in file '3c273.pi'
statistical errors were found in file '3c273.pi' 
but not used; to use them, re-read with use_errors=True
read ARF file 3c273.arf
read RMF file 3c273.rmf

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

sherpa> get_staterror()

array([ 3.8942,  3.4892, ....,  3.4892, 4.1527])

If statistical errors are input to Sherpa in association with a data set by using load_pha or load_staterror as demonstrated above, then Sherpa will use these errors in the calculation of the statistic value during a fit to the data set; if not, Sherpa will use the statistical errors it calculates internally, based on the currently chosen fit statistic (default is Chi2Gehrels).

For example, if no statistical errors are read into Sherpa for data set "src", Sherpa will use the errors returned by get_staterror:

sherpa> load_pha("3c273.pi")
WARNING: systematic errors were not found in file '3c273.pi'
statistical errors were found in file '3c273.pi' 
but not used; to use them, re-read with use_errors=True
read ARF file 3c273.arf
read RMF file 3c273.rmf

sherpa> show_stat()
Statistic: Chi2Gehrels
Chi Squared with Gehrels variance

sherpa> get_staterror()

array([ 5.21307489,  4.96862697, ...,   4.96862697, 5.55521679])


Last modified: 13 March 2017
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:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.