Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Nathaniel Smith
On Fri, May 25, 2012 at 12:46 PM, Thouis (Ray) Jones tho...@gmail.com wrote:
 I'm seeing some strange behavior from .max() on a reshaped array in
 the current master, and wanted to raise it here to make sure it's not
 something uniquely broken in my setup.

 This code fails for me, though changing the context (adding a counter
 to the loop, or running under python -i) sometimes prevents it from
 failing.  This code doesn't fail under 1.6.2.

 ---
 import numpy as np

 b = np.array([0, 1, 2, 3, 4, 5], np.int64)
 a = b.reshape(3, 2)

 while True:
    np.testing.assert_array_equal(np.atleast_1d(np.array(a.max(0), np.float)),
                                  np.atleast_1d(np.array(a.max(0), np.float)))
 ---

 I spent several hours with valgrind trying to track down what was
 causing this, but had no luck.  Perhaps someone with more knowledge of
 the numpy ufunc internals can track it down faster than me.

What do you get, if not the expected value? And are the calls to
atleast_1d, np.array, etc., necessary to trigger the problem, or will
just plain a.max(0) do it?

-- Nathaniel
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis Jones
On Fri, May 25, 2012 at 1:52 PM, Nathaniel Smith n...@pobox.com wrote:
 On Fri, May 25, 2012 at 12:46 PM, Thouis (Ray) Jones tho...@gmail.com wrote:
 I'm seeing some strange behavior from .max() on a reshaped array in
 the current master, and wanted to raise it here to make sure it's not
 something uniquely broken in my setup.

 This code fails for me, though changing the context (adding a counter
 to the loop, or running under python -i) sometimes prevents it from
 failing.  This code doesn't fail under 1.6.2.

 ---
 import numpy as np

 b = np.array([0, 1, 2, 3, 4, 5], np.int64)
 a = b.reshape(3, 2)

 while True:
    np.testing.assert_array_equal(np.atleast_1d(np.array(a.max(0), np.float)),
                                  np.atleast_1d(np.array(a.max(0), np.float)))
 ---

 I spent several hours with valgrind trying to track down what was
 causing this, but had no luck.  Perhaps someone with more knowledge of
 the numpy ufunc internals can track it down faster than me.

 What do you get, if not the expected value? And are the calls to
 atleast_1d, np.array, etc., necessary to trigger the problem, or will
 just plain a.max(0) do it?


AssertionError:
Arrays are not equal
(mismatch 100.0%)
 x: array([ 4.,  5.])
 y: array([  4.31441533e+09,   4.31441402e+09])

I don't seem to be able to reproduce with just a.max(0) or
np.array(a.max(0), np.float), but since it seems to be very unstable
to other changes in the code, I'll keep trying to find out if I can
make those simpler versions crash.

Ray Jones
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis Jones
On Fri, May 25, 2012 at 2:07 PM, Thouis Jones thouis.jo...@curie.fr wrote:
 I don't seem to be able to reproduce with just a.max(0) or
 np.array(a.max(0), np.float), but since it seems to be very unstable
 to other changes in the code, I'll keep trying to find out if I can
 make those simpler versions crash.

By the way, the strange phrasing comes from these lines in histogramdd():
smin = atleast_1d(array(sample.min(0), float))
smax = atleast_1d(array(sample.max(0), float))

Which is where I encountered the bug in the numpy tests.

Ray Jones
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Thouis (Ray) Jones
On May 25, 2012 5:30 PM, Thouis (Ray) Jones tho...@gmail.com wrote:
 It happens at HEAD in Nathan's separate-maskna branch, as well.

Sorry, Nathaniel's branch.  My fingers went into autopilot.

Ray
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

2012-05-25 Thread Pauli Virtanen
25.05.2012 13:46, Thouis (Ray) Jones kirjoitti:
 I'm seeing some strange behavior from .max() on a reshaped array in
 the current master, and wanted to raise it here to make sure it's not
 something uniquely broken in my setup.
 
 This code fails for me, though changing the context (adding a counter
 to the loop, or running under python -i) sometimes prevents it from
 failing.  This code doesn't fail under 1.6.2.

Try using git bisect to find the the first failing commit:

1. git bisect start master v1.6.2

2. Rebuild, and run test

3. Pick one of the following according to the result:

   git bisect good   # test OK
   git bisect bad# test fails with this error
   git bisect skip   # doesn't build, or some other error

4. Goto 2, until Git tells you what's the first bad commit.

Abort with git bisect reset.

If you are on unix, the following rig can help automate this:
https://github.com/pv/scipy-build-makefile

-- 
Pauli Virtanen

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion