Be sure to file a ticket... -Travis
On May 30, 2012, at 9:05 PM, chris farrow wrote: > Hi all, > > I encountered an odd bug today that I wanted to bring to everyone's > attention. First the code: > > >>> import numpy as np > >>> shape = (8, 8) > >>> dtype = np.dtype(np.uint8) > >>> image = np.random.randint(0, 256, shape).astype(dtype) > >>> image.tofile("test_image.bin") > >>> image = np.memmap("test_image.bin", dtype=dtype, shape=shape, mode='r') > >>> arr = image[::2,::2] > >>> np.sum(arr.flat) > > On my system (numpy 1.6.1, git revision > 68538b74483009c2c2d1644ef00397014f95a696, on OSX, python 2.7.3 (32-bit)), > this causes a bus error when run. > > Here's what I've discovered so far about this: > - the bus error only occurs with mode 'r' > - the dimensionality of the array appears to be irrelevant > - if the array slice does not change the strides, the bus error does not occur > - no 'arr.flat', no bus error > - Other aggregating functions (e.g. fmin.reduce) will induce the error > - Iterating over arr.flat will *not* cause a bus error > > Based on this, I suspect the issue is with the C-facing side of the flat > iterator. > > Enjoy! > > Chris > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion