MCPcopy Index your code
hub / github.com/dask/dask / reflect

Function reflect

dask/array/_array_expr/_overlap.py:218–245  ·  view source on GitHub ↗

Reflect boundaries of array on the same side This is the converse of ``periodic``

(x, axis, depth)

Source from the content-addressed store, hash-verified

216
217
218def reflect(x, axis, depth):
219 """Reflect boundaries of array on the same side
220
221 This is the converse of ``periodic``
222 """
223 if depth == 1:
224 left = (
225 (slice(None, None, None),) * axis
226 + (slice(0, 1),)
227 + (slice(None, None, None),) * (x.ndim - axis - 1)
228 )
229 else:
230 left = (
231 (slice(None, None, None),) * axis
232 + (slice(depth - 1, None, -1),)
233 + (slice(None, None, None),) * (x.ndim - axis - 1)
234 )
235 right = (
236 (slice(None, None, None),) * axis
237 + (slice(-1, -depth - 1, -1),)
238 + (slice(None, None, None),) * (x.ndim - axis - 1)
239 )
240 l = x[left]
241 r = x[right]
242
243 l, r = _remove_overlap_boundaries(l, r, axis, depth)
244
245 return concatenate([l, x, r], axis=axis)
246
247
248def nearest(x, axis, depth):

Callers 2

test_reflectFunction · 0.90
boundariesFunction · 0.70

Calls 2

concatenateFunction · 0.90

Tested by 1

test_reflectFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…