Created
April 14, 2015 14:55
-
-
Save Piyush3dB/c18f750cdf32fe7bd9c6 to your computer and use it in GitHub Desktop.
Sinusoidal 2-d zoneplate plot with tanh tapering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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