[Numpy-discussion] TypeError when calling numpy.kaiser()

Charles R Harris charlesr.harris at gmail.com
Wed Oct 21 12:28:02 EDT 2009


On Wed, Oct 21, 2009 at 9:18 AM, <josef.pktd at gmail.com> wrote:

> On Sun, Oct 18, 2009 at 3:11 PM, Jeffrey McGee <jeffamcgee at gmail.com>
> wrote:
> > Howdy,
> > I'm having trouble getting the kaiser window to work.  Anytime I try
> > to call numpy.kaiser(), it throws an exception.  Here's the output when
> > I run the example code from
> > http://docs.scipy.org/doc/numpy/reference/generated/numpy.kaiser.html :
> >
> >
> > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> > [GCC 4.3.3] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> >
> >>>> from numpy import kaiser
> >>>> kaiser(12, 14)
> >
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> >
> >   File "/usr/lib/python2.6/dist-packages/numpy/lib/function_base.py",
> > line 2630, in kaiser
> >     return i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/i0(beta)
> >   File "/usr/lib/python2.6/dist-packages/numpy/lib/function_base.py",
> >
> > line 2507, in i0
> >     y[ind] = _i0_1(x[ind])
> > TypeError: array cannot be safely cast to required type
> >>>>
> >
> >
> > Is this a bug?  Am I doing something wrong?  (I'm using the Ubuntu 9.4
> >
> > packages for python and numpy.)
> > Thanks,
> > Jeff
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion at scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
>
> It works with my numpy 1.3.0, but np.i0 doesn't like integers.
> Can you try with a float 14. instead of the integer?
> np.kaiser(12, 14.)
>
>
Hmm, I think np.i0 (the modified Bessel function of order zero), should
accept integer inputs, I'm not sure why it doesn't. As an aside, would it be
appropriate to have some of the more common Bessel functions as ufuncs?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091021/734a21dc/attachment.html>


More information about the NumPy-Discussion mailing list