Skip to content

Instantly share code, notes, and snippets.

@oyvinev
Created May 16, 2017 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oyvinev/0674cf51d86993b0c86c50a925073c5e to your computer and use it in GitHub Desktop.
Save oyvinev/0674cf51d86993b0c86c50a925073c5e to your computer and use it in GitHub Desktop.
def Al_h2(x):
return (1.00698 + 0.08183*x + 0.00537*x**2 + 0.0016*x**3 + -5.75818*10**(-5)*x**4 + 7.32321*10**(-7)*x**5 + -3.92223*10**(-9)*x**6 + 7.0807*10**(-12)*x**7)/100
def SiO2(x):
return (50 - Al_h2)/100
def aSi(x):
return (25 + Al_h2/2)/100
def void(x):
return (25 - Al_h2/2)/100
f_Al = Al_h2
f_SiO2 = SiO2
f_aSiH = aSi
f_air = void
@torunnkj
Copy link

torunnkj commented May 16, 2017

d = 110

def Al_h2(x):
        return (1.00698 + 0.08183*x + 0.00537*x**2 + 0.0016*x**3 + -5.75818*10**(-5)*x**4 + 7.32321*10**(-7)*x**5 + -3.92223*10**(-9)*x**6 + 7.0807*10**(-12)*x**7)/100

def SiO2(x):
    return (0.5 - Al_h2(x))

def aSi(x):
    return (0.25 + Al_h2(x)/2)

def void(x):
    return (0.25 - Al_h2(x)/2)
        
f_Al = Al_h2
f_SiO2 = SiO2
f_aSiH = aSi
f_air = void


layers = np.linspace(0,d,15)
fs = [f_Al, f_SiO2, f_aSiH, f_Air]
Ns = [N_Al, N_SiO2, N_aSiH, N_Air]
dl = layers[1]

N_layer = []
for l in layers[:-1]:
    #print [_f(l) for _f in fs]
    tmp = bruggeman([_f(l) for _f in fs], [N["n"] for N in Ns], [N["k"] for N in Ns])
    expand_N(tmp, dl)
    N_layer.append(tmp)

@oyvinev
Copy link
Author

oyvinev commented May 16, 2017

import numpy as np

def Al_h2(x):
        return (1.00698 + 0.08183*x + 0.00537*x**2 + 0.0016*x**3 + -5.75818*10**(-5)*x**4 + 7.32321*10**(-7)*x**5 + -3.92223*10**(-9)*x**6 + 7.0807*10**(-12)*x**7)/100

f_Al = Al_h2
f_SiO2 = lambda x: 0.5 - Al_h2(x)
f_aSiH = lambda x: 0.25 + Al_h2(x)/2
f_air = lambda x: 0.25 - Al_h2(x)/2

for x in np.linspace(0,110,10):
    s = 0.0
    for f in ["f_Al", "f_SiO2", "f_aSiH", "f_air"]:
        r = "%s(%.0f)" %(f, x)
        print r, eval(r)
        s += eval(r)
    print "Sum: ", s
    print

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment