Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

'GetBinError' option #525

Open
chrisstaude opened this issue Oct 19, 2020 · 1 comment
Open

'GetBinError' option #525

chrisstaude opened this issue Oct 19, 2020 · 1 comment

Comments

@chrisstaude
Copy link

I'm looking for a way to add 'GetBinError' with uproot. Is there any possibility yet for matplotlib histograms?

@chrisstaude chrisstaude changed the title Is there a 'GetBinError' option? 'GetBinError' option? Oct 19, 2020
@chrisstaude chrisstaude changed the title 'GetBinError' option? 'GetBinError' option Oct 19, 2020
@jpivarski
Copy link
Member

You can get the values and errors from a histogram using values_errors. To get one bin from that, extract the element of the array.

(It's debatable whether histograms should have a method that only returns errors without also returning the values. Since the calculation of errors often involves calculating values, especially for profiles, such a method would usually be implemented by computing both and then throwing away the unwanted values. Not knowing this, users might think it's better to ask for values and errors separately, which would lead to a lot of wasted calculations.

Also, there's no value to extracting one bin, rather than an array of bins. For non-enormous histograms, the time needed to compute all bins in a vectorized way is about the same as the time needed to compute one bin because the bottleneck is executing Python instructions, not doing math. That only applies to non-enormous histograms—somewhere between millions and billions of bins.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants