scipp / scippnexus

h5py-like utility for NeXus files with seamless scipp integration
https://scipp.github.io/scippnexus/
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

Should loading event data no longer create weights with variances? #91

Closed SimonHeybrock closed 1 year ago

SimonHeybrock commented 1 year ago

After scipp/scipp#2895, broadcasting of variances will no longer be supported. This implies that the "standard" paradigm of handling uncertainties will not be feasible any more. This further implies that there is limited use to carrying uncertainties of "counts", since uncertainties can simply be computed later on.

We should therefore consider avoiding the overhead of creating variances for the weights when an NXdetector with NXevent_data is loaded. This would save both memory and compute resources.

SimonHeybrock commented 1 year ago

Maybe the main question may be plotting: If we do not store variances, users would not see error bars in their plots. Unless @nvaytet thinks that we could change plopp (or provide a convenient option) to automatically show errors for data with unit "counts".

nvaytet commented 1 year ago

I think having special handling of counts units is not a good idea, that's how we ended up doing strange things with the resampling mechanism. As you say, the variances on counts are just something we set by hand, when loading the counts data, it is not there in the data file. And they can be computed later.

Someone, not in neutron science, might want to have counts without variances, why should they suddenly see errorbars on their plot? Which is probably why you mention a convenience method, but I think the convenience method should just be

data.variances = data.data
SimonHeybrock commented 1 year ago

Probably something like this could work:

da.hist(x=1000) \
  .set_uncertainties() \
  .plot()

?

SimonHeybrock commented 1 year ago

I think for now we should move the decision to a higher level: scippnexus should not create variance. Instead loaders in scippneutron or ess may choose to do so, if this is considered more convenient by users.