12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- from scattnlay import scattnlay
- import numpy as np
- from scipy.constants import pi, c
- radius = np.linspace(0.5, 180.0, 360)
- nAg = np.sqrt(-4.0 + 0.7j)
- wl = 400.0
- x = np.ones((len(radius), 1), dtype = np.float64)
- x[:, 0] = 2.0*pi*radius/wl
- m = np.ones((len(radius), 1), dtype = np.complex128)
- m[:, 0] *= nAg
- terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(x, m)
- F = pi*Qpr*radius*radius/c/1e9
- result = np.vstack((radius, 1e11*F, 1e13*F, 1e15*F)).transpose()
- try:
- import matplotlib.pyplot as plt
- plt.figure(1)
- plt.subplot(311)
- plt.plot(radius, 1e11*F, 'k', label = '10$^{11}$ W/m$^2$')
- plt.plot(radius, 1e13*F, 'b', label = '10$^{13}$ W/m$^2$')
- plt.plot(radius, 1e15*F, 'g', label = '10$^{15}$ W/m$^2$')
- plt.ylabel('F (nN)')
- plt.legend(loc = 4)
- ax = plt.gca()
- ax.set_yscale('log')
- plt.subplot(312)
- plt.plot(radius, g, 'r', label = 'g')
- plt.ylabel('g')
- plt.subplot(313)
- plt.plot(radius, Qext, 'k', label = 'Q$_{ext}$')
- plt.plot(radius, Qsca, 'b', label = 'Q$_{sca}$')
- plt.plot(radius, Qpr, 'g', label = 'Q$_{pr}$')
- plt.ylabel('Q')
- plt.legend()
- plt.xlabel('R (nm)')
-
- plt.show()
- finally:
-
- print result
|