Asymmetric Uncertainty¶
asymmetric_uncertainty provides objects for representing and propagating
numeric quantities with asymmetric uncertainties. Its primary interface is the
asymmetric_uncertainty.a_u class.
Getting started¶
Installation¶
Install the latest version directly from GitHub with pip:
pip install git+https://github.com/cgobat/asymmetric_uncertainty.git
Alternatively, clone the repository and install it locally:
git clone https://github.com/cgobat/asymmetric_uncertainty
cd asymmetric_uncertainty
pip install .
Basic usage¶
The package’s main utility is the asymmetric_uncertainty.a_u class,
which represents and manipulates numbers with asymmetric errors:
from asymmetric_uncertainty import a_u
Create an instance as a_u(nominal, pos_err, neg_err), where nominal is
the central value and pos_err and neg_err are the positive- and
negative-side uncertainties:
x = a_u(3.0, 0.2, 0.4)
print(x + 1)
4.0 (+0.2, -0.4)
Instances can also be created from strings in either asymmetric form:
x = a_u("3.0 (+0.2, -0.4)")
or symmetric form:
x = a_u("3.0 +/- 0.3")
In the case of symmetric errors, the Unicode plus-minus symbol (±) is also
accepted; for example, a_u("3.0 ± 0.3").
Arithmetic applies the ordinary operation to the nominal values and propagates
the positive and negative uncertainties locally with first-order derivatives
and quadrature. Distribution methods such as pdf(), cdf(), and
rvs() additionally interpret the same three stored values as the mode and
two Gaussian widths of a split-normal distribution.
More examples are available in the example Jupyter notebook.
See the API reference for the complete public interface and Special features for additional behavior.
Documentation¶
Special features — uncertainty propagation, distribution utilities, formatting, and edge cases.
Statistical model and interpretation — the split-normal model, its assumptions, and alternative statistical conventions.
Related software — comparison with other uncertainty-handling packages.
API reference — classes, functions, and attributes.
Project links and citations¶
This package is free software, and its source code is available on GitHub. If you use this package in published work, please cite its ASCL entry (bibcode:2022ascl.soft08005G).
Applications¶
asymmetric_uncertainty was originally developed for and subsequently used
in the following projects:
C. Gobat et al. (2023), MNRAS 523(1), 775. bibcode:2023MNRAS.523..775G.
GitHub repo: cgobat/dark-GRBs
C. Gobat et al. (2022), RNAAS 6(8), 163. bibcode:2022RNAAS…6..163G.
GitHub repo: cgobat/XDBS
A (potentially non-exhaustive) list of other works that have used this software can be retrieved from SciX/ADS: