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

Function _set_pad_area

numpy/lib/arraypad.py:129–151  ·  view source on GitHub ↗

Set empty-padded area in given dimension. Parameters ---------- padded : ndarray Array with the pad area which is modified inplace. axis : int Dimension with the pad area to set. width_pair : (int, int) Pair of widths that mark the pad area on both s

(padded, axis, width_pair, value_pair)

Source from the content-addressed store, hash-verified

127
128
129def _set_pad_area(padded, axis, width_pair, value_pair):
130 """
131 Set empty-padded area in given dimension.
132
133 Parameters
134 ----------
135 padded : ndarray
136 Array with the pad area which is modified inplace.
137 axis : int
138 Dimension with the pad area to set.
139 width_pair : (int, int)
140 Pair of widths that mark the pad area on both sides in the given
141 dimension.
142 value_pair : tuple of scalars or ndarrays
143 Values inserted into the pad area on each side. It must match or be
144 broadcastable to the shape of `arr`.
145 """
146 left_slice = _slice_at_axis(slice(None, width_pair[0]), axis)
147 padded[left_slice] = value_pair[0]
148
149 right_slice = _slice_at_axis(
150 slice(padded.shape[axis] - width_pair[1], None), axis)
151 padded[right_slice] = value_pair[1]
152
153
154def _get_edges(padded, axis, width_pair):

Callers 1

padFunction · 0.85

Calls 1

_slice_at_axisFunction · 0.85

Tested by

no test coverage detected