get_staterror
- sherpa.ui.get_staterror(id=None, filter=False)
Return the statistical error on the dependent axis of a data set.
The function returns the statistical errors on the values (dependenent axis) of a data set. These may have been set explicitly - either when the data set was created or with a call to
set_staterror
- or as defined by the chosen fit statistic (such as “chi2gehrels”).- Parameters
id (int or str, optional) – The identifier for the data set to use. If not given then the default identifier is used, as returned by
get_default_id
.filter (bool, optional) – Should the filter attached to the data set be applied to the return value or not. The default is
False
.
- Returns
staterrors – The statistical error for each data point. This may be estimated from the data (e.g. with the
chi2gehrels
statistic) or have been set explicitly (set_staterror
). The size of this array depends on thefilter
argument.- Return type
array
- Raises
sherpa.utils.err.IdentifierErr – If the data set does not exist.
See also
get_error
Return the errors on the dependent axis of a data set.
get_indep
Return the independent axis of a data set.
get_syserror
Return the systematic errors on the dependent axis of a data set.
list_data_ids
List the identifiers for the loaded data sets.
set_staterror
Set the statistical errors on the dependent axis of a data set.
Notes
The default behavior is to not apply any filter defined on the independent axes to the results, so that the return value is for all points (or bins) in the data set. Set the
filter
argument toTrue
to apply this filter.Examples
If not explicitly given, the statistical errors on a data set may be calculated from the data values (the independent axis), depending on the chosen statistic:
>>> load_arrays(1, [10, 15, 19], [4, 5, 9]) >>> set_stat('chi2datavar') >>> get_staterror() array([ 2. , 2.23606798, 3. ]) >>> set_stat('chi2gehrels') >>> get_staterror() array([ 3.17944947, 3.39791576, 4.122499 ])
If the statistical errors are set - either when the data set is created or with a call to
set_staterror
- then these values will be used, no matter the statistic:>>> load_arrays(1, [10, 15, 19], [4, 5, 9], [2, 3, 5]) >>> set_stat('chi2datavar') >>> get_staterror() array([2, 3, 5]) >>> set_stat('chi2gehrels') >>> get_staterror() array([2, 3, 5])