miepython 3.2.0__py3-none-any.whl → 3.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- miepython/__init__.py +33 -2
- miepython/core.py +172 -40
- miepython/field.py +239 -293
- miepython/mie_jit.py +202 -97
- miepython/mie_nojit.py +166 -86
- miepython/monte_carlo.py +157 -66
- miepython/rayleigh.py +185 -47
- miepython/util.py +25 -5
- miepython/vsh.py +16 -7
- {miepython-3.2.0.dist-info → miepython-3.3.1.dist-info}/METADATA +8 -8
- miepython-3.3.1.dist-info/RECORD +18 -0
- {miepython-3.2.0.dist-info → miepython-3.3.1.dist-info}/WHEEL +1 -1
- miepython-3.2.0.dist-info/RECORD +0 -18
- {miepython-3.2.0.dist-info → miepython-3.3.1.dist-info}/licenses/LICENSE.txt +0 -0
- {miepython-3.2.0.dist-info → miepython-3.3.1.dist-info}/top_level.txt +0 -0
miepython/rayleigh.py
CHANGED
|
@@ -1,7 +1,127 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Rayleigh approximation for scattering by spheres much smaller than the wavelength.
|
|
3
|
+
|
|
4
|
+
When a sphere is small both outside (x << 1) and inside (abs(m) * x << 1), the
|
|
5
|
+
incident field is nearly uniform across it, and it radiates as a single
|
|
6
|
+
oscillating electric dipole. Every scattering quantity then follows in closed
|
|
7
|
+
form from the ratio (m**2 - 1) / (m**2 + 2), with no series of multipoles to
|
|
8
|
+
sum. This module evaluates those expressions, following Bohren and Huffman,
|
|
9
|
+
equations 5.4 and 5.7 to 5.9. A perfect conductor also radiates a magnetic
|
|
10
|
+
dipole, and has its own expressions, described below.
|
|
11
|
+
|
|
12
|
+
The functions mirror those of the same names in ``miepython``, with the same
|
|
13
|
+
arguments and the same ``norm`` choices, so one can stand in for the other:
|
|
14
|
+
|
|
15
|
+
``efficiencies_mx(m, x)``, ``efficiencies(m, d, lambda0, n_env)``
|
|
16
|
+
qext, qsca, qback and g.
|
|
17
|
+
``S1_S2(m, x, mu, norm)``
|
|
18
|
+
The scattering amplitudes at each mu = cos(theta).
|
|
19
|
+
``i_par``, ``i_per``, ``i_unpolarized``, ``intensities``
|
|
20
|
+
Scattered intensities at each mu.
|
|
21
|
+
``phase_matrix(m, x, mu, norm)``
|
|
22
|
+
The 4x4 Mueller matrix at each mu.
|
|
23
|
+
|
|
24
|
+
Nothing here takes ``n_pole``, since there is only the dipole.
|
|
25
|
+
|
|
26
|
+
Order of approximation:
|
|
27
|
+
Strictly, Rayleigh scattering is only the leading term in x: an electric
|
|
28
|
+
dipole whose strength is set by the static polarizability. Not every
|
|
29
|
+
expression here stops at that term, so this is better described as a
|
|
30
|
+
small-particle approximation.
|
|
31
|
+
|
|
32
|
+
- qsca and qback are the leading terms, 8/3 x**4 abs(ratio)**2 and
|
|
33
|
+
4 x**4 abs(ratio)**2.
|
|
34
|
+
- qext carries Bohren and Huffman's next-order correction. Its absorption
|
|
35
|
+
term includes a relative x**2 correction, the order at which the
|
|
36
|
+
magnetic dipole and the electric quadrupole first contribute (the
|
|
37
|
+
2 m**2 + 3 in its denominator is the quadrupole's), and scattering is
|
|
38
|
+
added as 8/3 x**4 Re(ratio**2).
|
|
39
|
+
- ``S1_S2`` gives the electric dipole its own relative x**2 correction, the
|
|
40
|
+
x**5 term, but leaves out the magnetic dipole and quadrupole. The angular
|
|
41
|
+
pattern is therefore exactly that of a dipole, and g is 0.
|
|
42
|
+
- A perfect conductor gets only the leading terms of its electric and
|
|
43
|
+
magnetic dipoles.
|
|
44
|
+
|
|
45
|
+
The corrections are not applied evenly, so a dielectric's qext is more
|
|
46
|
+
accurate than its qsca. ``miepython`` itself goes further for x < 0.1,
|
|
47
|
+
using Wiscombe's expansions, which keep the electric dipole, the magnetic
|
|
48
|
+
dipole and the electric quadrupole, each with its own corrections.
|
|
49
|
+
|
|
50
|
+
Accuracy:
|
|
51
|
+
Relative error in qext against the full Mie solution:
|
|
52
|
+
|
|
53
|
+
================= ========= ======== ========
|
|
54
|
+
m x = 0.01 x = 0.1 x = 0.5
|
|
55
|
+
================= ========= ======== ========
|
|
56
|
+
1.5 -7e-6 -7e-4 -1e-2
|
|
57
|
+
1.5 - 0.1j 8e-10 6e-6 4e-3
|
|
58
|
+
0.05 - 1.43j 2e-6 2e-2 14
|
|
59
|
+
-1j (conductor) -2e-5 -2e-3 -4e-2
|
|
60
|
+
================= ========= ======== ========
|
|
61
|
+
|
|
62
|
+
The last row is a silver-like sphere near its plasmon resonance, where
|
|
63
|
+
m**2 is close to -2 and the denominator of the ratio nearly vanishes. There
|
|
64
|
+
the approximation fails at much smaller x than for an ordinary dielectric.
|
|
65
|
+
|
|
66
|
+
For a dielectric the asymmetry parameter g is 0, because dipole scattering
|
|
67
|
+
is the same forwards and backwards. The Mie value is 0.002 at x = 0.1 and
|
|
68
|
+
0.05 at x = 0.5 for m = 1.5.
|
|
69
|
+
|
|
70
|
+
Conventions:
|
|
71
|
+
The index is m = n - ik, as in the rest of the package, and an index with a
|
|
72
|
+
positive imaginary part is conjugated. The inputs that ``miepython``
|
|
73
|
+
rejects, a NaN or infinite m or x, a negative x or a negative real part of
|
|
74
|
+
m, raise the same ``ValueError`` here. The efficiencies accept an array of
|
|
75
|
+
m or x and return arrays, g included. The angular functions describe one
|
|
76
|
+
sphere and vectorize over mu only.
|
|
77
|
+
|
|
78
|
+
Perfect conductors:
|
|
79
|
+
As in the rest of the package, m.real == 0 means a perfect conductor,
|
|
80
|
+
whatever the imaginary part, and m = 0 is one too. No field enters such a
|
|
81
|
+
sphere, so the dielectric expressions, which describe the field inside,
|
|
82
|
+
do not apply. Instead the surface currents radiate an electric dipole and
|
|
83
|
+
a magnetic dipole half as strong and opposite in sign, a1 = 2i x**3/3 and
|
|
84
|
+
b1 = -a1/2. The sphere absorbs nothing, qext = qsca = 10/3 x**4, and
|
|
85
|
+
qback = 9 x**4. The two dipoles add backwards and partly cancel forwards,
|
|
86
|
+
so g = -2/5 and the backscattered intensity is nine times the forward one.
|
|
87
|
+
|
|
88
|
+
Examples:
|
|
89
|
+
A small absorbing sphere, compared with the full Mie solution:
|
|
90
|
+
|
|
91
|
+
>>> import numpy as np
|
|
92
|
+
>>> import miepython as mie
|
|
93
|
+
>>> from miepython import rayleigh
|
|
94
|
+
>>> qext, qsca, qback, g = rayleigh.efficiencies_mx(1.5 - 0.1j, 0.1)
|
|
95
|
+
>>> print(f"{qext:.5f} {qsca:.6f} {g:.4f}")
|
|
96
|
+
0.02006 0.000024 0.0000
|
|
97
|
+
>>> qext, qsca, qback, g = mie.efficiencies_mx(1.5 - 0.1j, 0.1)
|
|
98
|
+
>>> print(f"{qext:.5f} {qsca:.6f} {g:.4f}")
|
|
99
|
+
0.02006 0.000024 0.0020
|
|
100
|
+
|
|
101
|
+
The dipole pattern scatters equally forwards and backwards, and half as
|
|
102
|
+
much at 90 degrees:
|
|
103
|
+
|
|
104
|
+
>>> mu = np.array([-1.0, 0.0, 1.0])
|
|
105
|
+
>>> print(np.round(rayleigh.i_unpolarized(1.5, 0.1, mu), 4))
|
|
106
|
+
[0.1195 0.0597 0.1195]
|
|
107
|
+
>>> print(np.round(mie.i_unpolarized(1.5, 0.1, mu), 4))
|
|
108
|
+
[0.1188 0.0597 0.1199]
|
|
109
|
+
|
|
110
|
+
A perfect conductor scatters mostly backwards:
|
|
111
|
+
|
|
112
|
+
>>> qext, qsca, qback, g = rayleigh.efficiencies_mx(-1j, 0.1)
|
|
113
|
+
>>> print(f"{qsca:.4e} {qback:.4e} {g:.4f}")
|
|
114
|
+
3.3333e-04 9.0000e-04 -0.4000
|
|
115
|
+
>>> qext, qsca, qback, g = mie.efficiencies_mx(-1j, 0.1)
|
|
116
|
+
>>> print(f"{qsca:.4e} {qback:.4e} {g:.4f}")
|
|
117
|
+
3.3413e-04 8.9834e-04 -0.3973
|
|
118
|
+
"""
|
|
2
119
|
|
|
3
120
|
import numpy as np
|
|
4
121
|
|
|
122
|
+
from .core import _check_m_x, _check_one_sphere
|
|
123
|
+
from .core import normalization_factor as core_normalization_factor
|
|
124
|
+
|
|
5
125
|
__all__ = (
|
|
6
126
|
"efficiencies_mx",
|
|
7
127
|
"efficiencies",
|
|
@@ -18,7 +138,9 @@ def efficiencies_mx(m, x):
|
|
|
18
138
|
"""
|
|
19
139
|
Calculate the efficiencies for a small sphere.
|
|
20
140
|
|
|
21
|
-
Based on equations 5.7 - 5.9 in Bohren and Huffman
|
|
141
|
+
Based on equations 5.7 - 5.9 in Bohren and Huffman. A perfect conductor,
|
|
142
|
+
m.real == 0, uses the electric and magnetic dipoles instead; the module
|
|
143
|
+
docstring gives the details.
|
|
22
144
|
|
|
23
145
|
Args:
|
|
24
146
|
m: the complex index of refraction of the sphere
|
|
@@ -28,14 +150,43 @@ def efficiencies_mx(m, x):
|
|
|
28
150
|
qext: the total extinction efficiency
|
|
29
151
|
qsca: the scattering efficiency
|
|
30
152
|
qback: the backscatter efficiency
|
|
31
|
-
g: the average cosine of the scattering phase function
|
|
153
|
+
g: the average cosine of the scattering phase function, 0 for a dielectric, -0.4 for a conductor
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
ValueError: if m or x is not finite, x is negative, or the real part of
|
|
157
|
+
m is negative, exactly as for the full Mie functions
|
|
32
158
|
"""
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
159
|
+
_check_m_x(m, x)
|
|
160
|
+
|
|
161
|
+
# ensure imaginary part of refractive index is negative, as core.py does
|
|
162
|
+
if np.isscalar(m):
|
|
163
|
+
m = np.conj(m) if np.imag(m) > 0 else m
|
|
164
|
+
else:
|
|
165
|
+
m = np.where(np.imag(m) > 0, np.conj(m), m)
|
|
166
|
+
|
|
167
|
+
# the dielectric expressions are evaluated for every entry and then replaced
|
|
168
|
+
# where m is a conductor; a few conductor indices, m = -1j*sqrt(2) and
|
|
169
|
+
# m = -1j*sqrt(1.5), make their denominators vanish, so silence the warnings
|
|
170
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
171
|
+
ratio = (m**2 - 1) / (m**2 + 2)
|
|
172
|
+
qsca = 8 / 3 * x**4 * abs(ratio) ** 2
|
|
173
|
+
# Bohren & Huffman write m = n + ik, so with m = n - ik the absorption term
|
|
174
|
+
# changes sign. The x**4 term is Re(ratio**2), not |ratio|**2: the two only
|
|
175
|
+
# agree for a non-absorbing sphere, and the difference matters near resonance.
|
|
176
|
+
qabs = -4 * x * (ratio * (1 + x**2 / 15 * ratio * (m**4 + 27 * m**2 + 38) / (2 * m**2 + 3))).imag
|
|
177
|
+
qext = qabs + 8 / 3 * x**4 * (ratio**2).real
|
|
178
|
+
qback = 4 * x**4 * abs(ratio) ** 2
|
|
179
|
+
|
|
180
|
+
# A perfect conductor (m.real == 0) radiates a magnetic dipole half as strong
|
|
181
|
+
# as, and opposite to, its electric one: a1 = 2i x**3/3 and b1 = -a1/2. It
|
|
182
|
+
# absorbs nothing, scatters 6/x**2 (|a1|**2 + |b1|**2) = 10/3 x**4, and the
|
|
183
|
+
# interference of the two dipoles throws light backwards, so g = -2/5.
|
|
184
|
+
conductor = np.real(m) == 0
|
|
185
|
+
qsca = np.where(conductor, 10 / 3 * x**4, qsca)[()]
|
|
186
|
+
qext = np.where(conductor, 10 / 3 * x**4, qext)[()]
|
|
187
|
+
qback = np.where(conductor, 9 * x**4, qback)[()]
|
|
188
|
+
# a dielectric's electric dipole alone scatters symmetrically fore and aft
|
|
189
|
+
g = np.where(conductor, -0.4, 0 * qsca)[()]
|
|
39
190
|
return qext, qsca, qback, g
|
|
40
191
|
|
|
41
192
|
|
|
@@ -62,7 +213,10 @@ def efficiencies(m, d, lambda0, n_env=1.0):
|
|
|
62
213
|
|
|
63
214
|
def normalization_factor(m, x, norm_str):
|
|
64
215
|
"""
|
|
65
|
-
Figure out scattering function normalization.
|
|
216
|
+
Figure out scattering function normalization for a small sphere.
|
|
217
|
+
|
|
218
|
+
The rules are the same as for the full Mie solution, so they live in
|
|
219
|
+
``miepython.core``; only the efficiencies feeding them are the Rayleigh ones.
|
|
66
220
|
|
|
67
221
|
Args:
|
|
68
222
|
m: complex index of refraction of sphere
|
|
@@ -72,45 +226,15 @@ def normalization_factor(m, x, norm_str):
|
|
|
72
226
|
Returns:
|
|
73
227
|
scaling factor needed for scattering function
|
|
74
228
|
"""
|
|
75
|
-
|
|
76
|
-
norm = norm_str.lower()
|
|
77
|
-
|
|
78
|
-
if norm in ["bohren"]:
|
|
79
|
-
factor = 1 / 2
|
|
80
|
-
|
|
81
|
-
elif norm in ["wiscombe"]:
|
|
82
|
-
factor = 1
|
|
83
|
-
|
|
84
|
-
elif norm in ["qsca", "scattering_efficiency"]:
|
|
85
|
-
factor = x * np.sqrt(np.pi)
|
|
86
|
-
|
|
87
|
-
else:
|
|
88
|
-
qext, qsca, _, _ = efficiencies_mx(m, x)
|
|
89
|
-
|
|
90
|
-
if norm in ["a", "albedo"]:
|
|
91
|
-
factor = x * np.sqrt(np.pi * qext)
|
|
92
|
-
|
|
93
|
-
if norm in ["1", "one", "unity"]:
|
|
94
|
-
factor = x * np.sqrt(qsca * np.pi)
|
|
95
|
-
|
|
96
|
-
if norm in ["four_pi", "4pi"]:
|
|
97
|
-
factor = x * np.sqrt(qsca / 4)
|
|
98
|
-
|
|
99
|
-
if norm in ["qext", "extinction_efficiency"]:
|
|
100
|
-
factor = x * np.sqrt(qsca * np.pi / qext)
|
|
101
|
-
|
|
102
|
-
if factor is None:
|
|
103
|
-
raise ValueError(
|
|
104
|
-
"normalization must be one of 'albedo' (default), 'one', '4pi', 'qext', 'qsca', 'bohren', or 'wiscombe'"
|
|
105
|
-
)
|
|
106
|
-
return factor
|
|
229
|
+
return core_normalization_factor(m, x, norm_str, efficiency_source=efficiencies_mx)
|
|
107
230
|
|
|
108
231
|
|
|
109
232
|
def S1_S2(m, x, mu, norm="albedo"):
|
|
110
233
|
"""
|
|
111
234
|
Calculate the scattering amplitude functions for small spheres.
|
|
112
235
|
|
|
113
|
-
Based on equation 5.4 in Bohren and Huffman
|
|
236
|
+
Based on equation 5.4 in Bohren and Huffman. A perfect conductor,
|
|
237
|
+
m.real == 0, adds the magnetic dipole b1 = -a1/2 to its electric one.
|
|
114
238
|
|
|
115
239
|
The amplitude functions are normalized so that when integrated
|
|
116
240
|
over all 4*pi solid angles, the integral will be qext*pi*x**2.
|
|
@@ -125,15 +249,29 @@ def S1_S2(m, x, mu, norm="albedo"):
|
|
|
125
249
|
|
|
126
250
|
Returns:
|
|
127
251
|
S1, S2: the scattering amplitudes at each angle mu [sr**(-0.5)]
|
|
252
|
+
|
|
253
|
+
Raises:
|
|
254
|
+
ValueError: if m or x is not finite, x is negative, or the real part of
|
|
255
|
+
m is negative, exactly as for the full Mie functions, or if m or x
|
|
256
|
+
is an array, since this describes one sphere
|
|
128
257
|
"""
|
|
258
|
+
_check_m_x(m, x)
|
|
259
|
+
_check_one_sphere(m, x)
|
|
129
260
|
if np.imag(m) > 0: # ensure imaginary part of refractive index is negative
|
|
130
261
|
m = np.conj(m)
|
|
131
262
|
|
|
132
|
-
|
|
133
|
-
|
|
263
|
+
if np.real(m) == 0:
|
|
264
|
+
# perfect conductor: an electric dipole and a magnetic one, b1 = -a1/2
|
|
265
|
+
a1 = 2j * x**3 / 3
|
|
266
|
+
b1 = -a1 / 2
|
|
267
|
+
else:
|
|
268
|
+
a1 = (2 * x**3) / 3 * (m**2 - 1) / (m**2 + 2) * 1j
|
|
269
|
+
a1 += (2 * x**5) / 5 * (m**2 - 2) * (m**2 - 1) / (m**2 + 2) ** 2 * 1j
|
|
270
|
+
b1 = 0
|
|
134
271
|
|
|
135
|
-
|
|
136
|
-
|
|
272
|
+
# the n = 1 terms of the Mie series, where pi_1 = 1 and tau_1 = mu
|
|
273
|
+
S1 = (3 / 2) * (a1 * np.ones_like(mu) + b1 * mu)
|
|
274
|
+
S2 = (3 / 2) * (a1 * mu + b1 * np.ones_like(mu))
|
|
137
275
|
|
|
138
276
|
normalization = normalization_factor(m, x, norm)
|
|
139
277
|
|
miepython/util.py
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
__all__ = (
|
|
6
6
|
"cs_scalar",
|
|
7
7
|
"cs_vector",
|
|
8
8
|
"cs",
|
|
9
|
+
"phasor_str_scalar",
|
|
9
10
|
"phasor_str",
|
|
10
11
|
"cartesian_to_spherical",
|
|
11
12
|
"spherical_to_cartesian",
|
|
@@ -14,10 +15,29 @@ _all_ = (
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
def cartesian_to_spherical(x, y, z):
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
"""
|
|
19
|
+
Convert Cartesian coordinates (x, y, z) to spherical (r, theta, phi).
|
|
20
|
+
|
|
21
|
+
Scalars and arrays are both accepted and the three inputs are broadcast
|
|
22
|
+
against each other. At the origin theta is reported as 0, and z/r is clipped
|
|
23
|
+
so that rounding cannot push the arccos argument outside [-1, 1].
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
x: Cartesian x coordinate, scalar or array-like
|
|
27
|
+
y: Cartesian y coordinate, scalar or array-like
|
|
28
|
+
z: Cartesian z coordinate, scalar or array-like
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
r, theta, phi: radius, polar angle from +z, azimuth from +x toward +y
|
|
32
|
+
"""
|
|
33
|
+
xx, yy, zz = np.broadcast_arrays(np.asarray(x), np.asarray(y), np.asarray(z))
|
|
34
|
+
r = np.sqrt(xx**2 + yy**2 + zz**2)
|
|
35
|
+
|
|
36
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
37
|
+
cos_theta = np.where(r == 0, 1.0, np.clip(zz / r, -1.0, 1.0))
|
|
38
|
+
|
|
39
|
+
theta = np.arccos(cos_theta) # polar angle (0 to pi)
|
|
40
|
+
phi = np.arctan2(yy, xx) # azimuthal angle (-pi to pi)
|
|
21
41
|
return r, theta, phi
|
|
22
42
|
|
|
23
43
|
|
miepython/vsh.py
CHANGED
|
@@ -29,18 +29,27 @@ Bessel Function Selection:
|
|
|
29
29
|
|
|
30
30
|
Functions:
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
All four take the same arguments ``(n, lambda0, d_sphere, m_index, r, theta,
|
|
33
|
+
phi)``: the multipole order, the vacuum wavelength, the sphere diameter, the
|
|
34
|
+
refractive index of the medium the point lies in, and the spherical coordinates
|
|
35
|
+
of that point. ``lambda0``, ``d_sphere`` and ``r`` share one length unit.
|
|
36
|
+
|
|
37
|
+
M_odd(n, lambda0, d_sphere, m_index, r, theta, phi)
|
|
33
38
|
Compute the nth odd magnetic vector spherical harmonic (m=1).
|
|
34
39
|
|
|
35
|
-
M_even(n,
|
|
40
|
+
M_even(n, lambda0, d_sphere, m_index, r, theta, phi)
|
|
36
41
|
Compute the nth even magnetic vector spherical harmonic (m=1).
|
|
37
42
|
|
|
38
|
-
N_odd(n,
|
|
43
|
+
N_odd(n, lambda0, d_sphere, m_index, r, theta, phi)
|
|
39
44
|
Compute the nth odd electric vector spherical harmonic (m=1).
|
|
40
45
|
|
|
41
|
-
N_even(n,
|
|
46
|
+
N_even(n, lambda0, d_sphere, m_index, r, theta, phi)
|
|
42
47
|
Compute the nth even electric vector spherical harmonic (m=1).
|
|
43
48
|
|
|
49
|
+
Each has an ``*_array`` counterpart -- ``M_odd_array``, ``M_even_array``,
|
|
50
|
+
``N_odd_array``, ``N_even_array`` -- with the identical signature, taking
|
|
51
|
+
array-valued ``r``, ``theta`` and ``phi``.
|
|
52
|
+
|
|
44
53
|
Additional Utility Functions:
|
|
45
54
|
|
|
46
55
|
mie_pi(n, theta, deg=False)
|
|
@@ -54,8 +63,8 @@ Additional Utility Functions:
|
|
|
54
63
|
|
|
55
64
|
import numpy as np
|
|
56
65
|
from scipy.special import spherical_jn, lpmv, factorial2
|
|
57
|
-
from
|
|
58
|
-
|
|
66
|
+
from .bessel import spherical_h1, d_riccati_bessel_h1
|
|
67
|
+
from ._backend import D_calc
|
|
59
68
|
|
|
60
69
|
__all__ = (
|
|
61
70
|
"mie_tau",
|
|
@@ -312,7 +321,7 @@ def N_base(n, m_index, kr, theta, inside):
|
|
|
312
321
|
else:
|
|
313
322
|
factor1 = spherical_jn(n, rho)
|
|
314
323
|
# D_calc returns D_1..D_N; request one extra term and take D_n.
|
|
315
|
-
Dn =
|
|
324
|
+
Dn = D_calc(m_index, kr, n + 1)[n - 1]
|
|
316
325
|
factor2 = factor1 * Dn
|
|
317
326
|
factor1 /= rho
|
|
318
327
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: miepython
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: Mie scattering of a plane wave by a sphere
|
|
5
5
|
Author-email: Scott Prahl <scott.prahl@oit.edu>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -14,12 +14,12 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
-
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
23
|
Description-Content-Type: text/x-rst
|
|
24
24
|
License-File: LICENSE.txt
|
|
25
25
|
Requires-Dist: numpy
|
|
@@ -34,6 +34,7 @@ Requires-Dist: sphinx_automodapi; extra == "docs"
|
|
|
34
34
|
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pytest; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
37
38
|
Requires-Dist: imageio; extra == "dev"
|
|
38
39
|
Requires-Dist: requests; extra == "dev"
|
|
39
40
|
Requires-Dist: ruff; extra == "dev"
|
|
@@ -46,7 +47,6 @@ Requires-Dist: build; extra == "dev"
|
|
|
46
47
|
Requires-Dist: check-manifest; extra == "dev"
|
|
47
48
|
Requires-Dist: libarchive-c; extra == "dev"
|
|
48
49
|
Requires-Dist: pyyaml; extra == "dev"
|
|
49
|
-
Requires-Dist: setuptools; extra == "dev"
|
|
50
50
|
Requires-Dist: jupyterlab; extra == "dev"
|
|
51
51
|
Requires-Dist: nbconvert; extra == "dev"
|
|
52
52
|
Requires-Dist: nbformat; extra == "dev"
|
|
@@ -72,7 +72,7 @@ Dynamic: license-file
|
|
|
72
72
|
:alt: DOI
|
|
73
73
|
|
|
74
74
|
.. |license| image:: https://img.shields.io/github/license/scottprahl/miepython?color=68CA66
|
|
75
|
-
:target: https://github.com/scottprahl/miepython/blob/
|
|
75
|
+
:target: https://github.com/scottprahl/miepython/blob/main/LICENSE.txt
|
|
76
76
|
:alt: License
|
|
77
77
|
|
|
78
78
|
.. |test| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yaml/badge.svg
|
|
@@ -208,9 +208,9 @@ JIT Enabled 0.15 s 27×
|
|
|
208
208
|
Citation
|
|
209
209
|
--------
|
|
210
210
|
|
|
211
|
-
If you use ``
|
|
211
|
+
If you use ``miepython`` in academic, instructional, or applied technical work, please cite:
|
|
212
212
|
|
|
213
|
-
Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.
|
|
213
|
+
Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.3.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
|
|
214
214
|
|
|
215
215
|
BibTeX:
|
|
216
216
|
|
|
@@ -222,7 +222,7 @@ BibTeX:
|
|
|
222
222
|
url = {https://github.com/scottprahl/miepython},
|
|
223
223
|
doi = {10.5281/zenodo.7949263},
|
|
224
224
|
year = {2026},
|
|
225
|
-
version = {3.
|
|
225
|
+
version = {3.3.0},
|
|
226
226
|
publisher = {Zenodo}
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
miepython/__init__.py,sha256=oWYwelBWxyV7Rc9DQSVKvy-Mx4Ck-k2PjfyShl-5pW0,5888
|
|
2
|
+
miepython/_backend.py,sha256=l_faAa6zanygRZKA9vMVcfcutHPFFkpqZzHqwjU8QcE,1619
|
|
3
|
+
miepython/bessel.py,sha256=U094wY_5RFqrVjXZgMbacmt_yqpP8GBtRZ24-MNzBsU,3647
|
|
4
|
+
miepython/core.py,sha256=zv0hkVBBpcr9GA2xwNAxWHancnh7o5X1mp2xZUoz2Js,24974
|
|
5
|
+
miepython/field.py,sha256=zvTf2g0qca0WRfJ9r2SL5YDGObfTYlOpcXUY9BoOQjA,26583
|
|
6
|
+
miepython/mie_jit.py,sha256=kYy9UCfuEgPSL0XY7P8Qx4IqBr9BbffusF6oeZdTnvQ,21685
|
|
7
|
+
miepython/mie_nojit.py,sha256=EGWqpvdnWOOV72x2wPy8TOSYXLguKXKQn-LzRXYpkrs,20315
|
|
8
|
+
miepython/monte_carlo.py,sha256=1pRELa63NcZOkhSe2AviObPztPaKe7JRqMBQn3rp9Ls,8422
|
|
9
|
+
miepython/rayleigh.py,sha256=6PMTNRs_0u3n9-7bBgJ9-QTB-pmGoPs29iOxj3Eub78,16939
|
|
10
|
+
miepython/util.py,sha256=3jxGd0jmPFYolllQXISLDmz0jE4C1AyFD1OyD65dUGo,3648
|
|
11
|
+
miepython/vsh.py,sha256=bPmEBCxbjCcNgisw3qQR-Zso46-aGPrnv9VBu7jhyTM,18114
|
|
12
|
+
miepython/data/Johnson.txt,sha256=PcdEhJ3ZKUnt--86ukEvUt-w-814uOyWXtE-G3qWTNE,1337
|
|
13
|
+
miepython/data/segelstein81_index.txt,sha256=aJLqcPIkw-0WDY37GRcTefLV0WGhyMt6IbOKY8JxGww,36719
|
|
14
|
+
miepython-3.3.1.dist-info/licenses/LICENSE.txt,sha256=g9-BWWRLvMDMQ1Zflxliku7Sleom1_SbXHQHOLGgqqk,1055
|
|
15
|
+
miepython-3.3.1.dist-info/METADATA,sha256=AlX1gk-tBQ2Z6km4sptmW2cGUx51DDAw4nEE0Gz30YE,7789
|
|
16
|
+
miepython-3.3.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
17
|
+
miepython-3.3.1.dist-info/top_level.txt,sha256=bfkk6YwrKm_aIzInR5y03YbywpwCzUjJEHaFkEiSKxI,10
|
|
18
|
+
miepython-3.3.1.dist-info/RECORD,,
|
miepython-3.2.0.dist-info/RECORD
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
miepython/__init__.py,sha256=Hs1MtLbYN1trH8aAIT4uiZASWTtCTu3gki5MNq3HdXs,4516
|
|
2
|
-
miepython/_backend.py,sha256=l_faAa6zanygRZKA9vMVcfcutHPFFkpqZzHqwjU8QcE,1619
|
|
3
|
-
miepython/bessel.py,sha256=U094wY_5RFqrVjXZgMbacmt_yqpP8GBtRZ24-MNzBsU,3647
|
|
4
|
-
miepython/core.py,sha256=_6bceok2AZ5-rxgLw8AZ0qR-x0dPfgjoaY7EUE12FaE,19404
|
|
5
|
-
miepython/field.py,sha256=_kD5lAFJPGhBEjx33wBzqaxho2YBLBImKz5IRmlk8lY,26979
|
|
6
|
-
miepython/mie_jit.py,sha256=wSxuo3Dhhm08tTcWRJeuNxwziM6mnlPwnQHZkaDFILs,16282
|
|
7
|
-
miepython/mie_nojit.py,sha256=Vu5jQLr-wNWjAbNSdNfJynyizn_mWL8kX-KtowYGywU,16216
|
|
8
|
-
miepython/monte_carlo.py,sha256=gemJ2vhUyiTg-hAneGRW3typd3SFM2LL4R2o1UAzLeA,3818
|
|
9
|
-
miepython/rayleigh.py,sha256=P-rpa9SKVH3RaxuUUiZzQYYk6c3cFF6vDAAgo9xChz8,9401
|
|
10
|
-
miepython/util.py,sha256=LQEDkJqz6GHVHYog2JzTE12Ibv2ncLeMI20S8IjZzAc,2908
|
|
11
|
-
miepython/vsh.py,sha256=7uHo2o_cFJ2NzB7QfTI3ABJGEZSaO7ndUdxlY5BG3bo,17532
|
|
12
|
-
miepython/data/Johnson.txt,sha256=PcdEhJ3ZKUnt--86ukEvUt-w-814uOyWXtE-G3qWTNE,1337
|
|
13
|
-
miepython/data/segelstein81_index.txt,sha256=aJLqcPIkw-0WDY37GRcTefLV0WGhyMt6IbOKY8JxGww,36719
|
|
14
|
-
miepython-3.2.0.dist-info/licenses/LICENSE.txt,sha256=g9-BWWRLvMDMQ1Zflxliku7Sleom1_SbXHQHOLGgqqk,1055
|
|
15
|
-
miepython-3.2.0.dist-info/METADATA,sha256=LNH39wbRza2D0DymlOpJ2FBAPsy9k08zwfsxIpYTjKE,7795
|
|
16
|
-
miepython-3.2.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
17
|
-
miepython-3.2.0.dist-info/top_level.txt,sha256=bfkk6YwrKm_aIzInR5y03YbywpwCzUjJEHaFkEiSKxI,10
|
|
18
|
-
miepython-3.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|