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

Function periodic

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

179
180
181def periodic(x, axis, depth):
182 """Copy a slice of an array around to its other side
183
184 Useful to create periodic boundary conditions for overlap
185 """
186
187 left = (
188 (slice(None, None, None),) * axis
189 + (slice(0, depth),)
190 + (slice(None, None, None),) * (x.ndim - axis - 1)
191 )
192 right = (
193 (slice(None, None, None),) * axis
194 + (slice(-depth, None),)
195 + (slice(None, None, None),) * (x.ndim - axis - 1)
196 )
197 l = x[left]
198 r = x[right]
199
200 l, r = _remove_overlap_boundaries(l, r, axis, depth)
201
202 return concatenate([r, x, l], axis=axis)
203
204
205def reflect(x, axis, depth):

Callers 1

boundariesFunction · 0.70

Calls 2

concatenateFunction · 0.90

Tested by

no test coverage detected