Skip to content

Instantly share code, notes, and snippets.

@liubenyuan
Created March 24, 2016 11:38
Show Gist options
  • Save liubenyuan/0a1a870e02ee501e6549 to your computer and use it in GitHub Desktop.
Save liubenyuan/0a1a870e02ee501e6549 to your computer and use it in GitHub Desktop.
plot weighting function of oit
# plot weight of oit
import matplotlib.pyplot as plt
import numpy as np
N = 1000
z = np.linspace(1, 500, N)
def clamp(a, amin, amax):
return np.max([amin, np.min([a, amax])])
def equation7(z):
zabs = np.abs(z)
val = 10. / (1e-5 + np.power(zabs/5.0, 2.0) + np.power(zabs/200.0, 6.0))
return clamp(val, 1e-2, 3e3)
def equation8(z):
zabs = np.abs(z)
val = 10. / (1e-5 + np.power(zabs/5.0, 3.0) + np.power(zabs/200.0, 6.0))
return clamp(val, 1e-2, 3e3)
def equation9(z):
val = 0.001/(1e-5 + np.power(np.abs(z)/200.0, 4.0))
return clamp(val, 1e-2, 3e3)
zw = np.array([[equation7(zi), equation8(zi), equation9(zi)] for zi in z])
plt.loglog(zw)
plt.xlim([1, 1000])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment