question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

convolve.py: use `arr[tuple(seq)]` instead of `arr[seq]` -- with numpy 1.14.0

See original GitHub issue

Hi. I get such warnings when using numpy 1.14.0:

/home/nima/.local/lib/python3.5/site-packages/astropy/convolution/convolve.py:692: 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.
  bigimwt[arrayslices] = 1.0 - nanmaskarray * interpolate_nan
/home/nima/.local/lib/python3.5/site-packages/astropy/convolution/convolve.py:700: 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.
  bigimwt[arrayslices] = wtsm.real[arrayslices]
/home/nima/.local/lib/python3.5/site-packages/astropy/convolution/convolve.py:735: 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.
  result = rifft[arrayslices].real

Rolling back to numpy 1.10 seems to solve the problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

4reactions
mhvkcommented, Sep 14, 2018

This is a recent change in numpy, with the intent to make indexing with a list always return the items in that list, i.e., that only with a tuple you get indexes for each axis. One can add tuple(arrayslices) or perhaps ensure arrayslices is a tuple in the first place.

3reactions
astrofrogcommented, Sep 14, 2018

Maybe a topic for the coordination meeting - under what conditions do we envisage ever breaking backward compatibility in future? The reason Python 3 was bad is because they packaged all the breaks in a single release. In a way, Numpy’s approach is less impactful - just break one thing per release 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

numpy.convolve — NumPy v1.24 Manual
Convolve two arrays using the Fast Fourier Transform. ... Note how the convolution operator flips the second array before “sliding” the two across...
Read more >
scipy.signal.convolve — SciPy v1.9.3 Manual
An N-dimensional array containing a subset of the discrete linear convolution of in1 with in2. Warns. RuntimeWarning. Use of the FFT convolution on...
Read more >
Using np.view() with changes to structured arrays in numpy 1.14
In [165]: some_data = np.array([('foo', 3.5, 2.15), ('bar', 2.8, 5.3), ('baz', 1.2, 3.7)], dtype=[('col1', '<U20'), ('A', '<f8'), ('B', ...
Read more >
numpy 1.14.0 - PyPI
NumPy is a general-purpose array-processing package designed to efficiently manipulate large multi-dimensional arrays of arbitrary records without ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found