miepython 2.5.4__tar.gz → 3.0.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 (55) hide show
  1. {miepython-2.5.4 → miepython-3.0.0}/CHANGELOG.rst +29 -15
  2. {miepython-2.5.4 → miepython-3.0.0}/CITATION.cff +2 -2
  3. miepython-3.0.0/PKG-INFO +179 -0
  4. miepython-3.0.0/README.rst +149 -0
  5. miepython-3.0.0/miepython/__init__.py +85 -0
  6. miepython-3.0.0/miepython/bessel.py +126 -0
  7. miepython-3.0.0/miepython/core.py +741 -0
  8. miepython-3.0.0/miepython/examples/01_dielectric.py +28 -0
  9. miepython-3.0.0/miepython/examples/02_glass.py +31 -0
  10. miepython-3.0.0/miepython/examples/03_droplets.py +35 -0
  11. miepython-3.0.0/miepython/examples/04_gold.py +207 -0
  12. miepython-3.0.0/miepython/field.py +193 -0
  13. miepython-3.0.0/miepython/mie_jit.py +325 -0
  14. miepython-3.0.0/miepython/mie_nojit.py +323 -0
  15. miepython-3.0.0/miepython/monte_carlo.py +124 -0
  16. miepython-3.0.0/miepython/rayleigh.py +293 -0
  17. miepython-3.0.0/miepython/util.py +113 -0
  18. miepython-3.0.0/miepython/vsh.py +460 -0
  19. miepython-3.0.0/miepython.egg-info/PKG-INFO +179 -0
  20. {miepython-2.5.4 → miepython-3.0.0}/miepython.egg-info/SOURCES.txt +19 -3
  21. {miepython-2.5.4 → miepython-3.0.0}/miepython.egg-info/requires.txt +1 -0
  22. miepython-3.0.0/pyproject.toml +78 -0
  23. {miepython-2.5.4 → miepython-3.0.0}/requirements-dev.txt +3 -0
  24. {miepython-2.5.4 → miepython-3.0.0}/requirements.txt +2 -0
  25. miepython-3.0.0/setup.cfg +17 -0
  26. {miepython-2.5.4 → miepython-3.0.0}/setup.py +13 -13
  27. miepython-3.0.0/tests/test_bessel.py +188 -0
  28. miepython-3.0.0/tests/test_field.py +31 -0
  29. miepython-2.5.4/tests/test_mie.py → miepython-3.0.0/tests/test_jit.py +215 -260
  30. miepython-3.0.0/tests/test_jit_D.py +241 -0
  31. miepython-3.0.0/tests/test_jit_abcd.py +874 -0
  32. miepython-3.0.0/tests/test_nojit.py +622 -0
  33. miepython-3.0.0/tests/test_nojit_D.py +241 -0
  34. miepython-3.0.0/tests/test_nojit_abcd.py +876 -0
  35. miepython-3.0.0/tests/test_rayleigh.py +87 -0
  36. miepython-3.0.0/tests/test_vsh.py +293 -0
  37. miepython-2.5.4/PKG-INFO +0 -197
  38. miepython-2.5.4/README.rst +0 -169
  39. miepython-2.5.4/miepython/__init__.py +0 -52
  40. miepython-2.5.4/miepython/examples/01_dielectric.py +0 -23
  41. miepython-2.5.4/miepython/examples/02_glass.py +0 -40
  42. miepython-2.5.4/miepython/examples/03_droplets.py +0 -44
  43. miepython-2.5.4/miepython/examples/04_gold.py +0 -61
  44. miepython-2.5.4/miepython/miepython.py +0 -859
  45. miepython-2.5.4/miepython/miepython_nojit.py +0 -777
  46. miepython-2.5.4/miepython.egg-info/PKG-INFO +0 -197
  47. miepython-2.5.4/pyproject.toml +0 -34
  48. miepython-2.5.4/setup.cfg +0 -59
  49. {miepython-2.5.4 → miepython-3.0.0}/LICENSE.txt +0 -0
  50. {miepython-2.5.4 → miepython-3.0.0}/MANIFEST.in +0 -0
  51. {miepython-2.5.4 → miepython-3.0.0}/miepython/data/Johnson.txt +0 -0
  52. {miepython-2.5.4 → miepython-3.0.0}/miepython/data/ag-Johnson.txt +0 -0
  53. {miepython-2.5.4 → miepython-3.0.0}/miepython/data/segelstein81_index.txt +0 -0
  54. {miepython-2.5.4 → miepython-3.0.0}/miepython.egg-info/dependency_links.txt +0 -0
  55. {miepython-2.5.4 → miepython-3.0.0}/miepython.egg-info/top_level.txt +0 -0
