numpy.ma.MaskedArray.strides

MaskedArray.strides

Tuple of bytes to step in each dimension.

The byte offset of element (i[0], i[1], ..., i[n]) in an array a is:

offset = sum(np.array(i) * a.strides)

Examples

>>> x = np.reshape(np.arange(5*6*7*8), (5,6,7,8)).transpose(2,3,1,0)
>>> x.strides
(32, 4, 224, 1344)
>>> i = np.array([3,5,2,2])
>>> offset = sum(i * x.strides)
>>> x[3,5,2,2]
813
>>> offset / x.itemsize
813

Previous topic

numpy.ma.MaskedArray.size

Next topic

numpy.ma.MaskedArray.imag

This Page

Quick search