pyminuit
pyminuit copied to clipboard
Minimize Callable classes
trafficstars
I wonder if it could be possible to allow callable classes. I tried this
code and get the error:
$ python fit.py
Traceback (most recent call last):
File "fit.py", line 18, in ?
m = minuit.Minuit(f,x=10,y=10)
AttributeError: func instance has no attribute 'func_code'
class func:
def __init__(self,x0,y0):
self.x0 = x0
self.y0 = y0
self.co_varnames = ("x","y")
def __call__(self,x,y):
return (x - self.x0) ** 2 + (y - self.y0) ** 2
import minuit
f = func(2,3)
m = minuit.Minuit(f,x=10,y=10)
Original issue reported on code.google.com by [email protected] on 10 Nov 2008 at 7:04