Hi Pierre, On Sun, Aug 8, 2010 at 8:47 PM, Pierre GM <[email protected]> wrote:
> > On Aug 8, 2010, at 10:37 PM, Geordie McBain wrote: > > > The function numpy.ma.flatnotmasked_contiguous returns slices which > > miss the last element; for example, based on the example at > > > http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.flatnotmasked_contiguous.html > , > > OK, mind opening a ticket ? I'll try to take care of that tmw and I don't > want the bug report to fall between the cracks. > > > > which isn't really what we're after; I would have expected [3 4] and > > [6 7 8]. Compare the similarly named > > matplotlib.mlab.contiguous_regions which does have the expected > > behaviour (although its output format is different) > > Oh, I didn't know there was such an option in mpl. I wonder when it got > introduced... > > > import matplotlib.mlab > > segments1 = matplotlib.mlab.contiguous_regions (am) > > print 'contiguous_regions:', segments1 > > print am[slice (*segments1[0])], am[slice (*segments1[1])] > > > > which prints > > > > contiguous_regions: [(3, 5), (6, 9)] > > Mmh, tuples are nicer than slices... We'll see. > > > [3 4] [6 7 8] > > > > (I'm running Python 2.6.4 on 64-bit Linux Mint 8 `Helena', with NumPy > > from Ubuntu Karmic, which I think means I have NumPy version 1.3.0?) > > print numpy.version.version > > I'm getting these tests errors now. ====================================================================== FAIL: Test flatnotmasked_contiguous ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/numpy/ma/tests/test_extras.py", line 104, in test_flatnotmasked_contiguous assert_equal(test, []) File "/usr/local/lib/python2.6/dist-packages/numpy/ma/testutils.py", line 98, in assert_equal raise AssertionError(msg) AssertionError: Items are not equal: ACTUAL: None DESIRED: [] >> raise AssertionError('\nItems are not equal:\n ACTUAL: None\n DESIRED: []') ====================================================================== FAIL: Tests unmasked_edges ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/numpy/ma/tests/test_extras.py", line 254, in test_edges assert_equal(test, [0, -1]) File "/usr/local/lib/python2.6/dist-packages/numpy/ma/testutils.py", line 121, in assert_equal return assert_array_equal(actual, desired, err_msg) File "/usr/local/lib/python2.6/dist-packages/numpy/ma/testutils.py", line 193, in assert_array_equal header='Arrays are not equal') File "/usr/local/lib/python2.6/dist-packages/numpy/ma/testutils.py", line 186, in assert_array_compare verbose=verbose, header=header) File "/usr/local/lib/python2.6/dist-packages/numpy/testing/utils.py", line 618, in assert_array_compare raise AssertionError(msg) AssertionError: Arrays are not equal (mismatch 50.0%) x: array([ 0, 24]) y: array([ 0, -1]) >> raise AssertionError('\nArrays are not equal\n\n(mismatch 50.0%)\n x: array([ 0, 24])\n y: array([ 0, -1])') Chuck
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
