1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import scattnlay
- import os
- from scattnlay import scattnlay
- import numpy as np
- size = np.linspace(0.1, 100., 1000)
- 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)
- 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)
|