<jupyter_start><jupyter_text>Examples of how to use asymmetric_uncertainties package python module available on [Github](https://github.com/muryelgp/asymmetric_uncertainties/).  Basic Functions<jupyter_code>from asymmetric_uncertainties import aufloat<jupyter_output><empty_output><jupyter_text>A measurment with some uncertanty, for exaple:$a = 10^{+0.5}_{-1.0}$ and$b = 20^{+3.0}_{-2.0}$ with errors at a 68% confidence level are instanciated as 'aufloat' objects:<jupyter_code>a = aufloat(10, 1.0, 0.5, confidence = 68)
b = aufloat(20, 2.0 ,3.0, confidence = 68)<jupyter_output><empty_output><jupyter_text>The confidence levels of the errors can be pass through 'confidence' parameter, with 3 pre-defined options:                           Confidence    Δχ2                               68%       1.0                              90%       2.7                              95%       4.0                              for example at 90% confidence (Δχ2 = 2.7)<jupyter_code>c = aufloat(10, 1.1, 0.7, confidence = 90)<jupyter_output><empty_output><jupyter_text>Or another Δχ2 value can be pass through 'delta_chi2' parameter:<jupyter_code>d = aufloat(10, 2.0, 0.7, delta_chi2 = 4.7)<jupyter_output><empty_output><jupyter_text>You can print the objects with:<jupyter_code>print(a)<jupyter_output>1.00e+01 (-1.00e+00/+5.00e-01)
68% confidence level (Δχ2=1.00)<jupyter_text>Plotting Each 'aufloat' has a Probability Distribution Function (PDF), you can plot it by doing:<jupyter_code>c.plot_pdf()<jupyter_output><empty_output><jupyter_text>It also has a Δχ2 curve:<jupyter_code>c.plot_delta_chi2_curve()<jupyter_output><empty_output><jupyter_text>Propagation of uncertanties For simple operations (sum, subtraction, division, product and power) are straigthfoward by using standart python operations between 'aufloat' objects:<jupyter_code>e = c + d #or using other operations like -, *, / and **
print(e)<jupyter_output>1.97e+01 (-1.78e+00/+1.10e+00)
90% confidence level (Δχ2=2.71)<jupyter_text>Other functions/operations are deal as follows:assume you have $a = 10^{+1.5}_{-3.0}$ and$b = 20^{+1.5}_{-5.5}$ and you want to calculate and propagate the uncertanties of $c = log(a~.b) = log(10^{+1.5}_{-3.0}~. 20^{+1.5}_{-5.5})$<jupyter_code>a = aufloat(10, 3.0, 1.5, confidence = 90) #creating a and b objects
b = aufloat(20, 5.5 ,1.5, confidence = 90) 


a_data = a.gen_data() #sampling for the Monte Carlo simulation
b_data = b.gen_data()
import numpy as np
c_data = np.log(a_data*b_data)
#Create a new 'aufloat' passing the parameter data (array-like) instead of the nominal values and errors
c = aufloat(data =c_data, confidence = 90) 


#or in one step:
c = aufloat(data =np.log(a.gen_data()*b.gen_data()), confidence = 90) 
c.plot_delta_chi2_curve()
print(c)<jupyter_output><empty_output><jupyter_text>i.e. $c = 5.22^{+0.23}_{-0.58}$  Rescaling uncertanties The uncertanties can be rescaled, for example from 90% to 68% confidence level, using:<jupyter_code>c.rescale_uncertainties(confidence = 68)
c.plot_delta_chi2_curve()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12921164540399083, 'fraction_numerical': 0.056591429506051685, 'mean_word_length': 4.490125673249551, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '386373', 'license': 'MIT', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1087, 'n_words': 271, 'path': 'asymmetric_uncertainties/how-to.ipynb', 'repo_name': 'muryelgp/asymmetric_uncertainties', 'size': '3057'}