123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import scattnlay
- import os
- from scattnlay import scattnlay
- import numpy as np
- size = np.arange(0.25, 100.25, 0.25)
- 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, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(x, m)
- result = np.vstack((x[:, 4], Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo)).transpose()
- try:
- import matplotlib.pyplot as plt
- plt.figure(1)
- plt.subplot(311)
- plt.plot(x[:, 4], Qext, 'k')
- plt.ylabel('Qext')
- plt.subplot(312)
- plt.plot(x[:, 4], Qsca, 'r')
- plt.ylabel('Qsca')
- plt.subplot(313)
- plt.plot(x[:, 4], Albedo, 'g')
- plt.ylabel('Albedo')
- plt.xlabel('X')
-
- plt.show()
- finally:
- np.savetxt("test01.txt", result, fmt = "%.5f")
- print result
|