Hi all,
I recently upgraded from Numpy 1.6.2 to 1.7.1 on my Debian testing, and then got a bug in a program that was previously working. It turned out that the problem comes from the np.insert function when the argument `axis=1` is given.
Here is a minimal example:
u = np.zeros((2,3,4)) ui = np.ones((2,3)) u = np.insert(u, 1, ui, axis=1)
The last line should be equivalent to
u = np.insert(u, 1, ui, axis=2)
It was indeed the case in Numpy 1.6, but in 1.7.1 it raises a ValueError exception.
Note that the problem seems specific to axis=1, and not to all negative axis values, since the following example works as expected:
u = np.zeros((2,3,4)) ui = np.ones((2,4)) u = np.insert(u, 1, ui, axis=2) # equivalent to axis=1
I didn't check on current master, so maybe things have changed since 1.7.1. If they have not, do you think a bug report would be relevant?
Cheers, Félix
On Mon, 20130701 at 14:11 +0200, Félix Hartmann wrote:
Hi all,
I recently upgraded from Numpy 1.6.2 to 1.7.1 on my Debian testing, and then got a bug in a program that was previously working. It turned out that the problem comes from the np.insert function when the argument `axis=1` is given.
Dang, yes, its a pretty stupid bug, exists basically the same in both 1.7 and 1.8. If you got a minute, it is because of np.rollaxis usage, and in it there it says `axis1` which is wrong for negative axes!
Could you create a pull request to fix that? That would be great.
 Sebastian
Here is a minimal example:
u = np.zeros((2,3,4)) ui = np.ones((2,3)) u = np.insert(u, 1, ui, axis=1)
The last line should be equivalent to
u = np.insert(u, 1, ui, axis=2)
It was indeed the case in Numpy 1.6, but in 1.7.1 it raises a ValueError exception.
Note that the problem seems specific to axis=1, and not to all negative axis values, since the following example works as expected:
u = np.zeros((2,3,4)) ui = np.ones((2,4)) u = np.insert(u, 1, ui, axis=2) # equivalent to axis=1
I didn't check on current master, so maybe things have changed since 1.7.1. If they have not, do you think a bug report would be relevant?
Cheers, Félix _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpydiscussion
On Mon, 20130701 at 17:54 +0200, Sebastian Berg wrote:
On Mon, 20130701 at 14:11 +0200, Félix Hartmann wrote:
Hi all,
I recently upgraded from Numpy 1.6.2 to 1.7.1 on my Debian testing, and then got a bug in a program that was previously working. It turned out that the problem comes from the np.insert function when the argument `axis=1` is given.
Dang, yes, its a pretty stupid bug, exists basically the same in both 1.7 and 1.8. If you got a minute, it is because of np.rollaxis usage, and in it there it says `axis1` which is wrong for negative axes!
That is axis + 1 of course...
Could you create a pull request to fix that? That would be great.
 Sebastian
Here is a minimal example:
u = np.zeros((2,3,4)) ui = np.ones((2,3)) u = np.insert(u, 1, ui, axis=1)
The last line should be equivalent to
u = np.insert(u, 1, ui, axis=2)
It was indeed the case in Numpy 1.6, but in 1.7.1 it raises a ValueError exception.
Note that the problem seems specific to axis=1, and not to all negative axis values, since the following example works as expected:
u = np.zeros((2,3,4)) ui = np.ones((2,4)) u = np.insert(u, 1, ui, axis=2) # equivalent to axis=1
I didn't check on current master, so maybe things have changed since 1.7.1. If they have not, do you think a bug report would be relevant?
Cheers, Félix _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpydiscussion
NumPyDiscussion mailing list NumPyDiscussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpydiscussion
participants (2)

Félix Hartmann

Sebastian Berg