8 from pytmatrix.fortran_tm
import pytmatrixf
13 """T-Matrix scattering from nonspherical particles.
15 Class for simulating scattering from nonspherical particles with the
16 T-Matrix method. Uses a wrapper to the Fortran code by M. Mishchenko.
20 First, the class should be be initialized. Any attributes (see below)
21 can be passed as keyword arguments to the constructor. For example:
22 sca = tmatrix.tmatrix(wavelength=2.0, m=complex(0,2))
24 The properties of the scattering and the radiation should then be set
25 as attributes of this object.
28 radius: Equivalent radius.
29 radius_type: If radius_type==tmatrix.RADIUS_EQUAL_VOLUME (default),
30 radius is the equivalent volume radius.
31 If radius_type==tmatrix.RADIUS_MAXIMUM, radius is the maximum
33 If radius_type==tmatrix.RADIUS_EQUAL_AREA,
34 radius is the equivalent area radius.
35 wavelength: The wavelength of incident light (same units as axi).
36 m: The complex refractive index.
37 axis_ratio: The horizontal-to-rotational axis ratio.
38 shape: Particle shape.
39 tmatrix.SHAPE_SPHEROID: spheroid
40 tmatrix.SHAPE_CYLINDER: cylinders;
41 tmatrix.SHAPE_CHEBYSHEV: Chebyshev particles (not yet
45 _attr_list =
set([
"radius_num",
"radius_max",
"radius_type",
"wavelength",
46 "m",
"axial_ratio",
"shape",
"ddelt",
"ndgs",
"ndistr",
"gpoints",
47 "ncoeff",
"angles",
"b_coeff",
"gamma" ])
49 _deprecated_aliases = {
"axi":
"radius",
57 RADIUS_EQUAL_VOLUME = 1.0
58 RADIUS_EQUAL_AREA = 0.5
65 DISTRIBUTION_MODIFIED_GAMMA = 1
66 DISTRIBUTION_LOGNORMAL = 2
67 DISTRIBUTION_POWERLAW = 3
68 DISTRIBUTION_GAMMA = 4
69 DISTRIBUTION_MODIFIED_POWERLAW = 5
76 self.
m = complex(1.53,0.008)
80 self.
distr = DISTRIBUTION_LOGNORMAL
98 self.__dict__[attr] = kwargs[attr]
103 Generate aerosol tables using tmatrix.
116 def mie(self, wl, m, sz, sig, nang ):
118 Generate Mie scattering values using lognormal distribution
123 (reff, veff, cext, csca, albedo, asym, f) =\
124 pytmatrixf.calcrand(self.
radius_type, wl, m.real, \
126 1, sz, B, 0, DISTRIBUTION_LOGNORMAL, self.
gqpoints, nangs, self.
ncoeff)
128 qext = cext/(2*math.pi*reff**2)
129 qsca = csca/(2*math.pi*reff**2)
130 return (reff, veff, qext, qsca, albedo, asym, f)
135 return object.__getattribute__(self, name)
139 object.__setattr__(self, name, value)
142 def _init_tmat(self):
143 """Initialize the scatter_random T-matrix.
149 radius_type = Scatterer.RADIUS_EQUAL_VOLUME
150 radius = self.equal_volume_from_maximum()