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)
| 32 | |
| 33 | |
| 34 | def _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 | |
| 59 | def _view_roi(array, original_area_slice, axis): |
no test coverage detected
searching dependent graphs…