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

Function _view_roi

numpy/lib/arraypad.py:58–83  ·  view source on GitHub ↗

Get a view of the current region of interest during iterative padding. When padding multiple dimensions iteratively corner values are unnecessarily overwritten multiple times. This function reduces the working area for the first dimensions so that corners are excluded. Paramet

(array, original_area_slice, axis)

Source from the content-addressed store, hash-verified

56
57
58def _view_roi(array, original_area_slice, axis):
59 """
60 Get a view of the current region of interest during iterative padding.
61
62 When padding multiple dimensions iteratively corner values are
63 unnecessarily overwritten multiple times. This function reduces the
64 working area for the first dimensions so that corners are excluded.
65
66 Parameters
67 ----------
68 array : ndarray
69 The array with the region of interest.
70 original_area_slice : tuple of slices
71 Denotes the area with original values of the unpadded array.
72 axis : int
73 The currently padded dimension assuming that `axis` is padded before
74 `axis` + 1.
75
76 Returns
77 -------
78 roi : ndarray
79 The region of interest of the original `array`.
80 """
81 axis += 1
82 sl = (slice(None),) * axis + original_area_slice[axis:]
83 return array[sl]
84
85
86def _pad_simple(array, pad_width, fill_value=None):

Callers 1

padFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected