[Numpy-discussion] update to numpy-1.5.0 gives new warnings from scipy

Sebastian Berg sebastian at sipsolutions.net
Wed Jul 25 18:10:49 EDT 2018


On Wed, 2018-07-25 at 07:44 -0400, Neal Becker wrote:
> After update to numpy-1.5.0, I'm getting warnings from scipy.
> These probably come from my code using convolve.  Does scipy need
> updating?
> 

Probably yes, I am a bit surprised we did not notice it before if it is
in scipy (or maybe scipy is already fixed?). This may be one of the
more controversial new warnings, so lets see if it comes up more. Right
now it seems not to affect much, I guess.
If the correct thing to do is to use the list as an array, then the
easiest solution maybe to do:

z[index,] = x  # note the additional `,`
# or alternatively of course: z[np.asarray(index)] = x

Otherwise, you will have to use `tuple(index)` to make sure numpy
interprets it as a multi-dimensional index.

The problem here, that this solves, is that if you have `z[some_list]`
currently numpy basically guesses whether you want a multi-dimensional
index or not.

- Sebastian


> /home/nbecker/.local/lib/python3.6/site-
> packages/scipy/fftpack/basic.py:160: FutureWarning: Using a non-tuple 
> sequence for multidimensional indexing is deprecated; use
> `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be
> interpreted as an array index, `arr[np.array(seq)]`, which will
> result either in an error or a different result.
>   z[index] = x
> /home/nbecker/.local/lib/python3.6/site-
> packages/scipy/signal/signaltools.py:491: FutureWarning: Using a non-
> tuple sequence for multidimensional indexing is deprecated; use
> `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be
> interpreted as an array index, `arr[np.array(seq)]`, which will
> result either in an error or a different result.
>   return x[reverse].conj()
> /home/nbecker/.local/lib/python3.6/site-
> packages/scipy/signal/signaltools.py:251: FutureWarning: Using a non-
> tuple sequence for multidimensional indexing is deprecated; use
> `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be
> interpreted as an array index, `arr[np.array(seq)]`, which will
> result either in an error or a different result.
>   in1zpadded[sc] = in1.copy()
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180726/79784d15/attachment-0001.sig>


More information about the NumPy-Discussion mailing list