Skip to content

Instantly share code, notes, and snippets.

@Piyush3dB
Created April 14, 2015 14:55
Show Gist options
  • Save Piyush3dB/c18f750cdf32fe7bd9c6 to your computer and use it in GitHub Desktop.
Save Piyush3dB/c18f750cdf32fe7bd9c6 to your computer and use it in GitHub Desktop.
Sinusoidal 2-d zoneplate plot with tanh tapering
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import pdb
# zoneplte
W = 96
H = 96
xv, yv = np.meshgrid(
np.linspace(-W/2, W/2, W),
np.linspace(-H/2, H/2, H)
)
r = np.hypot(xv,yv)
km = 0.8*np.pi
rm = W/2
w = rm/10
term1 = np.sin( (km * r**2) / (2 * rm) )
term2 = 0.5*np.tanh((rm - r)/w) + 0.5
#g = term1 * term2
g = term1
plt.imshow(g, cmap=plt.cm.gray)
#plt.imshow(g)
plt.show()
#pdb.set_trace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment