Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-iminuit for openSUSE:Factory 
checked in at 2022-07-13 13:45:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-iminuit (Old)
 and      /work/SRC/openSUSE:Factory/.python-iminuit.new.1523 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-iminuit"

Wed Jul 13 13:45:44 2022 rev:22 rq:988961 version:2.12.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-iminuit/python-iminuit.changes    
2022-06-23 10:25:28.963819030 +0200
+++ /work/SRC/openSUSE:Factory/.python-iminuit.new.1523/python-iminuit.changes  
2022-07-13 13:46:10.478098780 +0200
@@ -1,0 +2,8 @@
+Mon Jul  4 15:34:09 UTC 2022 - Atri Bhattacharya <badshah...@gmail.com>
+
+- Update to version 2.12.1:
+  * cost.BarlowBeestonLite: method ???hpd??? has been modified to fix
+    performance in cases where bins are not dominated by a single
+    template.
+
+-------------------------------------------------------------------

Old:
----
  iminuit-2.12.0.tar.gz

New:
----
  iminuit-2.12.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-iminuit.spec ++++++
--- /var/tmp/diff_new_pack.dD6t0Q/_old  2022-07-13 13:46:10.850099309 +0200
+++ /var/tmp/diff_new_pack.dD6t0Q/_new  2022-07-13 13:46:10.854099314 +0200
@@ -22,7 +22,7 @@
 %define skip_python36 1
 %define modname iminuit
 Name:           python-%{modname}
-Version:        2.12.0
+Version:        2.12.1
 Release:        0
 Summary:        Python bindings for MINUIT2
 License:        MIT
@@ -32,8 +32,8 @@
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module numpy >= 1.11.3}
 BuildRequires:  %{python_module numpy-devel}
-BuildRequires:  %{python_module pybind11-devel}
 BuildRequires:  %{python_module pybind11 >= 2.9.0}
+BuildRequires:  %{python_module pybind11-devel}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  cmake >= 3.13
 BuildRequires:  fdupes

++++++ iminuit-2.12.0.tar.gz -> iminuit-2.12.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iminuit-2.12.0/PKG-INFO new/iminuit-2.12.1/PKG-INFO
--- old/iminuit-2.12.0/PKG-INFO 2022-06-21 17:25:35.798217500 +0200
+++ new/iminuit-2.12.1/PKG-INFO 2022-07-01 18:30:04.320357800 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: iminuit
-Version: 2.12.0
+Version: 2.12.1
 Summary: Jupyter-friendly Python frontend for MINUIT2 in C++
 Home-page: http://github.com/scikit-hep/iminuit
 Author: Piti Ongmongkolkul and the iminuit team
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iminuit-2.12.0/src/iminuit/cost.py 
new/iminuit-2.12.1/src/iminuit/cost.py
--- old/iminuit-2.12.0/src/iminuit/cost.py      2022-06-21 17:25:02.000000000 
+0200
+++ new/iminuit-2.12.1/src/iminuit/cost.py      2022-07-01 18:29:36.000000000 
+0200
@@ -250,12 +250,11 @@
     return poisson_chi2(n, mu * beta) + np.sum((beta - 1) ** 2 / beta_var)
 
 
-def barlow_beeston_lite_chi2_hpd(n, mu, k):
+def barlow_beeston_lite_chi2_hpd(n, mu, mu_var):
     """
     Compute asymptotically chi2-distributed cost for a template fit.
 
-    Formula derived by H.P. Dembinski, see the Jupyter notebook on Template 
Fits
-    in the iminuit repository.
+    H.P. Dembinski, https://doi.org/10.48550/arXiv.2206.12346
 
     Parameters
     ----------
@@ -264,16 +263,16 @@
     mu : array-like
         Expected counts. This is the sum of the normalised templates scaled
         with the component yields.
-    k : array-like
-        Bin-wise sum over original component templates. Must be positive 
everywhere.
+    mu_var : array-like
+        Expected variance of mu. Must be positive everywhere.
 
     Returns
     -------
     float
         Cost function value.
     """
+    k = mu**2 / mu_var
     beta = (n + k) / (mu + k)
-
     return poisson_chi2(n, mu * beta) + poisson_chi2(k, k * beta)
 
 
