MCPcopy
hub / github.com/dask/dask / reflect

Function reflect

dask/array/overlap.py:204–231  ·  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

202
203
204def reflect(x, axis, depth):
205 """Reflect boundaries of array on the same side
206
207 This is the converse of ``periodic``
208 """
209 if depth == 1:
210 left = (
211 (slice(None, None, None),) * axis
212 + (slice(0, 1),)
213 + (slice(None, None, None),) * (x.ndim - axis - 1)
214 )
215 else:
216 left = (
217 (slice(None, None, None),) * axis
218 + (slice(depth - 1, None, -1),)
219 + (slice(None, None, None),) * (x.ndim - axis - 1)
220 )
221 right = (
222 (slice(None, None, None),) * axis
223 + (slice(-1, -depth - 1, -1),)
224 + (slice(None, None, None),) * (x.ndim - axis - 1)
225 )
226 l = x[left]
227 r = x[right]
228
229 l, r = _remove_overlap_boundaries(l, r, axis, depth)
230
231 return concatenate([l, x, r], axis=axis)
232
233
234def nearest(x, axis, depth):

Callers 1

boundariesFunction · 0.70

Calls 2

concatenateFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…