@@ -1,21 +1,35 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 2.5.4 (5/7/2024)
5
- --------------------
6
- * document normalization in docstrings
7
- * add version and year to CITATION.cff
8
- * remove 'v' from version numbers
9
- * add github script and workflow to auto-update CITATION.cff
10
- * add conda badge to readme
11
- * clean up README.rst
12
- * use svg images
13
- * use a single tests/test_mie for jit and non-jit tests
14
- * support ruff
15
- * test python versions 3.7 to 3.12
16
- * fix badges
17
- * remove unused functions
18
- * fix zenodo link
4
+ 3.0.0 (3/16/2025)
5
+ -------------------
6
+ * breaking api changes
7
+ * api is more sane: mie.efficiencies() instead of miepython.ez_mie()
8
+ * use core.py to cleanly separate jit and non-jit code
9
+ * new function to calculate mie coefficients inside sphere
10
+ * new function to calculate E-fields near and far from sphere (only works in far-field)
11
+ * new rayleigh.py
12
+ * new vsh.py to calculate vector spherical harmonics
13
+ * new util.py for printing complex numbers
14
+ * new bessel.py for complete spherical bessel function support
15
+ * put Monte Carlo routines into their own file
16
+ * use black for python formatting
17
+ * update all notebooks to use new api
18
+ * add more tests
19
+
20
+
21
+ 2.5.5 (12/01/2025)
22
+ -------------------
23
+ * add support for specific spherical modes
24
+ * only branch is now 'main'
25
+
26
+ 2.5.4 (05/07/2024)
27
+ -------------------
28
+ * add auto-dating in CITATION
29
+ * add python 3.12
30
+ * add ruff, pylint config
31
+ * simplify mie_cdf and fix notebook
32
+ * set 3.7 as earliest python version
19
33
 
20
34
  v2.5.3 (8/5/2023)
21
35
  -------------------
@@ -4,8 +4,8 @@ authors:
4
4
  orcid: https://orcid.org/0000-0003-1468-6851
5
5
  cff-version: 1.2.0
6
6
  date-released: '2023-08-05'
7
- doi: 10.5281/zenodo.7949263
7
+ doi: 10.5281/zenodo.7949264
8
8
  message: If you use this software, please cite it as below.
9
9
  title: 'miepython: Pure python calculation of Mie scattering'
10
- url: https://doi.org/10.5281/zenodo.7949263
10
+ url: https://doi.org/10.5281/zenodo.7949403
11
11
  version: v2.5.3
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.2
2
+ Name: miepython
3
+ Version: 3.0.0
4
+ Summary: Mie scattering of a plane wave by a sphere
5
+ Home-page: https://github.com/scottprahl/miepython.git
6
+ Author: Scott Prahl
7
+ Author-email: scott.prahl@oit.edu
8
+ License: MIT License
9
+ Keywords: mie,scattering,rainbow,droplet,backscatter,sphere,nanoparticle,cloud,phase function,efficiency,rayleigh,backscattering
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/x-rst
22
+ License-File: LICENSE.txt
23
+ Requires-Dist: numpy
24
+ Requires-Dist: matplotlib
25
+ Requires-Dist: numba
26
+ Requires-Dist: scipy
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: home-page
30
+
31
+ .. |pypi| image:: https://img.shields.io/pypi/v/miepython?color=68CA66
32
+ :target: https://pypi.org/project/miepython/
33
+ :alt: pypi
34
+
35
+ .. |github| image:: https://img.shields.io/github/v/tag/scottprahl/miepython?label=github&color=68CA66
36
+ :target: https://github.com/scottprahl/miepython
37
+ :alt: github
38
+
39
+ .. |conda| image:: https://img.shields.io/conda/vn/conda-forge/miepython?label=conda&color=68CA66
40
+ :target: https://github.com/conda-forge/miepython-feedstock
41
+ :alt: conda
42
+
43
+ .. |doi| image:: https://zenodo.org/badge/99259684.svg
44
+ :target: https://zenodo.org/badge/latestdoi/99259684
45
+ :alt: doi
46
+
47
+ .. |license| image:: https://img.shields.io/github/license/scottprahl/miepython?color=68CA66
48
+ :target: https://github.com/scottprahl/miepython/blob/master/LICENSE.txt
49
+ :alt: License
50
+
51
+ .. |test| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yml/badge.svg
52
+ :target: https://github.com/scottprahl/miepython/actions/workflows/test.yml
53
+ :alt: Testing
54
+
55
+ .. |docs| image:: https://readthedocs.org/projects/miepython/badge?color=68CA66
56
+ :target: https://miepython.readthedocs.io
57
+ :alt: Docs
58
+
59
+ .. |downloads| image:: https://img.shields.io/pypi/dm/miepython?color=68CA66
60
+ :target: https://pypi.org/project/miepython/
61
+ :alt: Downloads
62
+
63
+ .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
64
+ :target: https://github.com/psf/black
65
+ :alt: code style: black
66
+
67
+ miepython
68
+ =========
69
+
70
+ by Scott Prahl
71
+
72
+ |pypi| |github| |conda| |doi|
73
+
74
+ |license| |test| |docs| |downloads| |black|
75
+
76
+ ________
77
+
78
+ ``miepython`` is a pure Python module to calculate light scattering for
79
+ non-absorbing, partially-absorbing, or perfectly-conducting spheres.
80
+
81
+ This code provides functions for calculating the extinction efficiency,
82
+ scattering efficiency, backscattering, and scattering asymmetry. Moreover, a set
83
+ of angles can be given to calculate the scattering for a sphere at each of those
84
+ angles.
85
+
86
+ Mie computations are done following `the procedure described by Wiscombe
87
+ <http://opensky.ucar.edu/islandora/object/technotes:232>`_. This code has
88
+ been validated against his results.
89
+
90
+ Full documentation at <https://miepython.readthedocs.io>
91
+
92
+ Version 3 changes
93
+ -----------------
94
+
95
+ This version contains major changes to the code base and **has API breaking changes**.
96
+ If you don't need the new functionality for fields, then you can continue to use the
97
+ last version with the old API: 2.5.5
98
+
99
+ Version 3.0 has many changes, but the major ones are:
100
+
101
+ * a complete overhaul of API
102
+ * added support to calculate Mie coefficients for fields inside sphere
103
+ * future work will implement calculating electric and magnetic fields
104
+
105
+ Pay Attention!
106
+ --------------
107
+
108
+ When comparing different Mie scattering codes, make sure that you're aware of the conventions used by each code. ``miepython`` makes the following assumptions:
109
+
110
+ #. The imaginary part of the complex index of refraction for absorbing spheres is *negative*.
111
+ Currently if you pass refractive indicies with a positive imaginary value, the refractive
112
+ index is silently converted to a negative value before calculation.
113
+
114
+ #. The scattering phase function is normalized so it equals the *single scattering albedo* when
115
+ integrated over 4π steradians. The default normalization can now be changed.
116
+
117
+
118
+ Installation
119
+ ---------------
120
+
121
+ Use ``pip``::
122
+
123
+ pip install miepython
124
+
125
+ or ``conda``::
126
+
127
+ conda install -c conda-forge miepython
128
+
129
+ An example
130
+ ----------
131
+
132
+ The following code::
133
+
134
+ import miepython as mie
135
+
136
+ m = 1.5 - 1j # refractive index of sphere
137
+ d = 100 # nm diameter of sphere
138
+ lambda0 = 314.15 # nm wavelength in vacuum
139
+
140
+ qext, qsca, qback, g = mie.efficiencies(m, d, lambda0)
141
+
142
+ print("The extinction efficiency is %.3f" % qext)
143
+ print("The scattering efficiency is %.3f" % qsca)
144
+ print("The backscatter efficiency is %.3f" % qback)
145
+ print("The scattering anisotropy is %.3f" % g)
146
+
147
+ should produce::
148
+
149
+ The extinction efficiency is 2.336
150
+ The scattering efficiency is 0.663
151
+ The backscatter efficiency is 0.573
152
+ The scattering anisotropy is 0.192
153
+
154
+ There are a few short python scripts in the github repository.
155
+
156
+ * `Extinction Efficiency of Absorbing and Non-Absorbing Spheres <https://github.com/scottprahl/miepython/blob/master/miepython/examples/01_dielectric.py>`_
157
+
158
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/01.svg
159
+ :alt: Absorbing and non-absorbing spheres
160
+
161
+ * `Four Micron Glass Spheres <https://github.com/scottprahl/miepython/blob/master/miepython/examples/02_glass.py>`_
162
+
163
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/02.svg
164
+ :alt: Glass spheres with resonance spike
165
+
166
+ * `One Micron Water Droplets <https://github.com/scottprahl/miepython/blob/master/miepython/examples/03_droplets.py>`_
167
+
168
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/03.svg
169
+ :alt: Water Droplets
170
+
171
+ * `Gold Nanospheres <https://github.com/scottprahl/miepython/blob/master/miepython/examples/04_gold.py>`_
172
+
173
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/04.svg
174
+ :alt: Gold nanospheres
175
+
176
+ License
177
+ -------
178
+
179
+ ``miepython`` is licensed under the terms of the MIT license.
@@ -0,0 +1,149 @@
1
+ .. |pypi| image:: https://img.shields.io/pypi/v/miepython?color=68CA66
2
+ :target: https://pypi.org/project/miepython/
3
+ :alt: pypi
4
+
5
+ .. |github| image:: https://img.shields.io/github/v/tag/scottprahl/miepython?label=github&color=68CA66
6
+ :target: https://github.com/scottprahl/miepython
7
+ :alt: github
8
+
9
+ .. |conda| image:: https://img.shields.io/conda/vn/conda-forge/miepython?label=conda&color=68CA66
10
+ :target: https://github.com/conda-forge/miepython-feedstock
11
+ :alt: conda
12
+
13
+ .. |doi| image:: https://zenodo.org/badge/99259684.svg
14
+ :target: https://zenodo.org/badge/latestdoi/99259684
15
+ :alt: doi
16
+
17
+ .. |license| image:: https://img.shields.io/github/license/scottprahl/miepython?color=68CA66
18
+ :target: https://github.com/scottprahl/miepython/blob/master/LICENSE.txt
19
+ :alt: License
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
23
+ :alt: Testing
24
+
25
+ .. |docs| image:: https://readthedocs.org/projects/miepython/badge?color=68CA66
26
+ :target: https://miepython.readthedocs.io
27
+ :alt: Docs
28
+
29
+ .. |downloads| image:: https://img.shields.io/pypi/dm/miepython?color=68CA66
30
+ :target: https://pypi.org/project/miepython/
31
+ :alt: Downloads
32
+
33
+ .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
34
+ :target: https://github.com/psf/black
35
+ :alt: code style: black
36
+
37
+ miepython
38
+ =========
39
+
40
+ by Scott Prahl
41
+
42
+ |pypi| |github| |conda| |doi|
43
+
44
+ |license| |test| |docs| |downloads| |black|
45
+
46
+ ________
47
+
48
+ ``miepython`` is a pure Python module to calculate light scattering for
49
+ non-absorbing, partially-absorbing, or perfectly-conducting spheres.
50
+
51
+ This code provides functions for calculating the extinction efficiency,
52
+ scattering efficiency, backscattering, and scattering asymmetry. Moreover, a set
53
+ of angles can be given to calculate the scattering for a sphere at each of those
54
+ angles.
55
+
56
+ Mie computations are done following `the procedure described by Wiscombe
57
+ <http://opensky.ucar.edu/islandora/object/technotes:232>`_. This code has
58
+ been validated against his results.
59
+
60
+ Full documentation at <https://miepython.readthedocs.io>
61
+
62
+ Version 3 changes
63
+ -----------------
64
+
65
+ This version contains major changes to the code base and **has API breaking changes**.
66
+ If you don't need the new functionality for fields, then you can continue to use the
67
+ last version with the old API: 2.5.5
68
+
69
+ Version 3.0 has many changes, but the major ones are:
70
+
71
+ * a complete overhaul of API
72
+ * added support to calculate Mie coefficients for fields inside sphere
73
+ * future work will implement calculating electric and magnetic fields
74
+
75
+ Pay Attention!
76
+ --------------
77
+
78
+ When comparing different Mie scattering codes, make sure that you're aware of the conventions used by each code. ``miepython`` makes the following assumptions:
79
+
80
+ #. The imaginary part of the complex index of refraction for absorbing spheres is *negative*.
81
+ Currently if you pass refractive indicies with a positive imaginary value, the refractive
82
+ index is silently converted to a negative value before calculation.
83
+
84
+ #. The scattering phase function is normalized so it equals the *single scattering albedo* when
85
+ integrated over 4π steradians. The default normalization can now be changed.
86
+
87
+
88
+ Installation
89
+ ---------------
90
+
91
+ Use ``pip``::
92
+
93
+ pip install miepython
94
+
95
+ or ``conda``::
96
+
97
+ conda install -c conda-forge miepython
98
+
99
+ An example
100
+ ----------
101
+
102
+ The following code::
103
+
104
+ import miepython as mie
105
+
106
+ m = 1.5 - 1j # refractive index of sphere
107
+ d = 100 # nm diameter of sphere
108
+ lambda0 = 314.15 # nm wavelength in vacuum
109
+
110
+ qext, qsca, qback, g = mie.efficiencies(m, d, lambda0)
111
+
112
+ print("The extinction efficiency is %.3f" % qext)
113
+ print("The scattering efficiency is %.3f" % qsca)
114
+ print("The backscatter efficiency is %.3f" % qback)
115
+ print("The scattering anisotropy is %.3f" % g)
116
+
117
+ should produce::
118
+
119
+ The extinction efficiency is 2.336
120
+ The scattering efficiency is 0.663
121
+ The backscatter efficiency is 0.573
122
+ The scattering anisotropy is 0.192
123
+
124
+ There are a few short python scripts in the github repository.
125
+
126
+ * `Extinction Efficiency of Absorbing and Non-Absorbing Spheres <https://github.com/scottprahl/miepython/blob/master/miepython/examples/01_dielectric.py>`_
127
+
128
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/01.svg
129
+ :alt: Absorbing and non-absorbing spheres
130
+
131
+ * `Four Micron Glass Spheres <https://github.com/scottprahl/miepython/blob/master/miepython/examples/02_glass.py>`_
132
+
133
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/02.svg
134
+ :alt: Glass spheres with resonance spike
135
+
136
+ * `One Micron Water Droplets <https://github.com/scottprahl/miepython/blob/master/miepython/examples/03_droplets.py>`_
137
+
138
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/03.svg
139
+ :alt: Water Droplets
140
+
141
+ * `Gold Nanospheres <https://github.com/scottprahl/miepython/blob/master/miepython/examples/04_gold.py>`_
142
+
143
+ .. image:: https://raw.githubusercontent.com/scottprahl/miepython/main/docs/04.svg
144
+ :alt: Gold nanospheres
145
+
146
+ License
147
+ -------
148
+
149
+ ``miepython`` is licensed under the terms of the MIT license.
@@ -0,0 +1,85 @@
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
+ """
46
+
47
+ import os
48
+
49
+ USE_JIT = os.environ.get("MIEPYTHON_USE_JIT", "1").lower() == "1"
50
+
51
+ if USE_JIT:
52
+ from .mie_jit import _an_bn, _cn_dn, _S1_S2, _D_calc, _pi_tau
53
+
54
+ else:
55
+ from .mie_nojit import _an_bn, _cn_dn, _S1_S2, _D_calc, _pi_tau
56
+
57
+ from .core import efficiencies, intensities, i_par, i_per, i_unpolarized
58
+ from .core import efficiencies_mx, S1_S2, phase_matrix, coefficients, an_bn, cn_dn
59
+
60
+ # The only functions exposed to the user
61
+ __all__ = (
62
+ "intensities",
63
+ "i_par",
64
+ "i_per",
65
+ "i_unpolarized",
66
+ "phase_matrix",
67
+ "coefficients",
68
+ "efficiencies",
69
+ "efficiencies_mx",
70
+ "an_bn",
71
+ "cn_dn",
72
+ "S1_S2",
73
+ "_an_bn",
74
+ "_cn_dn",
75
+ "_S1_S2",
76
+ "_D_calc",
77
+ "_pi_tau",
78
+ )
79
+
80
+ __version__ = "3.0.0"
81
+ __author__ = "Scott Prahl"
82
+ __email__ = "scott.prahl@oit.edu"
83
+ __copyright__ = "2017-25, Scott Prahl"
84
+ __license__ = "MIT"
85
+ __url__ = "https://github.com/scottprahl/miepython.git"
@@ -0,0 +1,126 @@
1
+ """
2
+ Module for Bessel and Riccati-Bessel functions.
3
+
4
+ This module provides a collection of functions related to spherical Bessel functions,
5
+ Hankel functions, Riccati-Bessel functions, and their derivatives. This supplements
6
+ those provided by `scipy.special`
7
+
8
+ Functions provided:
9
+
10
+ - Spherical Bessel functions:
11
+
12
+ - `spherical_h1`: Spherical Hankel function of the first kind h_n^{(1)}(z).
13
+ - `spherical_h2`: Spherical Hankel function of the second kind h_n^{(2)}(z).
14
+
15
+ - Derivatives of Bessel functions:
16
+
17
+ - `d_spherical_jn`: Derivative of the spherical Bessel function j_n'(z).
18
+ - `d_spherical_h1`: Derivative of the spherical Hankel function of first kind h_n^{(1)}'(z).
19
+ - `d_spherical_h2`: Derivative of the spherical Hankel function of second kind h_n^{(2)}'(z).
20
+
21
+ - Riccati-Bessel functions:
22
+
23
+ - `riccati_bessel_jn`: Riccati-Bessel function of the first kind ψ_n(z).
24
+ - `riccati_bessel_h1`: Riccati-Bessel function of the second kind ξ_n(z).
25
+ - `riccati_bessel_h2`: Riccati-Bessel function of the third kind ζ_n(z).
26
+
27
+
28
+ - Derivatives of Riccati-Bessel functions:
29
+
30
+ - `d_riccati_bessel_jn`: Derivative of the Riccati-Bessel function of the first kind ψ_n'(z).
31
+ - `d_riccati_bessel_h1`: Derivative of the Riccati-Bessel function of the second kind ξ_n'(z).
32
+ - `d_riccati_bessel_h2`: Derivative of the Riccati-Bessel function of the third kind ζ_n'(z).
33
+ """
34
+
35
+ __all__ = (
36
+ "spherical_h1",
37
+ "spherical_h2",
38
+ "riccati_bessel_jn",
39
+ "riccati_bessel_h1",
40
+ "riccati_bessel_h2",
41
+ "d_spherical_jn",
42
+ "d_spherical_h1",
43
+ "d_spherical_h2",
44
+ "d_riccati_bessel_jn",
45
+ "d_riccati_bessel_h1",
46
+ "d_riccati_bessel_h2",
47
+ )
48
+
49
+ from scipy.special import spherical_jn, spherical_yn
50
+
51
+
52
+ def spherical_h1(n, z):
53
+ """
54
+ Spherical Hankel function of the first kind.
55
+ """
56
+ return spherical_jn(n, z) + 1j * spherical_yn(n, z)
57
+
58
+
59
+ def spherical_h2(n, z):
60
+ """
61
+ Spherical Hankel function of the second kind.
62
+ """
63
+ return spherical_jn(n, z) - 1j * spherical_yn(n, z)
64
+
65
+
66
+ def riccati_bessel_jn(n, z):
67
+ """
68
+ Riccati-Bessel function of the first kind ψ_n(z).
69
+ """
70
+ return z * spherical_jn(n, z)
71
+
72
+
73
+ def riccati_bessel_h1(n, z):
74
+ """
75
+ Riccati-Bessel function of the second kind ξ_n(z).
76
+ """
77
+ return z * spherical_h1(n, z)
78
+
79
+
80
+ def riccati_bessel_h2(n, z):
81
+ """
82
+ Riccati-Bessel function of the third kind ζ_n(z).
83
+ """
84
+ return z * spherical_h2(n, z)
85
+
86
+
87
+ def d_spherical_jn(n, z):
88
+ """
89
+ Derivative of the spherical Bessel function of the first kind.
90
+ """
91
+ return n * spherical_jn(n, z) / z - spherical_jn(n + 1, z)
92
+
93
+
94
+ def d_spherical_h1(n, z):
95
+ """
96
+ Derivative of the spherical Hankel function of the first kind h_n^{(1)}'(z).
97
+ """
98
+ return 0.5 * (spherical_h1(n - 1, z) - spherical_h1(n, z) / z - spherical_h1(n + 1, z))
99
+
100
+
101
+ def d_spherical_h2(n, z):
102
+ """
103
+ Derivative of the spherical Hankel function of the second kind h_n^{(2)}'(z).
104
+ """
105
+ return 0.5 * (spherical_h2(n - 1, z) - spherical_h2(n, z) / z - spherical_h2(n + 1, z))
106
+
107
+
108
+ def d_riccati_bessel_jn(n, z):
109
+ """
110
+ Derivative of the Riccati-Bessel function of the first kind ψ_n'(z).
111
+ """
112
+ return (n + 1) * spherical_jn(n, z) - z * spherical_jn(n + 1, z)
113
+
114
+
115
+ def d_riccati_bessel_h1(n, z):
116
+ """
117
+ Derivative of the Riccati-Bessel function of the second kind ξ_n'(z).
118
+ """
119
+ return 0.5 * (z * spherical_h1(n - 1, z) + spherical_h1(n, z) - z * spherical_h1(n + 1, z))
120
+
121
+
122
+ def d_riccati_bessel_h2(n, z):
123
+ """
124
+ Derivative of the Riccati-Bessel function of the third kind ζ_n'(z).
125
+ """
126
+ return 0.5 * (z * spherical_h2(n - 1, z) + spherical_h2(n, z) - z * spherical_h2(n + 1, z))