def calc(design, extra_width, WL, epsilon_Si, epsilon_Ag):
    x, m = SetXM(design, extra_width, WL, epsilon_Si, epsilon_Ag)
    terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(np.array([x]), np.array([m]))
    terms2, an, bn = scattcoeffs(np.array([x]), np.array([m]), terms)
    an_s = (an.real - np.abs(an) ** 2)[0]
    bn_s = (bn.real - np.abs(bn) ** 2)[0]
    return np.array([WL, an_s[0], bn_s[0], an_s[1], bn_s[1], an_s[2], bn_s[2]])
Beispiel #2
0
def calc(design, extra_width, WL, epsilon_Si, epsilon_Ag):
    x, m = SetXM(design, extra_width, WL, epsilon_Si, epsilon_Ag)
    terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(
        np.array([x]), np.array([m]))
    terms2, an, bn = scattcoeffs(np.array([x]), np.array([m]), terms)
    an_s = (an.real - np.abs(an)**2)[0]
    bn_s = (bn.real - np.abs(bn)**2)[0]
    return np.array([WL, an_s[0], bn_s[0], an_s[1], bn_s[1], an_s[2], bn_s[2] ])
Beispiel #3
0
x = np.ones((len(size), 5), dtype=np.float64)
x[:, 0] = 0.1**(1.0 / 3.0) * size
x[:, 1] = 0.36**(1.0 / 3.0) * size
x[:, 2] = 0.404**(1.0 / 3.0) * size
x[:, 3] = 0.7706**(1.0 / 3.0) * size
x[:, 4] = size

m = np.ones((len(size), 5), dtype=np.complex128)
m[:, 0] *= 1.8 + 1.7j
m[:, 1] *= 0.8 + 0.7j
m[:, 2] *= 1.2 + 0.09j
m[:, 3] *= 2.8 + 0.2j
m[:, 4] *= 1.5 + 0.4j

terms, an, bn = scattcoeffs(x, m, 105)

result = np.vstack(
    (x[:, 4], an[:, 0].real, an[:, 0].imag, an[:, 1].real, an[:, 1].imag,
     an[:, 2].real, an[:, 2].imag, bn[:, 0].real, bn[:, 0].imag, bn[:, 1].real,
     bn[:, 1].imag, bn[:, 2].real, bn[:, 2].imag)).transpose()

try:
    import matplotlib.pyplot as plt

    plt.figure(1)
    for i in range(3):
        plt.subplot(310 + i + 1)
        plt.plot(x[:, 4], an[:, i].real, label="Re(a$_%i$)" % (i + 1))
        plt.plot(x[:, 4], bn[:, i].real, label="Re(b$_%i$)" % (i + 1))
        plt.plot(x[:, 4], an[:, i].imag, label="Im(a$_%i$)" % (i + 1))
Beispiel #4
0
x = np.ones((len(size), 5), dtype = np.float64)
x[:, 0] = 0.1**(1.0/3.0)*size
x[:, 1] = 0.36**(1.0/3.0)*size
x[:, 2] = 0.404**(1.0/3.0)*size
x[:, 3] = 0.7706**(1.0/3.0)*size
x[:, 4] = size

m = np.ones((len(size), 5), dtype = np.complex128)
m[:, 0] *= 1.8 + 1.7j
m[:, 1] *= 0.8 + 0.7j
m[:, 2] *= 1.2 + 0.09j
m[:, 3] *= 2.8 + 0.2j
m[:, 4] *= 1.5 + 0.4j

terms, an, bn = scattcoeffs(x, m, 105)

result = np.vstack((x[:, 4], an[:, 0].real, an[:, 0].imag, an[:, 1].real, an[:, 1].imag, an[:, 2].real, an[:, 2].imag,
                             bn[:, 0].real, bn[:, 0].imag, bn[:, 1].real, bn[:, 1].imag, bn[:, 2].real, bn[:, 2].imag)).transpose()

try:
    import matplotlib.pyplot as plt

    plt.figure(1)
    for i in range(3):
        plt.subplot(310 + i + 1)
        plt.plot(x[:, 4], an[:, i].real, label = "Re(a$_%i$)" % (i + 1))
        plt.plot(x[:, 4], bn[:, i].real, label = "Re(b$_%i$)" % (i + 1))
        plt.plot(x[:, 4], an[:, i].imag, label = "Im(a$_%i$)" % (i + 1))
        plt.plot(x[:, 4], bn[:, i].imag, label = "Im(b$_%i$)" % (i + 1))
Beispiel #5
0
m = np.ones((1), dtype=np.complex128)

core_r = 45000

Qsca_vec = []
core_r_vec = []
an_vec = []
bn_vec = []

for WL in WLs:
    x[0] = 2.0 * np.pi * core_r / WL  #/4.0*3.0
    m[0] = index_NP
    terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(
        np.array(x), np.array(m), mp=True)
    print(np.array([Qsca]))
    terms, an, bn = scattcoeffs(x, m, 24)
    # Qsca_vec.append(Qsca*np.pi*core_r**2*1e-5)
    Qsca_vec.append(Qsca)  #*np.pi*core_r**2*1e-5)
    core_r_vec.append(core_r)
    an_vec.append(np.abs(an)[0])
    bn_vec.append(np.abs(bn)[0])

an_vec = np.array(an_vec)
bn_vec = np.array(bn_vec)
# print(an_vec)
fig, axs2 = plt.subplots(1, 1)  #, sharey=True, sharex=True)
axs2.plot(WLs, Qsca_vec, color="black")
# axs.set_xlabel("D, nm")
# axs.set_ylabel("$Q_{sca}$")
# axs2 = axs.twinx()
# axs2.plot(np.array(core_r_vec)*2,an_vec[:,0],"b.",lw=0.8, markersize=1.9,label="$a_0$")
x = np.vstack(
    (0.1**(1.0 / 3.0) * size, 0.36**(1.0 / 3.0) * size,
     0.404**(1.0 / 3.0) * size, 0.7706**(1.0 / 3.0) * size, size)).transpose()

m = np.array((1.8 + 1.7j, 0.8 + 0.7j, 1.2 + 0.09j, 2.8 + 0.2j, 1.5 + 0.4j),
             dtype=np.complex128)

# for i in range(300):
#     terms, an, bn = scattcoeffs(x, m, 105)
nmax = 105
an2 = np.zeros((len(size), nmax), dtype=np.complex128)
bn2 = np.zeros((len(size), nmax), dtype=np.complex128)

for _ in range(300):
    for i in range(len(size)):
        terms1, an2[i, :], bn2[i, :] = scattcoeffs(x[i, :], m, nmax=nmax)

# print(an1[:3], bn1[:3])
# print(an2)
# print(an)
# print(terms1)

# result = np.vstack((x[:, 4], an[:, 0].real, an[:, 0].imag, an[:, 1].real, an[:, 1].imag, an[:, 2].real, an[:, 2].imag,
#                              bn[:, 0].real, bn[:, 0].imag, bn[:, 1].real, bn[:, 1].imag, bn[:, 2].real, bn[:, 2].imag)).transpose()

# try:
#     import matplotlib.pyplot as plt

#     plt.figure(1)
#     for i in range(3):
#         plt.subplot(310 + i + 1)