You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importuncertaintiesasucx=uc.ufloat(1, 0.5, "x_error_name", error_group="stats")
y=uc.ufloat(-1, 0.7, "y_error_name2", error_group="syst")
z=x+yprint("z: {:L}".format(z))
print("z.std_dev: {}".format(z.std_dev)) # Acts as the independent sum in quadrature of all error groups
would print something like
z: 0 \pm 0.5 \pm 0.7
z.std_dev: 0.86023252670426
This would provide a few advantages over manually calculating separate errors including having proper error propagation for both groups independently.
Changes/improvements to syntax/methods names/etc. are welcome.
The text was updated successfully, but these errors were encountered:
The interaction of a form like 0±0.5±0.7 with formatting is not fully trivial I guess (because the nominal value and the uncertainty use the same format, so here we would have to find a meaningful common format for three or more numbers), but it is worth investigating.
Now, what you propose should definitely be complemented by a way of specifying the order in which each group prints their uncertainty (or we don't know which error comes from where, which makes the feature less useful).
I would suggest to proceed as follows:
Maybe a first attempt at providing this kind of feature would be to not go through a new format, but to provide some convenient access to each group error and let the user print them. That should be quite easy to implement.
A next step could be to offer some formatting facility so that the nominal value and errors are printed in some particularly legible way (maybe like 1.234 ± 0.021 ± 0.001?).
Then later a formatting option could be considered.
I am not promising anything in terms of timeline (I want to implement some speed up idea that I worked on more recently (see issue #53), and I feel that providing some deeper support for arrays is more urgent). However, adding the concept of error groups and providing some interface to them should be quite doable for external contributors: pull requests are welcome!
I propose something like the following:
would print something like
This would provide a few advantages over manually calculating separate errors including having proper error propagation for both groups independently.
Changes/improvements to syntax/methods names/etc. are welcome.
The text was updated successfully, but these errors were encountered: