miepython 3.0.5__tar.gz → 3.2.0__tar.gz

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.
Files changed (49) hide show
  1. {miepython-3.0.5 → miepython-3.2.0}/CHANGELOG.rst +16 -0
  2. {miepython-3.0.5 → miepython-3.2.0}/CITATION.cff +3 -3
  3. {miepython-3.0.5 → miepython-3.2.0}/PKG-INFO +43 -35
  4. {miepython-3.0.5 → miepython-3.2.0}/README.rst +11 -31
  5. miepython-3.2.0/miepython/__init__.py +155 -0
  6. miepython-3.2.0/miepython/_backend.py +49 -0
  7. {miepython-3.0.5 → miepython-3.2.0}/miepython/core.py +3 -4
  8. miepython-3.2.0/miepython/field.py +726 -0
  9. {miepython-3.0.5 → miepython-3.2.0}/miepython/mie_jit.py +55 -22
  10. {miepython-3.0.5 → miepython-3.2.0}/miepython/mie_nojit.py +73 -34
  11. {miepython-3.0.5 → miepython-3.2.0}/miepython/vsh.py +3 -1
  12. {miepython-3.0.5 → miepython-3.2.0}/miepython.egg-info/PKG-INFO +43 -35
  13. {miepython-3.0.5 → miepython-3.2.0}/miepython.egg-info/SOURCES.txt +2 -0
  14. miepython-3.2.0/miepython.egg-info/requires.txt +36 -0
  15. {miepython-3.0.5 → miepython-3.2.0}/pyproject.toml +50 -7
  16. {miepython-3.0.5 → miepython-3.2.0}/tests/test_all_examples.py +1 -1
  17. miepython-3.2.0/tests/test_bessel.py +201 -0
  18. miepython-3.2.0/tests/test_field.py +360 -0
  19. miepython-3.2.0/tests/test_jit.py +596 -0
  20. {miepython-3.0.5 → miepython-3.2.0}/tests/test_jit_D.py +58 -54
  21. {miepython-3.0.5 → miepython-3.2.0}/tests/test_jit_abcd.py +164 -145
  22. miepython-3.2.0/tests/test_mie_backend_speed.py +86 -0
  23. miepython-3.2.0/tests/test_nojit.py +602 -0
  24. {miepython-3.0.5 → miepython-3.2.0}/tests/test_nojit_D.py +58 -54
  25. {miepython-3.0.5 → miepython-3.2.0}/tests/test_nojit_abcd.py +164 -145
  26. {miepython-3.0.5 → miepython-3.2.0}/tests/test_rayleigh.py +0 -4
  27. {miepython-3.0.5 → miepython-3.2.0}/tests/test_unpolarized_intensity.py +1 -1
  28. {miepython-3.0.5 → miepython-3.2.0}/tests/test_vsh.py +3 -3
  29. miepython-3.0.5/miepython/__init__.py +0 -109
  30. miepython-3.0.5/miepython/field.py +0 -193
  31. miepython-3.0.5/miepython.egg-info/requires.txt +0 -4
  32. miepython-3.0.5/tests/test_bessel.py +0 -188
  33. miepython-3.0.5/tests/test_field.py +0 -31
  34. miepython-3.0.5/tests/test_jit.py +0 -612
  35. miepython-3.0.5/tests/test_nojit.py +0 -622
  36. {miepython-3.0.5 → miepython-3.2.0}/LICENSE.txt +0 -0
  37. {miepython-3.0.5 → miepython-3.2.0}/MANIFEST.in +0 -0
  38. {miepython-3.0.5 → miepython-3.2.0}/miepython/bessel.py +0 -0
  39. {miepython-3.0.5 → miepython-3.2.0}/miepython/data/Johnson.txt +0 -0
  40. {miepython-3.0.5 → miepython-3.2.0}/miepython/data/segelstein81_index.txt +0 -0
  41. {miepython-3.0.5 → miepython-3.2.0}/miepython/monte_carlo.py +0 -0
  42. {miepython-3.0.5 → miepython-3.2.0}/miepython/rayleigh.py +0 -0
  43. {miepython-3.0.5 → miepython-3.2.0}/miepython/util.py +0 -0
  44. {miepython-3.0.5 → miepython-3.2.0}/miepython.egg-info/dependency_links.txt +0 -0
  45. {miepython-3.0.5 → miepython-3.2.0}/miepython.egg-info/top_level.txt +0 -0
  46. {miepython-3.0.5 → miepython-3.2.0}/setup.cfg +0 -0
  47. {miepython-3.0.5 → miepython-3.2.0}/tests/test_all_notebooks.py +0 -0
  48. {miepython-3.0.5 → miepython-3.2.0}/tests/test_jit_speed.py +1 -1
  49. {miepython-3.0.5 → miepython-3.2.0}/tests/test_nojit_speed.py +1 -1
@@ -1,6 +1,22 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 3.2.0 (03/06/2026)
5
+ -------------------
6
+ * fix error in E & H calculations in the near field when y≠0 (thanks @dorianherle)
7
+ * add regression test
8
+
9
+ 3.1.0 (02/07/2026)
10
+ -------------------
11
+ * add near-field E and H field APIs, fix boundary continuity/medium handling, and expand validation tests
12
+ * add field calculation utilities, field module cleanup/help text improvements, and precomputed E/H reference data (via scattnlay)
13
+ * improve performance: ~20% speedups in Mie backends and faster near-field calculations; add speed benchmarks
14
+ * documentation updates: new/updated notebooks (boundary conditions, 2D fields, performance), clarified conventions
15
+ * refresh docs/README visuals and assets; add custom CSS for docs images
16
+ * jupyterlite/RTD updates: config moves, build modernizations, and avoid numba install in JupyterLite
17
+ * packaging/CI: pyproject and requirements cleanup, improved PyPI workflow, updated citation automation/config
18
+ * misc cleanups: remove unused files/images, minor typos, Makefile and docs config tidy-ups, CITATION.cff refresh
19
+
4
20
  3.0.5 (1/2/2026)
5
21
  -------------------
6
22
  * fix versioning
@@ -2,9 +2,9 @@ cff-version: 1.2.0
2
2
  type: software
3
3
  message: If you use this software, please cite it as below.
4
4
  title: 'miepython: Pure python calculation of Mie scattering'
5
- version: 3.0.5
5
+ version: 3.1.0
6
6
  doi: 10.5281/zenodo.7949264
7
- date-released: '2026-01-03'
7
+ date-released: '2026-02-08'
8
8
  url: https://doi.org/10.5281/zenodo.7949264
9
9
  repository-code: https://github.com/scottprahl/miepython
10
10
  license: MIT
@@ -33,7 +33,7 @@ preferred-citation:
33
33
  type: software
34
34
  title: 'miepython: Pure python calculation of Mie scattering'
35
35
  year: 2026
36
- version: 3.0.5
36
+ version: 3.1.0
37
37
  doi: 10.5281/zenodo.7949264
38
38
  url: https://doi.org/10.5281/zenodo.7949264
39
39
  authors:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: miepython
3
- Version: 3.0.5
3
+ Version: 3.2.0
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,17 +14,45 @@ 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.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
- Requires-Python: >=3.9
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Requires-Python: >=3.10
22
23
  Description-Content-Type: text/x-rst
23
24
  License-File: LICENSE.txt
24
25
  Requires-Dist: numpy
25
26
  Requires-Dist: matplotlib
26
- Requires-Dist: numba
27
27
  Requires-Dist: scipy
