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-03-06 18:15:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-iminuit (Old) and /work/SRC/openSUSE:Factory/.python-iminuit.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-iminuit" Sun Mar 6 18:15:51 2022 rev:19 rq:959729 version:2.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-iminuit/python-iminuit.changes 2022-01-21 01:26:25.122176468 +0100 +++ /work/SRC/openSUSE:Factory/.python-iminuit.new.1958/python-iminuit.changes 2022-03-06 18:16:09.047829055 +0100 @@ -1,0 +2,10 @@ +Sat Mar 5 15:40:18 UTC 2022 - Atri Bhattacharya <badshah...@gmail.com> + +- Update to version 2.10.0: + * Minuit.draw_mncontour now works with matplotlib >= 3.5. + * Builtin cost functions now work correctly when the mask is set + and data is updated on the existing cost function. + * Builtin cost functions are now more performant when used with + weighted binned data. + +------------------------------------------------------------------- Old: ---- iminuit-2.9.0.tar.gz New: ---- iminuit-2.10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-iminuit.spec ++++++ --- /var/tmp/diff_new_pack.BKk9Yp/_old 2022-03-06 18:16:09.579829127 +0100 +++ /var/tmp/diff_new_pack.BKk9Yp/_new 2022-03-06 18:16:09.587829128 +0100 @@ -22,7 +22,7 @@ %define skip_python36 1 %define modname iminuit Name: python-%{modname} -Version: 2.9.0 +Version: 2.10.0 Release: 0 Summary: Python bindings for MINUIT2 License: MIT ++++++ iminuit-2.9.0.tar.gz -> iminuit-2.10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/PKG-INFO new/iminuit-2.10.0/PKG-INFO --- old/iminuit-2.9.0/PKG-INFO 2022-01-09 15:13:19.922676000 +0100 +++ new/iminuit-2.10.0/PKG-INFO 2022-03-04 17:01:36.374506200 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: iminuit -Version: 2.9.0 +Version: 2.10.0 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.9.0/pyproject.toml new/iminuit-2.10.0/pyproject.toml --- old/iminuit-2.9.0/pyproject.toml 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/pyproject.toml 2022-03-04 17:01:07.000000000 +0100 @@ -1,7 +1,6 @@ [build-system] requires = [ "setuptools>=42", - "wheel", "cmake", ] build-backend = "setuptools.build_meta" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/fcn.cpp new/iminuit-2.10.0/src/fcn.cpp --- old/iminuit-2.9.0/src/fcn.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/fcn.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,14 +1,14 @@ #include "fcn.hpp" +#include "type_caster.hpp" #include <Minuit2/FCNGradientBase.h> #include <Minuit2/MnPrint.h> -#include <pybind11/numpy.h> -#include <pybind11/pybind11.h> #include <cmath> #include <cstdint> #include <limits> +#include <pybind11/numpy.h> +#include <pybind11/pybind11.h> #include <sstream> #include <vector> -#include "type_caster.hpp" namespace py = pybind11; using namespace ROOT::Minuit2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/functionminimum.cpp new/iminuit-2.10.0/src/functionminimum.cpp --- old/iminuit-2.9.0/src/functionminimum.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/functionminimum.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,3 +1,5 @@ +#include "equal.hpp" +#include "fcn.hpp" #include <Minuit2/FunctionMinimum.h> #include <Minuit2/MinimumSeed.h> #include <Minuit2/MinimumState.h> @@ -9,8 +11,6 @@ #include <pybind11/stl.h> #include <type_traits> #include <vector> -#include "equal.hpp" -#include "fcn.hpp" namespace py = pybind11; using namespace ROOT::Minuit2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/functionminimum_extra.cpp new/iminuit-2.10.0/src/functionminimum_extra.cpp --- old/iminuit-2.9.0/src/functionminimum_extra.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/functionminimum_extra.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,3 +1,5 @@ +#include "equal.hpp" +#include "fcn.hpp" #include <Minuit2/AnalyticalGradientCalculator.h> #include <Minuit2/FunctionMinimum.h> #include <Minuit2/MinimumState.h> @@ -11,8 +13,6 @@ #include <pybind11/pybind11.h> #include <type_traits> #include <vector> -#include "equal.hpp" -#include "fcn.hpp" namespace py = pybind11; using namespace ROOT::Minuit2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/iminuit/cost.py new/iminuit-2.10.0/src/iminuit/cost.py --- old/iminuit-2.9.0/src/iminuit/cost.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/iminuit/cost.py 2022-03-04 17:01:07.000000000 +0100 @@ -86,23 +86,23 @@ # precision. Fall back to plain numpy for float128 which is not currently supported # by numba. try: - import numba as nb - from numba.extending import overload + from numba import njit as _njit + from numba.extending import overload as _overload _log_poisson_part_np = _log_poisson_part - @overload(_log_poisson_part, inline="always") + @_overload(_log_poisson_part, inline="always") def _log_poisson_part_ol(n, mu): return _log_poisson_part_np # pragma: no cover _z_squared_np = _z_squared - @overload(_z_squared, inline="always") + @_overload(_z_squared, inline="always") def _z_squared_ol(y, ye, ym): return _z_squared_np # pragma: no cover _sum_log_x_np = _sum_log_x - _sum_log_x_nb = nb.njit( + _sum_log_x_nb = _njit( nogil=True, cache=True, error_model="numpy", @@ -114,7 +114,7 @@ return _sum_log_x_np(x) _sum_log_poisson_part_np = _sum_log_poisson_part - _sum_log_poisson_part_nb = nb.njit( + _sum_log_poisson_part_nb = _njit( nogil=True, cache=True, error_model="numpy", @@ -126,7 +126,7 @@ return _sum_log_poisson_part_np(n, mu) _sum_log_poisson_np = _sum_log_poisson - _sum_log_poisson_nb = nb.njit( + _sum_log_poisson_nb = _njit( nogil=True, cache=True, error_model="numpy", @@ -139,7 +139,7 @@ return _sum_log_poisson_np(n, mu) _sum_z_squared_np = _sum_z_squared - _sum_z_squared_nb = nb.njit( + _sum_z_squared_nb = _njit( nogil=True, cache=True, error_model="numpy", @@ -152,7 +152,7 @@ return _sum_z_squared_np(y, ye, ym) _sum_z_squared_soft_l1_np = _sum_z_squared_soft_l1 - _sum_z_squared_soft_l1_nb = nb.njit( + _sum_z_squared_soft_l1_nb = _njit( nogil=True, cache=True, error_model="numpy", @@ -164,8 +164,6 @@ # fallback to numpy for float128 return _sum_z_squared_soft_l1_np(y, ye, ym) - del nb - del overload except ModuleNotFoundError: # pragma: no cover pass @@ -403,7 +401,7 @@ class UnbinnedCost(MaskedCost): """Base class for unbinned cost functions.""" - __slots__ = "_model" + __slots__ = "_model", "_log" @Cost.ndata.getter def ndata(self): @@ -411,9 +409,10 @@ # unbinned likelihoods have infinite degrees of freedom return np.inf - def __init__(self, data, model: Callable, verbose): + def __init__(self, data, model: Callable, verbose: int, log: bool): """For internal use.""" self._model = model + self._log = log super().__init__(describe(model)[1:], _norm(data), verbose) @@ -431,7 +430,7 @@ """Get probability density model.""" return self._model - def __init__(self, data, pdf: Callable, verbose: int = 0): + def __init__(self, data, pdf: Callable, verbose: int = 0, log: bool = False): """ Initialize UnbinnedNLL with data and model. @@ -445,14 +444,22 @@ verbose : int, optional Verbosity level. 0: is no output (default). 1: print current args and negative log-likelihood value. + log : bool, optional + Distributions of the exponential family (normal, exponential, poisson, ...) + allow one to compute the logarithm of the pdf directly, which is more + accurate and efficient than effectively doing ``log(exp(logpdf))``. Set this + to True, if the model returns the logarithm of the pdf instead of the pdf. + Default is False. """ - super().__init__(data, pdf, verbose) + super().__init__(data, pdf, verbose, log) def _call(self, args): data = self._masked - pdf = self._model(data, *args) - pdf = _check_model_output(pdf) - return -2.0 * _sum_log_x(pdf) + x = self._model(data, *args) + x = _check_model_output(x) + if self._log: + return -2.0 * np.sum(x) + return -2.0 * _sum_log_x(x) class ExtendedUnbinnedNLL(UnbinnedCost): @@ -469,7 +476,7 @@ """Get density model.""" return self._model - def __init__(self, data, scaled_pdf: Callable, verbose: int = 0): + def __init__(self, data, scaled_pdf: Callable, verbose: int = 0, log: bool = False): """ Initialize cost function with data and model. @@ -484,16 +491,22 @@ verbose : int, optional Verbosity level. 0: is no output (default). 1: print current args and negative log-likelihood value. + log : bool, optional + Distributions of the exponential family (normal, exponential, poisson, ...) + allow one to compute the logarithm of the pdf directly, which is more + accurate and efficient than effectively doing ``log(exp(logpdf))``. Set this + to True, if the model returns the logarithm of the density as the second + argument instead of the density. Default is False. """ - super().__init__(data, scaled_pdf, verbose) + super().__init__(data, scaled_pdf, verbose, log) def _call(self, args): data = self._masked - ns, spdf = self._model(data, *args) - spdf = _check_model_output( - spdf, "Model should return numpy array in second position" - ) - return 2.0 * (ns - _sum_log_x(spdf)) + ns, x = self._model(data, *args) + x = _check_model_output(x, "Model should return numpy array in second position") + if self._log: + return 2 * (ns - np.sum(x)) + return 2 * (ns - _sum_log_x(x)) class BinnedCost(MaskedCost): @@ -870,7 +883,7 @@ def _call(self, args): delta = self._value - args if self._covinv.ndim < 2: - return np.sum(delta ** 2 * self._covinv) + return np.sum(delta**2 * self._covinv) return np.einsum("i,ij,j", delta, self._covinv, delta) @Cost.ndata.getter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/iminuit/minuit.py new/iminuit-2.10.0/src/iminuit/minuit.py --- old/iminuit-2.9.0/src/iminuit/minuit.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/iminuit/minuit.py 2022-03-04 17:01:07.000000000 +0100 @@ -1162,7 +1162,7 @@ for p in self.params: if p.is_fixed: continue - matrix[i, i] = p.error ** 2 + matrix[i, i] = p.error**2 i += 1 if "grad" in r: # trust-constr has "grad" and "jac", but "grad" is "jac"! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/iminuit/pdg_format.py new/iminuit-2.10.0/src/iminuit/pdg_format.py --- old/iminuit-2.9.0/src/iminuit/pdg_format.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/iminuit/pdg_format.py 2022-03-04 17:01:07.000000000 +0100 @@ -257,10 +257,10 @@ if leader is None: # invalid leading error, cannot determine digits - scale = 10 ** -n_exp + scale = 10**-n_exp return ([fmt(v * scale, 4) for v in values], n_exp) - scale = 10 ** -n_exp + scale = 10**-n_exp digits = round(lerror * scale, 3) if digits < 0.355: n_digits = 2 @@ -290,7 +290,7 @@ if i != leader else math.copysign(digits, values[leader]) ) - * 10 ** shift, + * 10**shift, n_digits - shift, ) for (i, x) in enumerate(values) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/iminuit/testing.py new/iminuit-2.10.0/src/iminuit/testing.py --- old/iminuit-2.9.0/src/iminuit/testing.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/iminuit/testing.py 2022-03-04 17:01:07.000000000 +0100 @@ -11,7 +11,7 @@ https://en.wikipedia.org/wiki/Rosenbrock_function """ - return (1 - x) ** 2 + 100 * (y - x ** 2) ** 2 + return (1 - x) ** 2 + 100 * (y - x**2) ** 2 rosenbrock.errordef = 1 @@ -19,7 +19,7 @@ def rosenbrock_grad(x, y): """Gradient of Rosenbrock function.""" - return (-400 * x * (-(x ** 2) + y) + 2 * x - 2, -200 * x ** 2 + 200 * y) + return (-400 * x * (-(x**2) + y) + 2 * x - 2, -200 * x**2 + 200 * y) def ackley(x, y): @@ -30,7 +30,7 @@ """ from math import sqrt, exp, cos, pi, e - term1 = -20 * exp(-0.2 * sqrt(0.5 * (x ** 2 + y ** 2))) + term1 = -20 * exp(-0.2 * sqrt(0.5 * (x**2 + y**2))) term2 = -exp(0.5 * (cos(2 * pi * x) + cos(2 * pi * y))) return term1 + term2 + 20 + e @@ -45,8 +45,8 @@ https://en.wikipedia.org/wiki/Test_functions_for_optimization """ term1 = 1.5 - x + x * y - term2 = 2.25 - x + x * y ** 2 - term3 = 2.625 - x + x * y ** 3 + term2 = 2.25 - x + x * y**2 + term3 = 2.625 - x + x * y**3 return term1 * term1 + term2 * term2 + term3 * term3 @@ -59,7 +59,7 @@ https://en.wikipedia.org/wiki/Test_functions_for_optimization """ - return 0.26 * (x ** 2 + y ** 2) - 0.48 * x * y + return 0.26 * (x**2 + y**2) - 0.48 * x * y matyas.errordef = 1 @@ -73,7 +73,7 @@ """ import numpy as np - return np.sum(x ** 2) + return np.sum(x**2) sphere_np.errordef = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/iminuit/version.py new/iminuit-2.10.0/src/iminuit/version.py --- old/iminuit-2.9.0/src/iminuit/version.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/iminuit/version.py 2022-03-04 17:01:07.000000000 +0100 @@ -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.9.0" +version = "2.10.0" # We list the corresponding ROOT version of the C++ Minuit2 library here root_version = "v6-25-01-1694-g187368db19" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/iminuit.egg-info/PKG-INFO new/iminuit-2.10.0/src/iminuit.egg-info/PKG-INFO --- old/iminuit-2.9.0/src/iminuit.egg-info/PKG-INFO 2022-01-09 15:13:19.000000000 +0100 +++ new/iminuit-2.10.0/src/iminuit.egg-info/PKG-INFO 2022-03-04 17:01:36.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: iminuit -Version: 2.9.0 +Version: 2.10.0 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.9.0/src/migrad.cpp new/iminuit-2.10.0/src/migrad.cpp --- old/iminuit-2.9.0/src/migrad.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/migrad.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,7 +1,7 @@ +#include "fcn.hpp" #include <Minuit2/FCNBase.h> #include <Minuit2/MnMigrad.h> #include <pybind11/pybind11.h> -#include "fcn.hpp" namespace py = pybind11; using namespace ROOT::Minuit2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/minimumstate.cpp new/iminuit-2.10.0/src/minimumstate.cpp --- old/iminuit-2.9.0/src/minimumstate.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/minimumstate.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,10 +1,10 @@ +#include "lasymmatrix.hpp" +#include "lavector.hpp" #include <Minuit2/MinimumState.h> +#include <cmath> #include <pybind11/pybind11.h> #include <pybind11/stl.h> -#include <cmath> #include <type_traits> -#include "lasymmatrix.hpp" -#include "lavector.hpp" namespace py = pybind11; using namespace ROOT::Minuit2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/minuitparameter.cpp new/iminuit-2.10.0/src/minuitparameter.cpp --- old/iminuit-2.9.0/src/minuitparameter.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/minuitparameter.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,7 +1,7 @@ +#include "equal.hpp" #include <Minuit2/MinuitParameter.h> #include <pybind11/operators.h> #include <pybind11/pybind11.h> -#include "equal.hpp" namespace ROOT { namespace Minuit2 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/printimpl.cpp new/iminuit-2.10.0/src/printimpl.cpp --- old/iminuit-2.9.0/src/printimpl.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/printimpl.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,5 +1,5 @@ -#include <pybind11/pybind11.h> #include "Minuit2/MnPrint.h" +#include <pybind11/pybind11.h> using ROOT::Minuit2::MnPrint; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/simplex.cpp new/iminuit-2.10.0/src/simplex.cpp --- old/iminuit-2.9.0/src/simplex.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/simplex.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,7 +1,7 @@ +#include "fcn.hpp" #include <Minuit2/FCNBase.h> #include <Minuit2/MnSimplex.h> #include <pybind11/pybind11.h> -#include "fcn.hpp" namespace py = pybind11; using namespace ROOT::Minuit2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/strategy.cpp new/iminuit-2.10.0/src/strategy.cpp --- old/iminuit-2.9.0/src/strategy.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/strategy.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,7 +1,7 @@ +#include "equal.hpp" #include <Minuit2/MnStrategy.h> #include <pybind11/operators.h> #include <pybind11/pybind11.h> -#include "equal.hpp" namespace ROOT { namespace Minuit2 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/type_caster.hpp new/iminuit-2.10.0/src/type_caster.hpp --- old/iminuit-2.9.0/src/type_caster.hpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/type_caster.hpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,6 +1,6 @@ +#include <algorithm> #include <pybind11/numpy.h> #include <pybind11/pybind11.h> -#include <algorithm> #include <vector> namespace pybind11 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/usercovariance.cpp new/iminuit-2.10.0/src/usercovariance.cpp --- old/iminuit-2.9.0/src/usercovariance.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/usercovariance.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,9 +1,9 @@ +#include "equal.hpp" +#include "type_caster.hpp" #include <Minuit2/MnUserCovariance.h> #include <pybind11/operators.h> #include <pybind11/pybind11.h> #include <vector> -#include "equal.hpp" -#include "type_caster.hpp" namespace ROOT { namespace Minuit2 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/src/userparameterstate.cpp new/iminuit-2.10.0/src/userparameterstate.cpp --- old/iminuit-2.9.0/src/userparameterstate.cpp 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/src/userparameterstate.cpp 2022-03-04 17:01:07.000000000 +0100 @@ -1,9 +1,9 @@ +#include "equal.hpp" +#include "type_caster.hpp" #include <Minuit2/MnUserParameterState.h> #include <pybind11/operators.h> #include <pybind11/pybind11.h> #include <type_traits> -#include "equal.hpp" -#include "type_caster.hpp" namespace ROOT { namespace Minuit2 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_core.py new/iminuit-2.10.0/tests/test_core.py --- old/iminuit-2.9.0/tests/test_core.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_core.py 2022-03-04 17:01:07.000000000 +0100 @@ -55,7 +55,7 @@ def fn(x, y): - return 10 + x ** 2 + ((y - 1) / 2) ** 2 + return 10 + x**2 + ((y - 1) / 2) ** 2 def fn_grad(x, y): @@ -104,7 +104,7 @@ def test_MnMigrad_grad(): - fcn = FCN(lambda x: 10 + x ** 2, lambda x: [2 * x], False, 1) + fcn = FCN(lambda x: 10 + x**2, lambda x: [2 * x], False, 1) state = MnUserParameterState() state.add("x", 5, 0.1) migrad = MnMigrad(fcn, state, 1) @@ -176,7 +176,7 @@ def test_MnScan(): - fcn = FCN(lambda x: 10 + x ** 2, None, False, 1) + fcn = FCN(lambda x: 10 + x**2, None, False, 1) state = MnUserParameterState() state.add("x", 2, 5) scan = MnScan(fcn, state, 1) @@ -188,7 +188,7 @@ def test_MnSimplex(): - fcn = FCN(lambda x: 10 + x ** 2, None, False, 1) + fcn = FCN(lambda x: 10 + x**2, None, False, 1) state = MnUserParameterState() state.add("x", 2, 5) simplex = MnSimplex(fcn, state, 1) @@ -200,7 +200,7 @@ def test_FunctionMinimum(): - fcn = FCN(lambda x: 10 + x ** 2, None, False, 1) + fcn = FCN(lambda x: 10 + x**2, None, False, 1) st = MnUserParameterState() st.add("x", 0.01, 5) str = MnStrategy(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_cost.py new/iminuit-2.10.0/tests/test_cost.py --- old/iminuit-2.9.0/tests/test_cost.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_cost.py 2022-03-04 17:01:07.000000000 +0100 @@ -40,6 +40,10 @@ return mle, nx, xe +def logpdf(x, mu, sigma): + return norm(mu, sigma).logpdf(x) + + def pdf(x, mu, sigma): return norm(mu, sigma).pdf(x) @@ -59,29 +63,35 @@ @pytest.mark.parametrize("verbose", (0, 1)) -def test_UnbinnedNLL(unbinned, verbose): +@pytest.mark.parametrize("model", (logpdf, pdf)) +def test_UnbinnedNLL(unbinned, verbose, model): mle, x = unbinned - cost = UnbinnedNLL(x, pdf, verbose=verbose) + cost = UnbinnedNLL(x, model, verbose=verbose, log=model is logpdf) assert cost.ndata == np.inf m = Minuit(cost, mu=0, sigma=1) m.limits["sigma"] = (0, None) m.migrad() assert_allclose(m.values, mle[1:], atol=1e-3) - assert m.errors["mu"] == pytest.approx(1000 ** -0.5, rel=0.05) + assert m.errors["mu"] == pytest.approx(1000**-0.5, rel=0.05) assert_equal(m.fmin.reduced_chi2, np.nan) @pytest.mark.parametrize("verbose", (0, 1)) -def test_ExtendedUnbinnedNLL(unbinned, verbose): +@pytest.mark.parametrize("model", (logpdf, pdf)) +def test_ExtendedUnbinnedNLL(unbinned, verbose, model): mle, x = unbinned - def scaled_pdf(x, n, mu, sigma): - return n, n * norm(mu, sigma).pdf(x) + log = model is logpdf + + def density(x, n, mu, sigma): + if log: + return n, np.log(n) + logpdf(x, mu, sigma) + return n, n * pdf(x, mu, sigma) - cost = ExtendedUnbinnedNLL(x, scaled_pdf, verbose=verbose) + cost = ExtendedUnbinnedNLL(x, density, verbose=verbose, log=log) assert cost.ndata == np.inf m = Minuit(cost, n=len(x), mu=0, sigma=1) @@ -89,7 +99,7 @@ m.limits["sigma"] = (0, None) m.migrad() assert_allclose(m.values, mle, atol=1e-3) - assert m.errors["mu"] == pytest.approx(1000 ** -0.5, rel=0.05) + assert m.errors["mu"] == pytest.approx(1000**-0.5, rel=0.05) assert_equal(m.fmin.reduced_chi2, np.nan) @@ -106,7 +116,7 @@ m.migrad() # binning loses information compared to unbinned case assert_allclose(m.values, mle[1:], rtol=0.15) - assert m.errors["mu"] == pytest.approx(1000 ** -0.5, rel=0.05) + assert m.errors["mu"] == pytest.approx(1000**-0.5, rel=0.05) assert m.ndof == len(nx) - 2 assert_allclose(m.fmin.reduced_chi2, 1, atol=0.15) @@ -166,7 +176,7 @@ m.migrad() # binning loses information compared to unbinned case assert_allclose(m.values, mle, rtol=0.15) - assert m.errors["mu"] == pytest.approx(1000 ** -0.5, rel=0.05) + assert m.errors["mu"] == pytest.approx(1000**-0.5, rel=0.05) assert m.ndof == len(nx) - 3 assert_allclose(m.fmin.reduced_chi2, 1, 0.1) @@ -493,7 +503,7 @@ sa = 0.1 sb = 0.02 rho = 0.5 - cov = ((sa ** 2, rho * sa * sb), (rho * sa * sb, sb ** 2)) + cov = ((sa**2, rho * sa * sb), (rho * sa * sb, sb**2)) lsq3 = lsq1 + NormalConstraint(("a", "b"), (1, 2), cov) assert lsq1.func_code.co_varnames == ("a", "b") assert lsq2.func_code.co_varnames == ("a", "b") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_issue.py new/iminuit-2.10.0/tests/test_issue.py --- old/iminuit-2.9.0/tests/test_issue.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_issue.py 2022-03-04 17:01:07.000000000 +0100 @@ -28,7 +28,7 @@ def test_issue_544(): @lsq def fcn(x, y): - return x ** 2 + y ** 2 + return x**2 + y**2 m = Minuit(fcn, x=0, y=0) m.fixed = True @@ -45,7 +45,7 @@ if self.first: assert a == 1.0 and b == 2.0 self.first = False - return a ** 2 + b ** 2 + return a**2 + b**2 m = Minuit(F(), a=1, b=2) m.fixed["a"] = False # this used to change a to b @@ -75,7 +75,7 @@ def test_issue_669(): @lsq def fcn(x, y): - return x ** 2 + (y / 2) ** 2 + return x**2 + (y / 2) ** 2 m = Minuit(fcn, x=0, y=0) @@ -96,7 +96,7 @@ @lsq def fcn(par): - return np.sum(par ** 2) + return np.sum(par**2) def grad(par): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_minimize.py new/iminuit-2.10.0/tests/test_minimize.py --- old/iminuit-2.9.0/tests/test_minimize.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_minimize.py 2022-03-04 17:01:07.000000000 +0100 @@ -54,7 +54,7 @@ def rosen(par): x, y = par - return (1 - x) ** 2 + 100 * (y - x ** 2) ** 2 + return (1 - x) ** 2 + 100 * (y - x**2) ** 2 r1 = minimize(rosen, (0, 0), tol=1) r2 = minimize(rosen, (0, 0), tol=1e-6) @@ -63,9 +63,9 @@ def test_disp(capsys): - minimize(lambda x: x ** 2, 0) + minimize(lambda x: x**2, 0) assert capsys.readouterr()[0] == "" - minimize(lambda x: x ** 2, 0, options={"disp": True}) + minimize(lambda x: x**2, 0, options={"disp": True}) assert capsys.readouterr()[0] != "" @@ -115,7 +115,7 @@ def __call__(self, x): self.n += 1 - return x ** 2 + 1e-2 * (self.n % 3) + return x**2 + 1e-2 * (self.n % 3) r = minimize(Fcn(), [1], options={"maxfun": 100000000}) assert not r.success diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_minuit.py new/iminuit-2.10.0/tests/test_minuit.py --- old/iminuit-2.9.0/tests/test_minuit.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_minuit.py 2022-03-04 17:01:07.000000000 +0100 @@ -95,7 +95,7 @@ def func5(x, long_variable_name_really_long_why_does_it_has_to_be_this_long, z): return ( (x - 1) ** 2 - + long_variable_name_really_long_why_does_it_has_to_be_this_long ** 2 + + long_variable_name_really_long_why_does_it_has_to_be_this_long**2 + (z + 1) ** 2 ) @@ -109,7 +109,7 @@ @lsq def func6(x, m, s, a): - return a / ((x - m) ** 2 + s ** 2) + return a / ((x - m) ** 2 + s**2) class Correlated: @@ -119,7 +119,7 @@ sx = 2 sy = 1 corr = 0.5 - cov = (sx ** 2, corr * sx * sy), (corr * sx * sy, sy ** 2) + cov = (sx**2, corr * sx * sy), (corr * sx * sy, sy**2) self.cinv = np.linalg.inv(cov) def __call__(self, x): @@ -306,7 +306,7 @@ def test_wrong_use_of_array_init(): - m = Minuit(lambda a, b: a ** 2 + b ** 2, (1, 2)) + m = Minuit(lambda a, b: a**2 + b**2, (1, 2)) m.errordef = Minuit.LEAST_SQUARES with pytest.raises(TypeError): m.migrad() @@ -452,7 +452,7 @@ assert m.accurate m.minos(cl=cl) assert m.values["lambd"] == approx(k) - assert m.errors["lambd"] == approx(k ** 0.5, abs=2e-3 if limit else None) + assert m.errors["lambd"] == approx(k**0.5, abs=2e-3 if limit else None) assert m.merrors["lambd"].lower == approx(lower, rel=1e-3) assert m.merrors["lambd"].upper == approx(upper, rel=1e-3) assert m.merrors[0].lower == m.merrors["lambd"].lower @@ -850,7 +850,7 @@ def nll(mu, sigma): z = (data - mu) / sigma - logp = -0.5 * z ** 2 - np.log(sigma) + logp = -0.5 * z**2 - np.log(sigma) return -np.sum(logp) m = Minuit(nll, mu=0, sigma=1) @@ -896,7 +896,7 @@ def __call__(self, x): self.nfcn += 1 - return np.exp(x ** 2) + return np.exp(x**2) # check that counting is accurate fcn = Func() @@ -925,7 +925,7 @@ ngrad = 0 def __call__(self, x): - return x ** 2 + return x**2 def grad(self, x): self.ngrad += 1 @@ -949,7 +949,7 @@ def test_errordef(): - m = Minuit(lambda x: x ** 2, 0) + m = Minuit(lambda x: x**2, 0) m.errordef = 4 assert m.errordef == 4 m.migrad() @@ -1043,7 +1043,7 @@ def test_function_with_maximum(): def func(a): - return -(a ** 2) + return -(a**2) m = Minuit(func, a=0) m.errordef = 1 @@ -1094,11 +1094,11 @@ def test_hesse_without_migrad(): - m = Minuit(lambda x: x ** 2 + x ** 4, x=0) + m = Minuit(lambda x: x**2 + x**4, x=0) m.errordef = 0.5 # second derivative: 12 x^2 + 2 m.hesse() - assert m.errors["x"] == approx(0.5 ** 0.5, abs=1e-4) + assert m.errors["x"] == approx(0.5**0.5, abs=1e-4) m.values["x"] = 1 m.hesse() assert m.errors["x"] == approx((1.0 / 14.0) ** 0.5, abs=1e-4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_repr.py new/iminuit-2.10.0/tests/test_repr.py --- old/iminuit-2.9.0/tests/test_repr.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_repr.py 2022-03-04 17:01:07.000000000 +0100 @@ -490,7 +490,7 @@ def test_html_minuit(): - m = Minuit(lambda x, y: x ** 2 + 4 * y ** 2, x=0, y=0) + m = Minuit(lambda x, y: x**2 + 4 * y**2, x=0, y=0) m.errordef = 1 assert m._repr_html_() == m.params._repr_html_() m.migrad() @@ -622,7 +622,7 @@ def test_text_minuit(): - m = Minuit(lambda x, y: x ** 2 + 4 * y ** 2, x=0, y=0) + m = Minuit(lambda x, y: x**2 + 4 * y**2, x=0, y=0) m.errordef = 1 assert str(m) == str(m.params) m.migrad() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_scipy.py new/iminuit-2.10.0/tests/test_scipy.py --- old/iminuit-2.9.0/tests/test_scipy.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_scipy.py 2022-03-04 17:01:07.000000000 +0100 @@ -8,7 +8,7 @@ def fcn(a, b): - return a ** 2 + ((b - 1) / 2.0) ** 2 + 3 + return a**2 + ((b - 1) / 2.0) ** 2 + 3 fcn.errordef = 1 @@ -193,7 +193,7 @@ @pytest.mark.parametrize("fixed", (False, True)) def test_scipy_constraints_1(lb, fixed): def fcn(a, x, y): - return a + x ** 2 + y ** 2 + return a + x**2 + y**2 m = Minuit(fcn, a=3, x=1, y=2) m.fixed["a"] = fixed @@ -213,7 +213,7 @@ @pytest.mark.parametrize("fixed", (False, True)) def test_scipy_constraints_2(fixed): def fcn(x, y): - return x ** 2 + y ** 2 + return x**2 + y**2 m = Minuit(fcn, x=1, y=2) m.errordef = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_tabulate.py new/iminuit-2.10.0/tests/test_tabulate.py --- old/iminuit-2.9.0/tests/test_tabulate.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_tabulate.py 2022-03-04 17:01:07.000000000 +0100 @@ -9,7 +9,7 @@ def test_params(): - m = Minuit(lambda x, y: x ** 2 + (y / 2) ** 2 + 1, x=0, y=0) + m = Minuit(lambda x, y: x**2 + (y / 2) ** 2 + 1, x=0, y=0) m.errordef = 1 m.limits["y"] = (-1, 1) m.fixed["x"] = True @@ -27,7 +27,7 @@ def test_matrix(): - m = Minuit(lambda x, y: x ** 2 + (y / 2) ** 2 + 1, x=0, y=0) + m = Minuit(lambda x, y: x**2 + (y / 2) ** 2 + 1, x=0, y=0) m.errordef = 1 m.migrad() assert ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iminuit-2.9.0/tests/test_util.py new/iminuit-2.10.0/tests/test_util.py --- old/iminuit-2.9.0/tests/test_util.py 2022-01-09 15:12:36.000000000 +0100 +++ new/iminuit-2.10.0/tests/test_util.py 2022-03-04 17:01:07.000000000 +0100 @@ -527,14 +527,14 @@ x = np.array([1]) dx = np.array([0]) - y, jac = util._jacobi(lambda x: x ** 2, x, dx, 1e-3) + y, jac = util._jacobi(lambda x: x**2, x, dx, 1e-3) np.testing.assert_equal(y, 1) np.testing.assert_equal(jac, 0) x = np.array([np.nan]) dx = np.array([0.1]) - y, jac = util._jacobi(lambda x: x ** 2, x, dx, 1e-3) + y, jac = util._jacobi(lambda x: x**2, x, dx, 1e-3) np.testing.assert_equal(y, np.nan) np.testing.assert_equal(jac, np.nan) @@ -543,7 +543,7 @@ dx = np.array([np.nan]) with pytest.raises(AssertionError): # dx must be >= 0 - util._jacobi(lambda x: x ** 2, x, dx, 1e-3) + util._jacobi(lambda x: x**2, x, dx, 1e-3) @pytest.mark.parametrize("fail", (False, True))