<ipython-input-3-1f37d78639f5> in normalize_comx(num)
27 imag = num.imag
28 temp = np.sqrt( real* real+ imag* imag)#计算模值
---> 29 real=real/max(temp)#归一化
30 imag = imag/max(temp) * 1j
31 return real + imag
TypeError: 'numpy.int64' object is not callabl
出现报错'numpy.int64' object is not callable,找了好久,报错这里代码没有问题。
原因是我在程序其它位置用了python内置函数max作为变量名
d=np.correlate(ta.imag, ta0.imag, "full")
max = np.argmax(d)
za=ta[max-d1:max]
有意思的是我第一次调用函数没报错,第二次max就冲突了
把max变量名改了就好了
d=np.correlate(ta.imag, ta0.imag, "full")
max _num= np.argmax(d)
za=ta[max _num-d1:max _num]
记住python以下内置函数,都不要用于变量名,Jupyter notebook用到这些会显示绿色的,注意。
同理也不要用自己写的函数作为变量名