iminuit hangs when trying to visualize step function
Closed this issue · 1 comments
2xB commented
The following minimization seemingly hangs when running the following in Jupyter. @l-althueser did some investigations and found out that this does not occur when avoiding the visualization, e.g. by running this as a Python script or by calling migrad
like unused = m.migrad()
instead. It also hangs when just calling m.visualize()
and when using a KeyboardInterrupt after that call, it occurs in /usr/local/lib64/python3.10/site-packages/iminuit/util.py:1560, in _smart_sampling(f, xmin, xmax, start, tol)
.
Used iminuit
version: 2.23.0
.
from iminuit import Minuit
from iminuit.cost import LeastSquares
import numpy as np
def model(x, c1):
c2 = 100
res = np.zeros(len(x))
mask = x < 47
res[mask] = c1
res[~mask] = c2
return res
xtest = np.linspace(0,74)
ytest = xtest*0+1
ytesterr = ytest
least_squares = LeastSquares(xtest, ytest, ytesterr, model)
m = Minuit(least_squares, c1=1)
m.print_level = 3
m.migrad()
#m.hesse()
HDembinski commented
Thanks for the report and the reproducer, I will fix this asap.