spipy.special的sph_harm,0.16 +已损坏

时间:2016-06-22 09:59:23

标签: python scipy

我最近将我的scipy版本从0.13更新到最新版本。

以前用过:

import numpy as np
from scipy.special import sph_harm
p,t=np.meshgrid(np.linspace(-np.pi/2.,np.pi/2.,300),np.linspace(0,2*np.pi,150))

s=sph_harm(n=4,m=3,theta=t,phi=p)

现在它只是说了太多的论点' help(sph_harm)指向u_func类的定义,而不指向文档中给出的sph_harm的定义。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

请注意,ufunc通常不喜欢关键字参数:

In [15]: import numpy as np

In [16]: np.sin(x=np.pi)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-16-42da70543d76> in <module>()
----> 1 np.sin(x=np.pi)

ValueError: invalid number of arguments

同样,

In [25]: n, m = 4, 3

In [26]: sph_harm(m, n, t, p)
Out[26]: 
array([[ 0.00000000 +0.00000000e+00j, -0.01314889 +0.00000000e+00j,
        -0.02628327 +0.00000000e+00j, ..., -0.02628327 +0.00000000e+00j,
        -0.01314889 +0.00000000e+00j,  0.00000000 +0.00000000e+00j],
       [ 0.00000000 +0.00000000e+00j, -0.01304381 -1.65899453e-03j,
        -0.02607323 -3.31615792e-03j, ..., -0.02607323 -3.31615792e-03j,
        -0.01304381 -1.65899453e-03j,  0.00000000 +0.00000000e+00j],
       [ 0.00000000 +0.00000000e+00j, -0.01273026 -3.29147383e-03j,
        -0.02544647 -6.57931466e-03j, ..., -0.02544647 -6.57931466e-03j,
        -0.01273026 -3.29147383e-03j,  0.00000000 +0.00000000e+00j],
       ..., 
       [ 0.00000000 +0.00000000e+00j, -0.01273026 +3.29147383e-03j,
        -0.02544647 +6.57931466e-03j, ..., -0.02544647 +6.57931466e-03j,
        -0.01273026 +3.29147383e-03j,  0.00000000 +0.00000000e+00j],
       [ 0.00000000 +0.00000000e+00j, -0.01304381 +1.65899453e-03j,
        -0.02607323 +3.31615792e-03j, ..., -0.02607323 +3.31615792e-03j,
        -0.01304381 +1.65899453e-03j,  0.00000000 +0.00000000e+00j],
       [ 0.00000000 +0.00000000e+00j, -0.01314889 +9.66132935e-18j,
        -0.02628327 +1.93119949e-17j, ..., -0.02628327 +1.93119949e-17j,
        -0.01314889 +9.66132935e-18j,  0.00000000 +0.00000000e+00j]])