varchasgopalaswamy / AutoUncertainties

Drop-in Uncertainty Propagation with Automatic Differentiation
https://autouncertainties.readthedocs.io/en/latest/
Other
4 stars 1 forks source link

mean function is not correctly implemented #1

Open MichaelTiemannOSC opened 1 year ago

MichaelTiemannOSC commented 1 year ago

The pandas_compat library treats "mean" as something that can be simply delegated to np.nanmean. This ignores the proper calculation of mean for uncertainties. See https://stackoverflow.com/a/74137209/1291237

varchasgopalaswamy commented 1 year ago

@MichaelTiemannOSC, I can see why the error-weighted mean would be useful/valueable/the right thing to do in many (or even all) cases, but I feel a little uncomfortable having anything in the library give different results than the equivalent op on the nominal values. What I mean by that is that I would expect

operator(Uncertainty(value,error)).value == operator(value)

I think one could manually apply the weights and take the moment, but having a shorthand for error-weighted moments might make sense to add, so you don't have to manually apply the weights every time. Thoughts?