get_staterror¶
-
sherpa.ui.get_staterror(id=None, filter=False)¶ Return the statistical error on the dependent axis of a data set.
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: axis – The statistical error for each data point. This may be estimated from the data (e.g. with the
chi2gehrelsstatistic) or have been set explicitly (set_staterror).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.
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])