Retrieve edge values from empty-padded array in given dimension. Parameters ---------- padded : ndarray Empty-padded array. axis : int Dimension in which the edges are considered. width_pair : (int, int) Pair of widths that mark the pad area on both
(padded, axis, width_pair)
| 153 | |
| 154 | |
| 155 | def _get_edges(padded, axis, width_pair): |
| 156 | """ |
| 157 | Retrieve edge values from empty-padded array in given dimension. |
| 158 | |
| 159 | Parameters |
| 160 | ---------- |
| 161 | padded : ndarray |
| 162 | Empty-padded array. |
| 163 | axis : int |
| 164 | Dimension in which the edges are considered. |
| 165 | width_pair : (int, int) |
| 166 | Pair of widths that mark the pad area on both sides in the given |
| 167 | dimension. |
| 168 | |
| 169 | Returns |
| 170 | ------- |
| 171 | left_edge, right_edge : ndarray |
| 172 | Edge values of the valid area in `padded` in the given dimension. Its |
| 173 | shape will always match `padded` except for the dimension given by |
| 174 | `axis` which will have a length of 1. |
| 175 | """ |
| 176 | left_index = width_pair[0] |
| 177 | left_slice = _slice_at_axis(slice(left_index, left_index + 1), axis) |
| 178 | left_edge = padded[left_slice] |
| 179 | |
| 180 | right_index = padded.shape[axis] - width_pair[1] |
| 181 | right_slice = _slice_at_axis(slice(right_index - 1, right_index), axis) |
| 182 | right_edge = padded[right_slice] |
| 183 | |
| 184 | return left_edge, right_edge |
| 185 | |
| 186 | |
| 187 | def _get_linear_ramps(padded, axis, width_pair, end_value_pair): |
no test coverage detected
searching dependent graphs…