MCPcopy Create free account
hub / github.com/dask/dask / periodic

Function periodic

dask/array/_array_expr/_overlap.py:195–216  ·  view source on GitHub ↗

Copy a slice of an array around to its other side Useful to create periodic boundary conditions for overlap

(x, axis, depth)

Source from the content-addressed store, hash-verified

193
194
195def periodic(x, axis, depth):
196 """Copy a slice of an array around to its other side
197
198 Useful to create periodic boundary conditions for overlap
199 """
200
201 left = (
202 (slice(None, None, None),) * axis
203 + (slice(0, depth),)
204 + (slice(None, None, None),) * (x.ndim - axis - 1)
205 )
206 right = (
207 (slice(None, None, None),) * axis
208 + (slice(-depth, None),)
209 + (slice(None, None, None),) * (x.ndim - axis - 1)
210 )
211 l = x[left]
212 r = x[right]
213
214 l, r = _remove_overlap_boundaries(l, r, axis, depth)
215
216 return concatenate([r, x, l], axis=axis)
217
218
219def reflect(x, axis, depth):

Callers 2

test_periodicFunction · 0.90
boundariesFunction · 0.70

Calls 2

concatenateFunction · 0.90

Tested by 1

test_periodicFunction · 0.72