@@ -859,7 +858,7 @@
     J.S. Conway, PHYSTAT 2011, https://doi.org/10.48550/arXiv.1103.0354
     """
 
-    __slots__ = "_bbl_data", "_call"
+    __slots__ = "_bbl_data", "_impl"
 
     def __init__(
         self,
@@ -930,24 +929,18 @@
                 temp.append(t)
                 temp_var.append(t)
 
+        nt = []
+        nt_var = []
+        for t, tv in zip(temp, temp_var):
+            f = 1 / np.sum(t)
+            nt.append(t * f)
+            nt_var.append(tv * f**2)
+        self._bbl_data = (nt, nt_var)
+
         if method == "jsc":
-            nt = []
-            nt_var = []
-            for t, tv in zip(temp, temp_var):
-                f = 1 / np.sum(t)
-                nt.append(t * f)
-                nt_var.append(tv * f**2)
-            self._bbl_data = (nt, nt_var)
-            self._call = self._call_jsc
+            self._impl = barlow_beeston_lite_chi2_jsc
         elif method == "hpd":
-            k = np.zeros_like(temp[0])
-            nt = []
-            for t, tv in zip(temp, temp_var):
-                f = 1 / np.sum(t)
-                nt.append(t * f)
-                k += t**2 / (tv + 1e-323)
-            self._bbl_data = (nt, k)
-            self._call = self._call_hpd
+            self._impl = barlow_beeston_lite_chi2_hpd
         else:
             raise ValueError(
                 f"method {method} is not understood, allowed values: {{'jsc', 
'hpd'}}"
@@ -955,7 +948,7 @@
 
         super().__init__(name, n, xe, verbose)
 
-    def _call_jsc(self, args):
+    def _call(self, args):
         ntemp, ntemp_var = self._bbl_data
 
         mu = 0
@@ -975,27 +968,7 @@
             n = self._masked
 
         ma = mu > 0
-        return barlow_beeston_lite_chi2_jsc(n[ma], mu[ma], mu_var[ma])
-
-    def _call_hpd(self, args):
-        ntemp, k = self._bbl_data
-
-        mu = 0
-        for a, nt in zip(args, ntemp):
-            mu += a * nt
-
-        ma = self.mask
-        if ma is not None:
-            mu = mu[ma]
-            k = k[ma]
-
-        if self._bztrafo:
-            n, mu = self._bztrafo(mu)
-        else:
-            n = self._masked
-
-        ma = mu > 0
-        return barlow_beeston_lite_chi2_hpd(n[ma], mu[ma], k[ma])
+        return self._impl(n[ma], mu[ma], mu_var[ma])
 
 
 class BinnedNLL(BinnedCostWithModel):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iminuit-2.12.0/src/iminuit/version.py 
new/iminuit-2.12.1/src/iminuit/version.py
--- old/iminuit-2.12.0/src/iminuit/version.py   2022-06-21 17:25:02.000000000 
+0200
+++ new/iminuit-2.12.1/src/iminuit/version.py   2022-07-01 18:29:36.000000000 
+0200
@@ -7,7 +7,7 @@
 # - Increase MAINTENANCE when fixing bugs without adding features
 # - During development, add suffix .devN with N >= 0
 # - For release candidates, add suffix .rcN with N >= 0
-version = "2.12.0"
+version = "2.12.1"
 
 # We list the corresponding ROOT version of the C++ Minuit2 library here
 root_version = "v6-25-02-1013-ga4bb8f3342"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iminuit-2.12.0/src/iminuit.egg-info/PKG-INFO 
new/iminuit-2.12.1/src/iminuit.egg-info/PKG-INFO
--- old/iminuit-2.12.0/src/iminuit.egg-info/PKG-INFO    2022-06-21 
17:25:35.000000000 +0200
+++ new/iminuit-2.12.1/src/iminuit.egg-info/PKG-INFO    2022-07-01 
18:30:04.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: iminuit
-Version: 2.12.0
+Version: 2.12.1
 Summary: Jupyter-friendly Python frontend for MINUIT2 in C++
 Home-page: http://github.com/scikit-hep/iminuit
 Author: Piti Ongmongkolkul and the iminuit team
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iminuit-2.12.0/tests/test_cost.py 
new/iminuit-2.12.1/tests/test_cost.py
--- old/iminuit-2.12.0/tests/test_cost.py       2022-06-21 17:25:02.000000000 
+0200
+++ new/iminuit-2.12.1/tests/test_cost.py       2022-07-01 18:29:36.000000000 
+0200
@@ -13,7 +13,6 @@
     NormalConstraint,
     BarlowBeestonLite,
     multinominal_chi2,
-    barlow_beeston_lite_chi2_jsc,
     _soft_l1_loss,
     PerformanceWarning,
 )
@@ -800,24 +799,6 @@
     assert c(1) == 0
 
 
-def test_barlow_beeston_lite_chi2_jsc():
-    n = np.array([1, 2, 3])
-    r = barlow_beeston_lite_chi2_jsc(n, n, n**2)
-    assert_allclose(r, 0)
-
-    n = np.array([1, 2, 3])
-    r = barlow_beeston_lite_chi2_jsc(n, n, 10 * n**2)
-    assert_allclose(r, 0)
-
-    mu = np.array([2, 2, 3])
-    r = barlow_beeston_lite_chi2_jsc(n, mu, mu**2)
-    assert r > 0
-
-    mu = np.array([0.999, 2, 3])
-    r = barlow_beeston_lite_chi2_jsc(n, mu, mu**2)
-    assert r > 0
-
-
 @pytest.mark.parametrize("method", ("jsc", "hpd"))
 def test_BarlowBeestonLite(method):
     n = np.array([1, 2, 3])
@@ -872,8 +853,8 @@
                 break
         assert m.valid
         z.append((m.values[1] - truth[1]) / m.errors[1])
-    assert_allclose(np.mean(z), 0, atol=0.2)
-    assert_allclose(np.std(z), 1, rtol=0.15)
+    assert_allclose(np.mean(z), 0, atol=0.15)
+    assert_allclose(np.std(z), 1, rtol=0.1)
 
 
 @pytest.mark.parametrize("method", ("jsc", "hpd"))

Reply via email to