pace-neutrons / Herbert

Herbert is the collection of utilities for visualisation and analysis of neutron spectroscopy data. It can be used alone or as the package, which provide low level data manipulation routines for the Horace package
GNU General Public License v3.0
1 stars 0 forks source link

Error variable in IX_dataset sigvar is squared for variance #256

Open cmarooney-stfc opened 4 years ago

cmarooney-stfc commented 4 years ago

https://github.com/pace-neutrons/Herbert/blob/c1593757d975e228a8c008a85d355f0d9245c150/herbert_core/utilities/classes/%40IX_dataset/sigvar.m#L8

Code is "out = sigvar(w.signal, (w.error).^2);"

On the assumption that error is always variance, it looks wrong that the error is squared.

tgperring commented 4 years ago

In the Herbert objects IX_data_1d, IX_data_2d etc., which inherit the abstract class IXdataset, the property 'error ' is the standard error i.e. standard deviation, not the variance. [This is in contrast to sqw, d0d, d1d,... objects in Horace, where the corresponding property is the variance.] The argument that needs to be passed to the sigvar constructor is the variance. This is why in the code snippet you have quoted w.error is squared. So all is OK.

cmarooney-stfc commented 4 years ago

@tgperring This is good, thank you. As we regularly pass data w.s w.e where w.e is variance, it could be good to think of a way to highlight the exceptions to this rule. I did fix something in noisify where the error was squared on processing - hopefully that was a valid fix in the light of this comment.