MCPcopy Index your code
hub / github.com/numpy/numpy / _slice_at_axis

Function _slice_at_axis

numpy/lib/_arraypad_impl.py:34–56  ·  view source on GitHub ↗

Construct tuple of slices to slice an array in the given dimension. Parameters ---------- sl : slice The slice for the given dimension. axis : int The axis to which `sl` is applied. All other dimensions are left "unsliced". Returns ------- s

(sl, axis)

Source from the content-addressed store, hash-verified

32
33
34def _slice_at_axis(sl, axis):
35 """
36 Construct tuple of slices to slice an array in the given dimension.
37
38 Parameters
39 ----------
40 sl : slice
41 The slice for the given dimension.
42 axis : int
43 The axis to which `sl` is applied. All other dimensions are left
44 "unsliced".
45
46 Returns
47 -------
48 sl : tuple of slices
49 A tuple with slices matching `shape` in length.
50
51 Examples
52 --------
53 >>> np._slice_at_axis(slice(None, 3, -1), 1)
54 (slice(None, None, None), slice(None, 3, -1), (...,))
55 """
56 return (slice(None),) * axis + (sl,) + (...,)
57
58
59def _view_roi(array, original_area_slice, axis):

Callers 6

_set_pad_areaFunction · 0.85
_get_edgesFunction · 0.85
_get_linear_rampsFunction · 0.85
_get_statsFunction · 0.85
_set_reflect_bothFunction · 0.85
_set_wrap_bothFunction · 0.85

Calls 1

sliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…