MCPcopy Create free account
hub / github.com/numpy/numpy / _slice_at_axis

Function _slice_at_axis

numpy/lib/arraypad.py:33–55  ·  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

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

no outgoing calls

Tested by

no test coverage detected