12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import sys
- sys.path.insert(0,'..')
- from scattnlay import scattnlay,scattcoeffs,fieldnlay
- import matplotlib.pyplot as plt
- import numpy as np
- import cmath
- from_WL = 400
- to_WL = 800
- WL_points= 100
- WLs = np.linspace(from_WL, to_WL, WL_points)
- index_NP = 1.5+0.3j
- x = np.ones((1), dtype = np.float64)
- 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
- 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)
- 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)
- fig, axs2 = plt.subplots(1,1)
- axs2.plot(WLs, Qsca_vec, color="black")
- plt.savefig("spectra.pdf",pad_inches=0.02, bbox_inches='tight')
- plt.show()
- plt.clf()
- plt.close()
|