Python code for doing error propagation pretty quick.
Features
- Automatic error propagation
- Compute weighted averages
The following is an example which calculates the gravitational acceleration
Error propagation for
>>> from errorprop import *
>>> measurements = np.array([2.77,2.81,2.93,2.95,2.49,2.81,2.95,2.76])
>>> T = MeasuredQuantity(measurements, err_sys=0.3)
>>> print(T)
2.809 ± 0.3 ± 0.1
>>> l = Quantity(1.84, err_sys=0.7E-2, err_stat=0)
>>> print(l)
1.84 ± 0.007
>>> g = 4*np.pi**2*l/T**2
>>> print(g)
9.208 ± 2.002 ± 0.656
See tutorial.ipynb for a thorough walkthrough. You can download this repository to play around with the jupyter notebook on your computer.
- Download the
errorprop.py
file and put it into the same directory as your jupyter notebook. - Add the following import to your notebook:
from errorprop import *
- Start doing error propagation... ;-)
Feel free to open an issue on this repository if something's not working properly.