123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import sys
- sys.path.insert(0,'../..')
- from scattnlay import scattnlay,scattcoeffs,fieldnlay
- import matplotlib.pyplot as plt
- import numpy as np
- import cmath
- from optical_constants import read_refractive_index_from_yaml as get_index
- from_rWL = 0.01
- to_rWL = 5
- step_rWL = 0.01
- rWLs = np.arange(from_rWL, to_rWL+step_rWL/2., step_rWL);
- WLs = 1/rWLs
- index_H2O = get_index('H2O-Hale.yml', WLs, "mkm")
- print(index_H2O)
- x = np.ones((1), dtype = np.float64)
- m = np.ones((1), dtype = np.complex128)
- core_r = 1
- Qext_vec = []
- for i in range(len(WLs)):
- WL = WLs[i]
- x[0] = 2.0*np.pi*core_r/WL
- m[0] = index_H2O[:,1][i]
-
- terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(
- np.array(x), np.array(m),
- mp=True
-
- )
- print(np.array([Qext]))
- Qext_vec.append(Qext)
- fig, axs = plt.subplots(1,1)
- axs.plot(rWLs, Qext_vec, color="black")
- plt.ylim(0, 4.3)
- axs.set_xlabel("$1/\lambda, \mu m^{-1}$")
- axs.set_ylabel("$Q_{ext}$")
- plt.title("Scattnlay")
- plt.savefig("spectra.pdf",pad_inches=0.02, bbox_inches='tight')
- plt.show()
- plt.clf()
- plt.close()
|