Skip to content

Instantly share code, notes, and snippets.

@mocquin
Created July 20, 2023 11:44
Show Gist options
  • Save mocquin/ceb2996f218c3aabe946cbdb9c4e63a2 to your computer and use it in GitHub Desktop.
Save mocquin/ceb2996f218c3aabe946cbdb9c4e63a2 to your computer and use it in GitHub Desktop.
# the choice of V and H must big enough so the middle of the image is the same
# whatever the padding mode type, but small enough so that the differences in the
# boundaries can be seen
V, H = 100, 150
img = np.random.randn(V, H)
img += np.linspace(0, 5, 100)[..., np.newaxis]
img += np.sin(2*np.pi*1/75*np.arange(150))*5
d = 3
img[V//2-d:V//2+d, H//2-d:H//2+d]+= 5
img[V//4-d:V//4+d, H//3-d:H//3+d]+= 10
img[V//3-d:V//3+d, H//2-d:H//2+d]+= 15
p = PeriodicArray(img)
p.plot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment