Skip to content

Commit

Permalink
fix: variances was missing sqrt (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii authored Mar 16, 2021
1 parent 4e1c461 commit 62fdc1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
Version 2.2.1
--------------------

* Fix bug with `plot_pull` missing a sqrt.
`#150 <https://github.com/scikit-hep/hist/pull/150>`_

* Fix static typing with ellipses.
`#145 <https://github.com/scikit-hep/hist/pull/145>`_

Expand Down
7 changes: 6 additions & 1 deletion src/hist/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ def plot_pull(

# Computation and Fit
values = self.values()
yerr = self.variances()
variances = self.variances()
if variances is None:
raise RuntimeError(
"Cannot compute from a variance-less histogram, try a Weight storage"
)
yerr = np.sqrt(variances)

# Compute fit values: using func as fit model
popt, pcov = curve_fit(f=func, xdata=self.axes[0].centers, ydata=values)
Expand Down

0 comments on commit 62fdc1f

Please sign in to comment.