28
+ Requires-Dist: numba; sys_platform != "emscripten"
29
+ Provides-Extra: docs
30
+ Requires-Dist: Sphinx>=8.1.3; extra == "docs"
31
+ Requires-Dist: nbsphinx>=0.9.7; extra == "docs"
32
+ Requires-Dist: ipython; extra == "docs"
33
+ Requires-Dist: sphinx_automodapi; extra == "docs"
34
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest; extra == "dev"
37
+ Requires-Dist: imageio; extra == "dev"
38
+ Requires-Dist: requests; extra == "dev"
39
+ Requires-Dist: ruff; extra == "dev"
40
+ Requires-Dist: yamllint; extra == "dev"
41
+ Requires-Dist: rstcheck[sphinx,toml]; extra == "dev"
42
+ Requires-Dist: pylint; extra == "dev"
43
+ Requires-Dist: pyroma; extra == "dev"
44
+ Requires-Dist: black[jupyter]; extra == "dev"
45
+ Requires-Dist: build; extra == "dev"
46
+ Requires-Dist: check-manifest; extra == "dev"
47
+ Requires-Dist: libarchive-c; extra == "dev"
48
+ Requires-Dist: pyyaml; extra == "dev"
49
+ Requires-Dist: setuptools; extra == "dev"
50
+ Requires-Dist: jupyterlab; extra == "dev"
51
+ Requires-Dist: nbconvert; extra == "dev"
52
+ Requires-Dist: nbformat; extra == "dev"
53
+ Provides-Extra: lite
54
+ Requires-Dist: jupyterlite-core<0.8,>=0.7; extra == "lite"
55
+ Requires-Dist: jupyterlite-pyodide-kernel<0.8,>=0.7; extra == "lite"
28
56
  Dynamic: license-file
29
57
 
30
58
  .. |pypi| image:: https://img.shields.io/pypi/v/miepython?color=68CA66
@@ -47,8 +75,8 @@ Dynamic: license-file
47
75
  :target: https://github.com/scottprahl/miepython/blob/master/LICENSE.txt
48
76
  :alt: License
49
77
 
50
- .. |test| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yml/badge.svg
51
- :target: https://github.com/scottprahl/miepython/actions/workflows/test.yml
78
+ .. |test| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yaml/badge.svg
79
+ :target: https://github.com/scottprahl/miepython/actions/workflows/test.yaml
52
80
  :alt: Testing
53
81
 
54
82
  .. |docs| image:: https://readthedocs.org/projects/miepython/badge?color=68CA66
@@ -86,11 +114,13 @@ The library implements the full Mie solution, including:
86
114
  - angle-resolved scattering intensities
87
115
  - Mie expansion coefficients
88
116
  - complex amplitude functions and Mueller matrices
117
+ - E-field and H-field calculations in the near-field around a sphere
89
118
 
90
119
  The implementation is numerically stable for a wide range of size parameters and refractive indices, including lossy materials and high-index contrasts.
91
120
 
92
- Immediate Use in the Browser
93
- ----------------------------
121
+
122
+ JupyterLite Implementation
123
+ --------------------------
94
124
 
95
125
  The entire package can be used **immediately** in a browser — without installation — using the JupyterLite interface:
96
126
 
@@ -138,33 +168,10 @@ A typical calculation is straightforward:
138
168
  Documentation and Examples
139
169
  --------------------------
140
170
 
141
- The full documentation is available as:
171
+ The full documentation is available on ReadTheDocs:
142
172
 
143
- Interactive documentation (JupyterLite):
144
- |lite|
145
-
146
- Static Jupyter notebooks on ReadTheDocs:
147
173
  |docs|
148
174
 
149
- Among other things the documentation discusses:
150
-
151
- - **Mathematical formulation of Mie theory**
152
- https://miepython.readthedocs.io/en/latest/01_theory.html
153
-
154
- - **Normalization conventions and units**
155
- https://miepython.readthedocs.io/en/latest/02_normalization.html
156
-
157
- - **Numerical stability considerations**
158
- https://miepython.readthedocs.io/en/latest/03_stability.html
159
-
160
- - **Validation against MIEV0 and other reference implementations**
161
- https://miepython.readthedocs.io/en/latest/04_validation.html
162
-
163
- - **Guidelines for parameter choices and truncation order**
164
- https://miepython.readthedocs.io/en/latest/05_truncation.html
165
-
166
- - **Physical interpretation, resonances, and comparison plots**
167
- https://miepython.readthedocs.io/en/latest/06_examples.html
168
175
 
