Bug in using TMinuit from python


I’m seeing a bug in fitting code, using TMinuit from python. My code worked fine in V5.26.00, and sees the problem in V5.30.00. I also find that TMinuit from C++ is fine, only the python interface sees the bug.

The sample code below shows the problem: when there are floating parameters, the array of parameters passed to FCN has a size equal to the number of floating parameters, but it should be all parameters.

In the sample code below I have 4 parameters.  The fit is fine when all are floating, but if I fix one of them I find that the parameter array passed to FCN now has dimensions of the number of floating parameters.  I tried a C++ version of this sample code and it worked fine in both cases.

example.py (1.74 KB)

To see the problem:
Ifit(False) # its ok
Ifit(True) # crashes




the browser seems to have eaten my reply (twice now), so once more: I had changed the code thinking that par should be the size of npar. There was/is no further size info available at the point of call. I’ve changed it to be “unlimited” size again (i.e. unchecked). For your current code, you can change the size of par with par.SetSize(4).