Skip to content

Commit

Permalink
added notebook with writeup
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Aug 21, 2024
1 parent 6962fca commit 505d89a
Show file tree
Hide file tree
Showing 3 changed files with 1,930 additions and 3 deletions.
1,921 changes: 1,921 additions & 0 deletions doc/notebooks/weighted_histograms.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/studies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The following studies explore different aspects of the library, including its pe
:maxdepth: 1

notebooks/binned_vs_unbinned
notebooks/weighted_histograms
notebooks/hesse_and_minos
notebooks/numba
notebooks/automatic_differentiation
Expand Down
11 changes: 8 additions & 3 deletions src/iminuit/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -1446,9 +1446,14 @@ def _update_cache(self):
if self._bohm_zech_s is not None:
val = n[..., 0]
var = n[..., 1]
self._bohm_zech_s = np.ones_like(val)
np.divide(np.abs(val), var, out=self._bohm_zech_s, where=var > 0)
self._bohm_zech_n = val * self._bohm_zech_s
s = np.zeros_like(val)
ma = var > 0
s[ma] = np.abs(val[ma]) / var[ma]
# Use median of s from bins with entries to bins which have zero entries.
# This is arbitrary, but still better than other arbitrary choices.
s[~ma] = np.median(s[ma])
self._bohm_zech_s = s
self._bohm_zech_n = val * s
else:
self._bohm_zech_n = n

Expand Down

0 comments on commit 505d89a

Please sign in to comment.