[Numpy-discussion] numpy.ma.flatnotmasked_contiguous error in slice.stop values?
Sun Aug 8 21:47:00 CDT 2010
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
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)], am[slice (*segments1)]
> 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?)
More information about the NumPy-Discussion