MCPcopy Create free account
hub / github.com/dask/dask / _get_axis

Function _get_axis

dask/array/core.py:5808–5825  ·  view source on GitHub ↗

Get axis along which point-wise slicing results lie This is mostly a hack because I can't figure out NumPy's rule on this and can't be bothered to go reading. >>> _get_axis([[1, 2], None, [1, 2], None]) 0 >>> _get_axis([None, [1, 2], [1, 2], None]) 1 >>> _get_axis([None

(indexes)

Source from the content-addressed store, hash-verified

5806
5807
5808def _get_axis(indexes):
5809 """Get axis along which point-wise slicing results lie
5810
5811 This is mostly a hack because I can't figure out NumPy's rule on this and
5812 can't be bothered to go reading.
5813
5814 >>> _get_axis([[1, 2], None, [1, 2], None])
5815 0
5816 >>> _get_axis([None, [1, 2], [1, 2], None])
5817 1
5818 >>> _get_axis([None, None, [1, 2], [1, 2]])
5819 2
5820 """
5821 ndim = len(indexes)
5822 indexes = [slice(None, None) if i is None else [0] for i in indexes]
5823 x = np.empty((2,) * ndim)
5824 x2 = x[tuple(indexes)]
5825 return x2.shape.index(1)
5826
5827
5828def _vindex_slice_and_transpose(block, points, axis):

Callers 2

_vindex_arrayFunction · 0.85

Calls 2

emptyMethod · 0.45
indexMethod · 0.45

Tested by 1