[Numpy-discussion] r3530 breaks nan_to_num for complex64 arrays
Tim Leslie
tim.leslie at gmail.com
Mon Feb 5 00:32:43 EST 2007
On 2/5/07, Tim Leslie <tim.leslie at gmail.com> wrote:
> Hi All,
>
> As of svn revision 3530 N.nan_to_num no longer works for arrays of
> complex64. The actual error is raised in the signbit function, but I'm
> not sure why this is failing. If someone has a quick fix for this
> that'd be great, if not I'll lodge a full bug report when I get back
> from lunch :-).
Just noticed that this has already been reported.
http://projects.scipy.org/scipy/numpy/ticket/443
Cheers,
Tim
>
> Cheers,
>
> Tim
>
> In [1]: import numpy as N
>
> In [2]: a = N.ones((10, 10, 10), N.complex64)
>
> In [3]: N.nan_to_num(a)
> ---------------------------------------------------------------------------
> exceptions.TypeError Traceback (most
> recent call last)
>
> /home/timl/<ipython console>
>
> /usr/lib/python2.4/site-packages/numpy/lib/type_check.py in nan_to_num(x)
> 130 else:
> 131 scalar = False
> --> 132 are_inf = isposinf(y)
> 133 are_neg_inf = isneginf(y)
> 134 are_nan = isnan(y)
>
> /usr/lib/python2.4/site-packages/numpy/lib/ufunclike.py in isposinf(x, y)
> 31 if y is None:
> 32 y = empty(x.shape, dtype=nx.bool_)
> ---> 33 umath.logical_and(isinf(x), ~signbit(x), y)
> 34 return y
> 35
>
> TypeError: function not supported for these types, and can't coerce
> safely to supported types
>
More information about the NumPy-Discussion
mailing list