169
176
  Representative results simple examples:
170
177
 
@@ -174,6 +181,7 @@ Representative results simple examples:
174
181
  .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/02.svg
175
182
  .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/03.svg
176
183
  .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/04.svg
184
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/05.svg
177
185
 
178
186
  Performance and Acceleration
179
187
  ----------------------------
@@ -202,19 +210,19 @@ Citation
202
210
 
203
211
  If you use ``laserbeamsize`` in academic, instructional, or applied technical work, please cite:
204
212
 
205
- Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.0.5) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
213
+ Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.1.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
206
214
 
207
215
  BibTeX:
208
216
 
209
217
  .. code-block:: bibtex
210
218
 
211
- @software{prahl_miepython_2025,
219
+ @software{prahl_miepython_2026,
212
220
  author = {Scott Prahl},
213
221
  title = {{miepython}: A Python library for Mie scattering calculations},
214
222
  url = {https://github.com/scottprahl/miepython},
215
223
  doi = {10.5281/zenodo.7949263},
216
224
  year = {2026},
217
- version = {3.0.5},
225
+ version = {3.1.0},
218
226
  publisher = {Zenodo}
219
227
  }
220
228
 
@@ -18,8 +18,8 @@
18
18
  :target: https://github.com/scottprahl/miepython/blob/master/LICENSE.txt
19
19
  :alt: License
20
20
 
21
- .. |test| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yml/badge.svg
22
- :target: https://github.com/scottprahl/miepython/actions/workflows/test.yml
21
+ .. |test| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yaml/badge.svg
22
+ :target: https://github.com/scottprahl/miepython/actions/workflows/test.yaml
23
23
  :alt: Testing
24
24
 
25
25
  .. |docs| image:: https://readthedocs.org/projects/miepython/badge?color=68CA66
@@ -57,11 +57,13 @@ The library implements the full Mie solution, including:
57
57
  - angle-resolved scattering intensities
58
58
  - Mie expansion coefficients
59
59
  - complex amplitude functions and Mueller matrices
60
+ - E-field and H-field calculations in the near-field around a sphere
60
61
 
61
62
  The implementation is numerically stable for a wide range of size parameters and refractive indices, including lossy materials and high-index contrasts.
62
63
 
63
- Immediate Use in the Browser
64
- ----------------------------
64
+
65
+ JupyterLite Implementation
66
+ --------------------------
65
67
 
66
68
  The entire package can be used **immediately** in a browser — without installation — using the JupyterLite interface:
67
69
 
@@ -109,33 +111,10 @@ A typical calculation is straightforward:
109
111
  Documentation and Examples
110
112
  --------------------------
111
113
 
112
- The full documentation is available as:
114
+ The full documentation is available on ReadTheDocs:
113
115
 
114
- Interactive documentation (JupyterLite):
115
- |lite|
116
-
117
- Static Jupyter notebooks on ReadTheDocs:
118
116
  |docs|
119
117
 
120
- Among other things the documentation discusses:
121
-
122
- - **Mathematical formulation of Mie theory**
123
- https://miepython.readthedocs.io/en/latest/01_theory.html
124
-
125
- - **Normalization conventions and units**
126
- https://miepython.readthedocs.io/en/latest/02_normalization.html
127
-
128
- - **Numerical stability considerations**
129
- https://miepython.readthedocs.io/en/latest/03_stability.html
130
-
131
- - **Validation against MIEV0 and other reference implementations**
132
- https://miepython.readthedocs.io/en/latest/04_validation.html
133
-
134
- - **Guidelines for parameter choices and truncation order**
135
- https://miepython.readthedocs.io/en/latest/05_truncation.html
136
-
137
- - **Physical interpretation, resonances, and comparison plots**
138
- https://miepython.readthedocs.io/en/latest/06_examples.html
139
118
 
140
119
  Representative results simple examples:
141
120
 
@@ -145,6 +124,7 @@ Representative results simple examples:
145
124
  .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/02.svg
146
125
  .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/03.svg
147
126
  .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/04.svg
127
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/05.svg
148
128
 
149
129
  Performance and Acceleration
150
130
  ----------------------------
@@ -173,19 +153,19 @@ Citation
173
153
 
174
154
  If you use ``laserbeamsize`` in academic, instructional, or applied technical work, please cite:
175
155
 
176
- Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.0.5) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
156
+ Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.1.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
177
157
 
178
158
  BibTeX:
179
159
 
180
160
  .. code-block:: bibtex
181
161
 
182
- @software{prahl_miepython_2025,
162
+ @software{prahl_miepython_2026,
183
163
  author = {Scott Prahl},
184
164
  title = {{miepython}: A Python library for Mie scattering calculations},
185
165
  url = {https://github.com/scottprahl/miepython},
186
166
  doi = {10.5281/zenodo.7949263},
187
167
  year = {2026},
188
- version = {3.0.5},
168
+ version = {3.1.0},
189
169
  publisher = {Zenodo}
190
170
  }
191
171
 
@@ -0,0 +1,155 @@
1
+ """
2
+ Mie scattering calculations for perfect spheres.
3
+
4
+ Extensive documentation is at <https://miepython.readthedocs.io>
5
+
6
+ `miepython` is a pure Python module to calculate light scattering of
7
+ a plane wave by non-absorbing, partially-absorbing, or perfectly conducting
8
+ spheres.
9
+
10
+ The extinction efficiency, scattering efficiency, backscattering, and
11
+ scattering asymmetry for a sphere with complex index of refraction m,
12
+ diameter d, and wavelength lambda can be found by::
13
+
14
+ import miepython as mie
15
+ qext, qsca, qback, g = mie.efficiencies(m, d, lambda0)
16
+
17
+ The normalized scattering values for angles mu=cos(theta) are::
18
+
19
+ Ipar, Iper = mie.intensities(m, d, lambda0, mu)
20
+
21
+ If the size parameter is known, then use::
22
+
23
+ mie.efficiencies_mx(m, x)
24
+
25
+ Mie scattering amplitudes S1 and S2 (complex numbers):
26
+
27
+ mie.S1_S2(m, x, mu)
28
+
29
+ Normalized Mie scattering intensities for angles mu=cos(theta)::
30
+
31
+ mie.i_per(m, x, mu)
32
+ mie.i_par(m, x, mu)
33
+ mie.i_unpolarized(m, x, mu)
34
+
35
+ Mie scattering intensities normalized to one when integrated over all angles::
36
+
37
+ mie.i_per(m, x, mu, norm='one')
38
+ mie.i_par(m, x, mu, norm='one')
39
+ mie.i_unpolarized(m, x, mu, norm='one')
40
+
41
+ The scattering matrix
42
+
43
+ mie.phase_matrix(m, x, mu)
44
+
45
+ Near-field calculations are provided by the ``miepython.field`` module::
46
+
47
+ from miepython.field import e_near, h_near, eh_near
48
+ from miepython.field import e_near_cartesian, h_near_cartesian, eh_near_cartesian
49
+ from miepython.field import e_far
50
+
51
+ Example near-field usage::
52
+
53
+ import numpy as np
54
+ from miepython.field import eh_near_cartesian
55
+
56
+ u = np.linspace(-1.5, 1.5, 101)
57
+ X, Z = np.meshgrid(u, u, indexing='xy')
58
+ E_xyz, H_xyz = eh_near_cartesian(
59
+ lambda0=1.0, d_sphere=1.0, m_sphere=1.5 + 0.0j, n_env=1.0,
60
+ x=X, y=np.zeros_like(X), z=Z
61
+ )
62
+
63
+ """
64
+
65
+ from ._backend import D_calc, USE_JIT, _D_downwards, _D_upwards, _Lentz_Dn, _S1_S2, an_bn, cn_dn, pi_tau
66
+ from ._backend import single_sphere, small_conducting_sphere, small_sphere
67
+
68
+ from .core import efficiencies, intensities, i_par, i_per, i_unpolarized
69
+ from .core import efficiencies_mx, S1_S2, phase_matrix, coefficients
70
+
71
+ _FIELD_IMPORT_ERROR = None
72
+
73
+
74
+ def _raise_field_import_error():
75
+ """Raise a consistent error when optional near-field dependencies are missing."""
76
+ raise ModuleNotFoundError(
77
+ "Near-field functions require the optional dependency 'scipy'. "
78
+ "Install miepython with SciPy support to use e_far/e_near/h_near/eh_near."
79
+ ) from _FIELD_IMPORT_ERROR
80
+
81
+
82
+ def _missing_field_function(name):
83
+ """Create a placeholder near-field function when SciPy is unavailable."""
84
+
85
+ def _missing(*_args, **_kwargs):
86
+ _raise_field_import_error()
87
+
88
+ _missing.__name__ = name
89
+ _missing.__qualname__ = name
90
+ _missing.__doc__ = f"{name} requires the optional dependency 'scipy'."
91
+ return _missing
92
+
93
+
94
+ try:
95
+ from . import field as _field
96
+ except ModuleNotFoundError as exc:
97
+ missing_module = str(getattr(exc, "name", "") or "")
98
+ if missing_module.startswith("scipy"):
99
+ _FIELD_IMPORT_ERROR = exc
100
+ e_far = _missing_field_function("e_far")
101
+ e_near = _missing_field_function("e_near")
102
+ h_near = _missing_field_function("h_near")
103
+ eh_near = _missing_field_function("eh_near")
104
+ e_near_cartesian = _missing_field_function("e_near_cartesian")
105
+ h_near_cartesian = _missing_field_function("h_near_cartesian")
106
+ eh_near_cartesian = _missing_field_function("eh_near_cartesian")
107
+ else:
108
+ raise
109
+ else:
110
+ e_far = _field.e_far
111
+ e_near = _field.e_near
112
+ h_near = _field.h_near
113
+ eh_near = _field.eh_near
114
+ e_near_cartesian = _field.e_near_cartesian
115
+ h_near_cartesian = _field.h_near_cartesian
116
+ eh_near_cartesian = _field.eh_near_cartesian
117
+
118
+ # functions exposed to the user
119
+ __all__ = (
120
+ "intensities",
121
+ "i_par",
122
+ "i_per",
123
+ "i_unpolarized",
124
+ "phase_matrix",
125
+ "coefficients",
126
+ "efficiencies",
127
+ "efficiencies_mx",
128
+ "e_far",
129
+ "e_near",
130
+ "h_near",
131
+ "eh_near",
132
+ "e_near_cartesian",
133
+ "h_near_cartesian",
134
+ "eh_near_cartesian",
135
+ "an_bn",
136
+ "cn_dn",
137
+ "S1_S2",
138
+ "single_sphere",
139
+ "small_sphere",
140
+ "small_conducting_sphere",
141
+ "USE_JIT",
142
+ "D_calc",
143
+ "pi_tau",
144
+ "_S1_S2",
145
+ "_Lentz_Dn",
146
+ "_D_upwards",
147
+ "_D_downwards",
148
+ )
149
+
150
+ __version__ = "3.2.0"
151
+ __author__ = "Scott Prahl"
152
+ __email__ = "scott.prahl@oit.edu"
153
+ __copyright__ = "2017-2026, Scott Prahl"
154
+ __license__ = "MIT"
155
+ __url__ = "https://github.com/scottprahl/miepython.git"
@@ -0,0 +1,49 @@
1
+ """Select and expose the active low-level backend implementation.
2
+
3
+ This module centralizes JIT vs no-JIT backend selection so other modules can
4
+ import backend callables without importing ``miepython`` package root.
5
+ """
6
+
7
+ import os
8
+
9
+ USE_JIT = os.environ.get("MIEPYTHON_USE_JIT", "0") == "1"
10
+
11
+ if USE_JIT:
12
+ from .mie_jit import _D_calc_nb as D_calc
13
+ from .mie_jit import _D_downwards
14
+ from .mie_jit import _D_upwards
15
+ from .mie_jit import _Lentz_Dn
16
+ from .mie_jit import _S1_S2_nb as _S1_S2
17
+ from .mie_jit import _an_bn_nb as an_bn
18
+ from .mie_jit import _cn_dn_nb as cn_dn
19
+ from .mie_jit import _pi_tau_nb as pi_tau
20
+ from .mie_jit import _single_sphere_nb as single_sphere
21
+ from .mie_jit import _small_conducting_sphere_nb as small_conducting_sphere
22
+ from .mie_jit import _small_sphere_nb as small_sphere
23
+ else:
24
+ from .mie_nojit import _D_calc_py as D_calc
25
+ from .mie_nojit import _D_downwards
26
+ from .mie_nojit import _D_upwards
27
+ from .mie_nojit import _Lentz_Dn
28
+ from .mie_nojit import _S1_S2_py as _S1_S2
29
+ from .mie_nojit import _an_bn_py as an_bn
30
+ from .mie_nojit import _cn_dn_py as cn_dn
31
+ from .mie_nojit import _pi_tau_py as pi_tau
32
+ from .mie_nojit import _single_sphere_py as single_sphere
33
+ from .mie_nojit import _small_conducting_sphere_py as small_conducting_sphere
34
+ from .mie_nojit import _small_sphere_py as small_sphere
35
+
36
+ __all__ = (
37
+ "USE_JIT",
38
+ "D_calc",
39
+ "an_bn",
40
+ "cn_dn",
41
+ "pi_tau",
42
+ "single_sphere",
43
+ "small_sphere",
44
+ "small_conducting_sphere",
45
+ "_S1_S2",
46
+ "_Lentz_Dn",
47
+ "_D_upwards",
48
+ "_D_downwards",
49
+ )
@@ -34,8 +34,7 @@ Normalized Mie scattering intensities for angles mu=cos(theta)::
34
34
  """
35
35
 
36
36
  import numpy as np
37
- from miepython import an_bn, cn_dn, single_sphere, _S1_S2
38
-
37
+ from ._backend import _S1_S2, an_bn, cn_dn, single_sphere
39
38
 
40
39
  # not really needed but included for clarity
41
40
  __all__ = (
@@ -382,7 +381,7 @@ def i_per(m, x, mu, norm="albedo", n_pole=0):
382
381
  This function calculates the angular distribution of the scattered intensity from a sphere
383
382
  for incident light with its electric field vector perpendicular to the scattering plane
384
383
  (the plane defined by the incident direction and the scattered direction).
385
- This corresponds to the |S₁(θ)|² term in Mie theory.
384
+ This corresponds to the :math:`|S₁(θ)|²` term in Mie theory.
386
385
 
387
386
  The result is normalized according to the specified method. The normalization affects
388
387
  the total integrated intensity over 4π steradians. Accepted normalization options include:
@@ -411,7 +410,7 @@ def i_par(m, x, mu, norm="albedo", n_pole=0):
411
410
  This function calculates the angular distribution of the scattered intensity from a sphere
412
411
  for incident light with its electric field vector parallel to the scattering plane
413
412
  (the plane defined by the incident direction and the scattered direction).
414
- This corresponds to the |S₂(θ)|² term in Mie theory.
413
+ This corresponds to the :math:`|S₂(θ)|²` term in Mie theory.
415
414
 
416
415
  The result is normalized according to the specified method. The normalization affects
417
416
  the total integrated intensity over 4π steradians. Accepted normalization options include: