[SciPy-User] Using special functions with keyword arguments

Lutz Maibaum lutz.maibaum at gmail.com
Mon Mar 7 20:00:57 EST 2016


I am having difficulties calling the spherical harmonics function with keyword arguments. This works in older versions (for example Numpy 1.8 / SciPy 0.14):

>>> from scipy.special import sph_harm
>>> sph_harm(m=0,n=0,theta=0,phi=0)
array((0.28209479177387814+0j))

In newer versions, such as NumPy 1.10 / SciPy 0.15, I get

>>> from scipy.special import sph_harm
>>> sph_harm(m=0,n=0,theta=0,phi=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid number of arguments

Is it still possible to call sph_harm (and presumably other special functions) with keyword arguments? The reason I am trying to do this is that I would like to wrap sph_harm in a functools.partial object that takes only a single argument, and that I can then pass to multiprocessing.Pool.map.

Thanks,

Lutz




More information about the SciPy-User mailing list