[Numpy-discussion] numpy function error

Olivier Delalleau shish at keba.be
Fri Jun 10 08:48:20 EDT 2011


You are overriding your f1 function with a float (with
"f1=f1(self.ptdata[i])"), so trying to call f1(xul) later will raise this
exception.

-=- Olivier

2011/6/10 jonasr <jonas.ruebsam at web.de>

>
> Hello,
> i have the following problem, the following code doesnt work
>
> def f1(x): return self.lgdata[2*i][0]*float(x)+self.lgdata[2*i][1]
> def f2(x): return self.lgdata[2*i+1][0]*float(x)+self.lgdata[2*i+1][1]
> f1=f1(self.ptdata[i])
> 2=f2(self.ptdata[i])
> t=abs(f1-f2)
> deltat.append(t)
> temptot.append(f1)
> rezipr.append(1/t)
> xul , xur = self.ptdata[i]-0.001, self.ptdata[i]+0.001
> print xul,xur,f1,f2,"test \n"
> verts =[(xul,f1(xul)),(xul,f2(xul)),(xur,f2(xur)),(xur,f1(xur))]
>
> it gives me the following error:
>
> Traceback (most recent call last):
>  File
> "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line
> 265, in key_press_event
>    FigureCanvasBase.key_press_event(self, key, guiEvent=event)
>  File "/usr/lib/python2.7/site-packages/matplotlib/backend_bases.py", line
> 1523, in key_press_event
>    self.callbacks.process(s, event)
>  File "/usr/lib/python2.7/site-packages/matplotlib/cbook.py", line 265, in
> process
>    proxy(*args, **kwargs)
>  File "/usr/lib/python2.7/site-packages/matplotlib/cbook.py", line 191, in
> __call__
>    return mtd(*args, **kwargs)
>  File "auswertung.py", line 103, in __call__
>    verts =[(xul,f1(xul)),(xul,f2(xul)),(xur,f2(xur)),(xur,f1(xur))]
> TypeError: 'numpy.float64' object is not callable
>
> have no idea where the problem is, since ptdata is an 1dim array there
> should be no problem to
> pass it to a function ?
>
>
>
> --
> View this message in context:
> http://old.nabble.com/numpy-function-error-tp31817481p31817481.html
> Sent from the Numpy-discussion mailing list archive at Nabble.com.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110610/a43004f8/attachment.html>


More information about the NumPy-Discussion mailing list