miepython 3.3.1__tar.gz → 3.4.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.
- {miepython-3.3.1 → miepython-3.4.0}/CHANGELOG.rst +120 -47
- {miepython-3.3.1 → miepython-3.4.0}/CITATION.cff +7 -7
- {miepython-3.3.1 → miepython-3.4.0}/PKG-INFO +5 -6
- {miepython-3.3.1 → miepython-3.4.0}/README.rst +2 -2
- {miepython-3.3.1 → miepython-3.4.0}/miepython/__init__.py +24 -4
- miepython-3.4.0/miepython/_convention.py +109 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/core.py +55 -12
- {miepython-3.3.1 → miepython-3.4.0}/miepython/field.py +70 -31
- {miepython-3.3.1 → miepython-3.4.0}/miepython/mie_jit.py +31 -19
- {miepython-3.3.1 → miepython-3.4.0}/miepython/mie_nojit.py +29 -20
- {miepython-3.3.1 → miepython-3.4.0}/miepython/rayleigh.py +18 -7
- {miepython-3.3.1 → miepython-3.4.0}/miepython/vsh.py +21 -6
- {miepython-3.3.1 → miepython-3.4.0}/miepython.egg-info/PKG-INFO +5 -6
- {miepython-3.3.1 → miepython-3.4.0}/miepython.egg-info/SOURCES.txt +2 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython.egg-info/requires.txt +2 -3
- {miepython-3.3.1 → miepython-3.4.0}/pyproject.toml +4 -6
- {miepython-3.3.1 → miepython-3.4.0}/tests/conftest.py +21 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_abcd.py +3 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_field.py +101 -2
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_kernels.py +4 -7
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_mie.py +55 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_rayleigh.py +22 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_scattnlay_reference.py +51 -0
- miepython-3.4.0/tests/test_time_convention.py +280 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_vsh.py +3 -0
- {miepython-3.3.1 → miepython-3.4.0}/LICENSE.txt +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/MANIFEST.in +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/_backend.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/bessel.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/data/Johnson.txt +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/data/segelstein81_index.txt +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/monte_carlo.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython/util.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython.egg-info/dependency_links.txt +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/miepython.egg-info/top_level.txt +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/setup.cfg +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/benchmark_efficiencies.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/reference.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_D.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_all_examples.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_all_notebooks.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_backend_parity.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_bessel.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_docstrings.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_file_encodings.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_makefile.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_monte_carlo.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_optional_scipy.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_package_surface.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_unpolarized_intensity.py +0 -0
- {miepython-3.3.1 → miepython-3.4.0}/tests/test_util.py +0 -0
|
@@ -1,8 +1,81 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
3.4.0 (11/26/2026)
|
|
5
|
+
------------------
|
|
6
|
+
* ``e_far`` now broadcasts ``r``, ``theta`` and ``phi`` as its docstring
|
|
7
|
+
promised, returning shape ``(3, ...)``. An array ``r`` or ``phi`` with a
|
|
8
|
+
scalar ``theta``, or a 2-D ``theta``, used to raise; all-scalar input now
|
|
9
|
+
returns shape ``(3,)`` like ``e_near`` instead of ``(3, 1)``
|
|
10
|
+
* ``m = 0`` is now an exact perfect conductor in ``efficiencies_mx``, as it
|
|
11
|
+
already was in ``coefficients``, the field functions, ``rayleigh`` and for
|
|
12
|
+
x < 0.1. It used to be replaced by ``1 - 10000j`` for x >= 0.1
|
|
13
|
+
* ``efficiencies_mx`` raises ``ValueError`` for an ``n_pole`` beyond
|
|
14
|
+
``wiscombe_terms(x)``, as ``S1_S2`` does, instead of returning ~0
|
|
15
|
+
* ``single_sphere`` and ``core.normalization_factor`` conjugate an index with
|
|
16
|
+
a positive imaginary part themselves; the small-sphere branch used to give
|
|
17
|
+
a negative qext for one
|
|
18
|
+
* ``cn_dn`` defaults ``n_pole`` to 0 like ``an_bn``, on both backends
|
|
19
|
+
* ``norm='qsca'`` no longer returns NaN for a zero-size sphere
|
|
20
|
+
* ``rayleigh.efficiencies_mx`` accepts a list of ``x`` and raises the same
|
|
21
|
+
error as ``efficiencies_mx`` for mismatched lengths
|
|
22
|
+
* clarify that ``coefficients`` returns orders 1 through ``n_pole``
|
|
23
|
+
* treat zero-dimensional NumPy arrays for ``m`` and ``x`` as scalar inputs
|
|
24
|
+
throughout the public Mie API, including the JIT backend
|
|
25
|
+
* return length-one arrays from the Rayleigh angular functions when ``mu`` is
|
|
26
|
+
scalar, matching the full Mie API; correct the ``vsh.M_odd`` usage example
|
|
27
|
+
* normalize the sign of an absorbing sphere's index before evaluating its
|
|
28
|
+
interior near fields. Previously, a positive imaginary input produced the
|
|
29
|
+
same scattering coefficients as its conjugate but different interior E and H
|
|
30
|
+
fields, breaking boundary continuity. Both input signs now give the same
|
|
31
|
+
fields in either time convention
|
|
32
|
+
* make ``docs/13_resonance.ipynb`` construct silver indices as m = n - ik while
|
|
33
|
+
plotting the positive absorption magnitude k, and clarify that
|
|
34
|
+
``m_im`` in ``docs/01_basics.ipynb`` is positive while Im(m) is negative
|
|
35
|
+
* **behaviour change:** one time convention for every complex result, chosen by
|
|
36
|
+
the new ``set_time_convention``, ``get_time_convention`` and the context
|
|
37
|
+
manager ``time_convention``. The default is exp(+jωt), which goes with
|
|
38
|
+
m = n - ik and with Wiscombe's MIEV0; ``"-"`` gives exp(-iωt), the convention
|
|
39
|
+
of Bohren & Huffman, Jackson and scattnlay. The two differ only by complex
|
|
40
|
+
conjugation, and efficiencies, g and intensities are the same in both.
|
|
41
|
+
Before, the package mixed them: ``S1_S2`` and ``phase_matrix`` were exp(+jωt)
|
|
42
|
+
while ``coefficients`` and every field function were exp(-iωt), which is
|
|
43
|
+
what let the ``e_far`` error below go unnoticed. Under the default,
|
|
44
|
+
|
|
45
|
+
- ``S1_S2``, ``rayleigh.S1_S2`` and ``phase_matrix`` are unchanged;
|
|
46
|
+
- ``coefficients`` returns the conjugates of its previous values;
|
|
47
|
+
- ``e_near``, ``h_near``, ``eh_near``, their Cartesian forms and ``e_far``
|
|
48
|
+
return the conjugates of their previous fields, and a caller's ``abcd``
|
|
49
|
+
must come from ``coefficients`` under the same convention;
|
|
50
|
+
- the ``miepython.vsh`` harmonics use h_n^(2) outside the sphere, and take
|
|
51
|
+
``m_index`` in the form that matches the active convention.
|
|
52
|
+
|
|
53
|
+
Inside ``time_convention("-")`` the coefficients, fields and harmonics match
|
|
54
|
+
3.3.1, while ``S1_S2`` returns Bohren & Huffman's amplitudes and
|
|
55
|
+
``phase_matrix`` puts S34 where their eq. 3.16 does. The raw kernels
|
|
56
|
+
(``an_bn``, ``cn_dn``, ``_S1_S2``) ignore the setting and always return
|
|
57
|
+
exp(-iωt); ``_S1_S2`` no longer conjugates its sum a second time
|
|
58
|
+
* compare the scattnlay reference fields component by component, phase included,
|
|
59
|
+
rather than only as magnitudes, which could not see a conjugated field
|
|
60
|
+
* stop flipping the sign of S34 by hand in ``docs/07_algorithm.ipynb``: Bohren's
|
|
61
|
+
sample calculation now runs inside ``time_convention("-")`` and matches his
|
|
62
|
+
table directly. ``docs/01_basics.ipynb`` explains both conventions, and
|
|
63
|
+
``docs/14_boundary_conditions.ipynb`` uses eps = n**2 for exp(+jωt)
|
|
64
|
+
* fix the phase of ``e_far`` (#36, thanks @rcgiri-physics and @antonsoo). It
|
|
65
|
+
conjugated the whole field, outgoing ``exp(ikr)`` included, so the radial phase
|
|
66
|
+
ran backwards for the exp(-iωt) convention, and ``E_phi`` had the wrong sign
|
|
67
|
+
relative to ``E_theta``. Only S1 and S2 are conjugated now, and ``E_phi``
|
|
68
|
+
carries the ``-S1 sin(phi)`` of Bohren & Huffman eq. 4.74. ``e_far`` now
|
|
69
|
+
agrees with ``e_near(..., include_incident=False)`` to O(1/kr) in every complex
|
|
70
|
+
component; before, it was off by O(1). The old test compared magnitudes at
|
|
71
|
+
theta = phi = 45 degrees, which could see neither error. Magnitudes, and so
|
|
72
|
+
intensities, are unchanged
|
|
73
|
+
* add PEP 723 inline metadata to ``docs/data/generate_scattnlay_reference_fields.py``
|
|
74
|
+
so ``uv run`` builds scattnlay 2.4 for it on demand. scattnlay stays out of
|
|
75
|
+
the project extras, because nothing else needs it
|
|
76
|
+
|
|
4
77
|
3.3.1 (10/28/2026)
|
|
5
|
-
|
|
78
|
+
------------------
|
|
6
79
|
* fix ``rayleigh.efficiencies_mx`` subtracting scattering from extinction. With
|
|
7
80
|
the m = n - ik convention the absorption term is negative, so
|
|
8
81
|
``abs(absorption + qsca)`` gave absorption minus scattering, and qext for
|
|
@@ -80,7 +153,7 @@ Changelog
|
|
|
80
153
|
file something reads
|
|
81
154
|
|
|
82
155
|
3.3.0 (07/28/2026)
|
|
83
|
-
|
|
156
|
+
------------------
|
|
84
157
|
* fix the docstring examples in ``core.py``, which had rotted unnoticed. The
|
|
85
158
|
``coefficients`` examples called ``mie_coefficients``, a name that never
|
|
86
159
|
existed, showed the imaginary parts with the wrong sign, and still included the
|
|
@@ -412,12 +485,12 @@ Changelog
|
|
|
412
485
|
address the highest order, which the old bounds check rejected
|
|
413
486
|
|
|
414
487
|
3.2.0 (03/06/2026)
|
|
415
|
-
|
|
488
|
+
------------------
|
|
416
489
|
* fix error in E & H calculations in the near field when y≠0 (thanks @dorianherle)
|
|
417
490
|
* add regression test
|
|
418
491
|
|
|
419
492
|
3.1.0 (02/07/2026)
|
|
420
|
-
|
|
493
|
+
------------------
|
|
421
494
|
* add near-field E and H field APIs, fix boundary continuity/medium handling, and expand validation tests
|
|
422
495
|
* add field calculation utilities, field module cleanup/help text improvements, and precomputed E/H reference data (via scattnlay)
|
|
423
496
|
* improve performance: ~20% speedups in Mie backends and faster near-field calculations; add speed benchmarks
|
|
@@ -427,12 +500,12 @@ Changelog
|
|
|
427
500
|
* packaging/CI: pyproject and requirements cleanup, improved PyPI workflow, updated citation automation/config
|
|
428
501
|
* misc cleanups: remove unused files/images, minor typos, Makefile and docs config tidy-ups, CITATION.cff refresh
|
|
429
502
|
|
|
430
|
-
3.0.5 (
|
|
431
|
-
|
|
503
|
+
3.0.5 (01/02/2026)
|
|
504
|
+
------------------
|
|
432
505
|
* fix versioning
|
|
433
506
|
|
|
434
|
-
3.0.4 (
|
|
435
|
-
|
|
507
|
+
3.0.4 (01/02/2026)
|
|
508
|
+
------------------
|
|
436
509
|
* Host jupyterlite instance of github
|
|
437
510
|
* improve citation guidelines
|
|
438
511
|
* add test for unpolarized intensity methods
|
|
@@ -442,15 +515,15 @@ Changelog
|
|
|
442
515
|
* improve readme
|
|
443
516
|
|
|
444
517
|
3.0.3
|
|
445
|
-
|
|
518
|
+
-----
|
|
446
519
|
* skipped
|
|
447
520
|
|
|
448
|
-
3.0.2 (
|
|
449
|
-
|
|
521
|
+
3.0.2 (05/25/2025)
|
|
522
|
+
------------------
|
|
450
523
|
* fix version number
|
|
451
524
|
|
|
452
|
-
3.0.1 (
|
|
453
|
-
|
|
525
|
+
3.0.1 (05/25/2025)
|
|
526
|
+
------------------
|
|
454
527
|
* fix JIT regression (thanks @avgeiss)
|
|
455
528
|
* clarify polarization in docstrings
|
|
456
529
|
* improve README.rst
|
|
@@ -461,8 +534,8 @@ Changelog
|
|
|
461
534
|
* rationalize importing of jit and non-jit code
|
|
462
535
|
* add test_jit_speed.py and test_nojit_speed.py
|
|
463
536
|
|
|
464
|
-
3.0.0 (
|
|
465
|
-
|
|
537
|
+
3.0.0 (03/16/2025)
|
|
538
|
+
------------------
|
|
466
539
|
* breaking api changes
|
|
467
540
|
* api is more sane: mie.efficiencies() instead of miepython.ez_mie()
|
|
468
541
|
* use core.py to cleanly separate jit and non-jit code
|
|
@@ -478,35 +551,35 @@ Changelog
|
|
|
478
551
|
* add more tests
|
|
479
552
|
|
|
480
553
|
|
|
481
|
-
2.5.5 (12/01/
|
|
482
|
-
|
|
554
|
+
2.5.5 (12/01/2024)
|
|
555
|
+
------------------
|
|
483
556
|
* add support for specific spherical modes
|
|
484
557
|
* only branch is now 'main'
|
|
485
558
|
|
|
486
559
|
2.5.4 (05/07/2024)
|
|
487
|
-
|
|
560
|
+
------------------
|
|
488
561
|
* add auto-dating in CITATION
|
|
489
562
|
* add python 3.12
|
|
490
563
|
* add ruff, pylint config
|
|
491
564
|
* simplify mie_cdf and fix notebook
|
|
492
565
|
* set 3.7 as earliest python version
|
|
493
566
|
|
|
494
|
-
|
|
495
|
-
|
|
567
|
+
2.5.3 (08/05/2023)
|
|
568
|
+
------------------
|
|
496
569
|
* conda-forge fails because test files are not included
|
|
497
570
|
|
|
498
|
-
|
|
499
|
-
|
|
571
|
+
2.5.1 (08/05/2023)
|
|
572
|
+
------------------
|
|
500
573
|
* change tests to accommodate conda-forge
|
|
501
574
|
* require python>=3.9 to accommodate latest numba
|
|
502
575
|
* get rid of tox
|
|
503
576
|
|
|
504
|
-
|
|
505
|
-
|
|
577
|
+
2.5.0 (08/04/2023)
|
|
578
|
+
------------------
|
|
506
579
|
* fix scattering function for very small spheres
|
|
507
580
|
|
|
508
|
-
|
|
509
|
-
|
|
581
|
+
2.4.0 (06/10/2023)
|
|
582
|
+
------------------
|
|
510
583
|
* add mie_phase_matrix() to calculate scattering (Mueller) matrix
|
|
511
584
|
|
|
512
585
|
v2.3.2
|
|
@@ -527,7 +600,7 @@ v2.3.0
|
|
|
527
600
|
* fix typo in header of gold sphere example script
|
|
528
601
|
* remove workaround for older Sphinx version
|
|
529
602
|
|
|
530
|
-
|
|
603
|
+
2.2.3 (01/26/2022)
|
|
531
604
|
------------------
|
|
532
605
|
* update _mie_An_Bn in miepython_nojit
|
|
533
606
|
* store data in module so github testing passes
|
|
@@ -535,7 +608,7 @@ v2.2.3 (1/26/2022)
|
|
|
535
608
|
* only test back to python 3.9 because importlib.resources
|
|
536
609
|
* 3.9 is only needed for a few of the jupyter notebooks
|
|
537
610
|
|
|
538
|
-
|
|
611
|
+
2.2.2 (01/25/2022)
|
|
539
612
|
------------------
|
|
540
613
|
* modify _mie_An_Bn to allocate and return An and Bn
|
|
541
614
|
* fix minor packaging issue
|
|
@@ -545,14 +618,14 @@ v2.2.2 (1/25/2022)
|
|
|
545
618
|
* add docs/requirements
|
|
546
619
|
* restrict Jinja2 to 2.11.3 in docs/requirements
|
|
547
620
|
|
|
548
|
-
|
|
549
|
-
|
|
621
|
+
2.2.1 (09/05/2021)
|
|
622
|
+
------------------
|
|
550
623
|
* create pure python packages
|
|
551
624
|
* include wheel file
|
|
552
625
|
* package as python3 only
|
|
553
626
|
|
|
554
|
-
2.1.0 (05/22/
|
|
555
|
-
|
|
627
|
+
2.1.0 (05/22/2021)
|
|
628
|
+
------------------
|
|
556
629
|
* fix case when scalar angle used with mie_S1_S2()
|
|
557
630
|
* add pypi badge
|
|
558
631
|
* fix notebook testing
|
|
@@ -564,28 +637,28 @@ v2.2.1 (9/5/2021)
|
|
|
564
637
|
* fix examples that use refractiveindex.info
|
|
565
638
|
* add testing badge
|
|
566
639
|
|
|
567
|
-
2.0.1 (04/25/
|
|
568
|
-
|
|
640
|
+
2.0.1 (04/25/2021)
|
|
641
|
+
------------------
|
|
569
642
|
* fix packaging mistake
|
|
570
643
|
|
|
571
|
-
2.0.0 (04/25/
|
|
572
|
-
|
|
644
|
+
2.0.0 (04/25/2021)
|
|
645
|
+
------------------
|
|
573
646
|
* use numba for 10-700X speed improvement
|
|
574
647
|
* thanks to @jbecca and @pscicluna for their help
|
|
575
648
|
* add performance notebook
|
|
576
649
|
* add automated notebook checking
|
|
577
650
|
* test more code
|
|
578
651
|
|
|
579
|
-
1.3.3 (03/21/
|
|
580
|
-
|
|
652
|
+
1.3.3 (03/21/2021)
|
|
653
|
+
------------------
|
|
581
654
|
* colab badge and link
|
|
582
655
|
* change theme for sphinx documentation
|
|
583
656
|
* add requirements.txt to avoid installing sphinx
|
|
584
657
|
* fix restructured text errors
|
|
585
658
|
* advise everywhere to `pip install --user miepython` to avoid permission problems
|
|
586
659
|
|
|
587
|
-
1.3.2 (01/13/
|
|
588
|
-
|
|
660
|
+
1.3.2 (01/13/2021)
|
|
661
|
+
------------------
|
|
589
662
|
* add ez_mie(m, d, lambda0)
|
|
590
663
|
* add ez_intensities(m, d, lambda0, mu)
|
|
591
664
|
* fix formatting
|
|
@@ -593,22 +666,22 @@ v2.2.1 (9/5/2021)
|
|
|
593
666
|
* specify newer pythons
|
|
594
667
|
* better install instructions
|
|
595
668
|
|
|
596
|
-
1.3.1 (03/30/
|
|
597
|
-
|
|
669
|
+
1.3.1 (03/30/2020)
|
|
670
|
+
------------------
|
|
598
671
|
* improve docstrings
|
|
599
672
|
* use Sphinx documentation
|
|
600
673
|
* host docs on readthedocs.io
|
|
601
674
|
* use tox
|
|
602
675
|
|
|
603
|
-
1.3.0 (02/19/
|
|
604
|
-
|
|
676
|
+
1.3.0 (02/19/2019)
|
|
677
|
+
------------------
|
|
605
678
|
* fix calculations for small spheres (x<0.05)
|
|
606
679
|
* added notebook doc/09_backscattering.ipynb
|
|
607
680
|
* general tweaks to documentation throughout
|
|
608
681
|
* improved README.md
|
|
609
682
|
|
|
610
|
-
1.2.0
|
|
611
|
-
|
|
683
|
+
1.2.0 (02/08/2019)
|
|
684
|
+
------------------
|
|
612
685
|
* fix bug so that large sphere calculations work correctly
|
|
613
686
|
* add tests for large spheres
|
|
614
687
|
* add tests for backscattering efficiency
|
|
@@ -617,7 +690,7 @@ v2.2.1 (9/5/2021)
|
|
|
617
690
|
* finish fixing fractions in notebooks
|
|
618
691
|
* improve README.md
|
|
619
692
|
|
|
620
|
-
1.1.1
|
|
693
|
+
1.1.1 (06/25/2018)
|
|
621
694
|
------------------
|
|
622
695
|
* fix github rendering of fractions in equations
|
|
623
696
|
* add developer instructions
|
|
@@ -2,10 +2,10 @@ 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.3.
|
|
6
|
-
doi: 10.5281/zenodo.
|
|
7
|
-
date-released: '2026-
|
|
8
|
-
url: https://doi.org/10.5281/zenodo.
|
|
5
|
+
version: 3.3.1
|
|
6
|
+
doi: 10.5281/zenodo.7949263
|
|
7
|
+
date-released: '2026-10-28'
|
|
8
|
+
url: https://doi.org/10.5281/zenodo.7949263
|
|
9
9
|
repository-code: https://github.com/scottprahl/miepython
|
|
10
10
|
license: MIT
|
|
11
11
|
authors:
|
|
@@ -33,9 +33,9 @@ preferred-citation:
|
|
|
33
33
|
type: software
|
|
34
34
|
title: 'miepython: Pure python calculation of Mie scattering'
|
|
35
35
|
year: 2026
|
|
36
|
-
version: 3.3.
|
|
37
|
-
doi: 10.5281/zenodo.
|
|
38
|
-
url: https://doi.org/10.5281/zenodo.
|
|
36
|
+
version: 3.3.1
|
|
37
|
+
doi: 10.5281/zenodo.7949263
|
|
38
|
+
url: https://doi.org/10.5281/zenodo.7949263
|
|
39
39
|
authors:
|
|
40
40
|
- family-names: Prahl
|
|
41
41
|
given-names: Scott
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: miepython
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.4.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
|
|
@@ -23,7 +23,6 @@ Requires-Python: >=3.11
|
|
|
23
23
|
Description-Content-Type: text/x-rst
|
|
24
24
|
License-File: LICENSE.txt
|
|
25
25
|
Requires-Dist: numpy
|
|
26
|
-
Requires-Dist: matplotlib
|
|
27
26
|
Requires-Dist: scipy
|
|
28
27
|
Requires-Dist: numba; sys_platform != "emscripten"
|
|
29
28
|
Provides-Extra: docs
|
|
@@ -35,8 +34,8 @@ Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
|
35
34
|
Provides-Extra: dev
|
|
36
35
|
Requires-Dist: pytest; extra == "dev"
|
|
37
36
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
38
|
-
Requires-Dist: imageio; extra == "dev"
|
|
39
37
|
Requires-Dist: requests; extra == "dev"
|
|
38
|
+
Requires-Dist: matplotlib; extra == "dev"
|
|
40
39
|
Requires-Dist: ruff; extra == "dev"
|
|
41
40
|
Requires-Dist: yamllint; extra == "dev"
|
|
42
41
|
Requires-Dist: rstcheck[sphinx,toml]; extra == "dev"
|
|
@@ -45,13 +44,13 @@ Requires-Dist: pyroma; extra == "dev"
|
|
|
45
44
|
Requires-Dist: black[jupyter]; extra == "dev"
|
|
46
45
|
Requires-Dist: build; extra == "dev"
|
|
47
46
|
Requires-Dist: check-manifest; extra == "dev"
|
|
48
|
-
Requires-Dist: libarchive-c; extra == "dev"
|
|
49
47
|
Requires-Dist: pyyaml; extra == "dev"
|
|
50
48
|
Requires-Dist: jupyterlab; extra == "dev"
|
|
51
49
|
Requires-Dist: nbconvert; extra == "dev"
|
|
52
50
|
Requires-Dist: nbformat; extra == "dev"
|
|
53
51
|
Provides-Extra: lite
|
|
54
52
|
Requires-Dist: jupyterlite-core<0.8,>=0.7; extra == "lite"
|
|
53
|
+
Requires-Dist: libarchive-c; extra == "lite"
|
|
55
54
|
Requires-Dist: jupyterlite-pyodide-kernel<0.8,>=0.7; extra == "lite"
|
|
56
55
|
Dynamic: license-file
|
|
57
56
|
|
|
@@ -210,7 +209,7 @@ Citation
|
|
|
210
209
|
|
|
211
210
|
If you use ``miepython`` in academic, instructional, or applied technical work, please cite:
|
|
212
211
|
|
|
213
|
-
Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.3.
|
|
212
|
+
Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.3.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
|
|
214
213
|
|
|
215
214
|
BibTeX:
|
|
216
215
|
|
|
@@ -222,7 +221,7 @@ BibTeX:
|
|
|
222
221
|
url = {https://github.com/scottprahl/miepython},
|
|
223
222
|
doi = {10.5281/zenodo.7949263},
|
|
224
223
|
year = {2026},
|
|
225
|
-
version = {3.3.
|
|
224
|
+
version = {3.3.1},
|
|
226
225
|
publisher = {Zenodo}
|
|
227
226
|
}
|
|
228
227
|
|
|
@@ -153,7 +153,7 @@ Citation
|
|
|
153
153
|
|
|
154
154
|
If you use ``miepython`` in academic, instructional, or applied technical work, please cite:
|
|
155
155
|
|
|
156
|
-
Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.3.
|
|
156
|
+
Prahl, S. (2026). *miepython: Pure python calculation of Mie scattering* (Version 3.3.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263
|
|
157
157
|
|
|
158
158
|
BibTeX:
|
|
159
159
|
|
|
@@ -165,7 +165,7 @@ BibTeX:
|
|
|
165
165
|
url = {https://github.com/scottprahl/miepython},
|
|
166
166
|
doi = {10.5281/zenodo.7949263},
|
|
167
167
|
year = {2026},
|
|
168
|
-
version = {3.3.
|
|
168
|
+
version = {3.3.1},
|
|
169
169
|
publisher = {Zenodo}
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -22,7 +22,7 @@ If the size parameter is known, then use::
|
|
|
22
22
|
|
|
23
23
|
mie.efficiencies_mx(m, x)
|
|
24
24
|
|
|
25
|
-
Mie scattering amplitudes S1 and S2 (complex numbers)
|
|
25
|
+
Mie scattering amplitudes S1 and S2 (complex numbers)::
|
|
26
26
|
|
|
27
27
|
mie.S1_S2(m, x, mu)
|
|
28
28
|
|
|
@@ -38,10 +38,25 @@ Mie scattering intensities normalized to one when integrated over all angles::
|
|
|
38
38
|
mie.i_par(m, x, mu, norm='one')
|
|
39
39
|
mie.i_unpolarized(m, x, mu, norm='one')
|
|
40
40
|
|
|
41
|
-
The scattering matrix
|
|
41
|
+
The scattering matrix::
|
|
42
42
|
|
|
43
43
|
mie.phase_matrix(m, x, mu)
|
|
44
44
|
|
|
45
|
+
Time convention
|
|
46
|
+
---------------
|
|
47
|
+
|
|
48
|
+
Complex results (coefficients, S1 and S2, fields, the S34 element of the phase
|
|
49
|
+
matrix) depend on whether the time dependence is written exp(+jωt) or exp(-iωt);
|
|
50
|
+
the two are complex conjugates. The default is exp(+jωt), which goes with the
|
|
51
|
+
m = n - ik form of the refractive index and reproduces Wiscombe's MIEV0. Bohren
|
|
52
|
+
& Huffman, Jackson and scattnlay use exp(-iωt)::
|
|
53
|
+
|
|
54
|
+
mie.set_time_convention("-") # for the rest of the session
|
|
55
|
+
with mie.time_convention("-"): # or just for a block
|
|
56
|
+
a, b = mie.coefficients(m, x)
|
|
57
|
+
|
|
58
|
+
Efficiencies, g and intensities are the same either way.
|
|
59
|
+
|
|
45
60
|
Submodules
|
|
46
61
|
----------
|
|
47
62
|
|
|
@@ -56,7 +71,7 @@ the textbook formulas. It is a reference for development and cross-checking rat
|
|
|
56
71
|
than a fast path, it requires the optional ``scipy`` dependency, and so it is bound
|
|
57
72
|
only when scipy is installed::
|
|
58
73
|
|
|
59
|
-
mie.vsh.M_odd(1,
|
|
74
|
+
mie.vsh.M_odd(1, 0.5, 1.0, 1.5, 0.8, 0.7, 0.2)
|
|
60
75
|
|
|
61
76
|
``miepython.monte_carlo`` samples scattering angles from the Mie phase function. It
|
|
62
77
|
imports this package, so importing it from here would be circular; ask for it
|
|
@@ -91,6 +106,8 @@ from ._backend import single_sphere, small_conducting_sphere, small_sphere
|
|
|
91
106
|
from .core import efficiencies, intensities, i_par, i_per, i_unpolarized
|
|
92
107
|
from .core import efficiencies_mx, S1_S2, phase_matrix, coefficients
|
|
93
108
|
|
|
109
|
+
from ._convention import get_time_convention, set_time_convention, time_convention
|
|
110
|
+
|
|
94
111
|
from . import rayleigh
|
|
95
112
|
|
|
96
113
|
_FIELD_IMPORT_ERROR = None
|
|
@@ -148,6 +165,9 @@ else:
|
|
|
148
165
|
# scipy is installed, and a star-import must not depend on that.
|
|
149
166
|
__all__ = (
|
|
150
167
|
"rayleigh",
|
|
168
|
+
"get_time_convention",
|
|
169
|
+
"set_time_convention",
|
|
170
|
+
"time_convention",
|
|
151
171
|
"intensities",
|
|
152
172
|
"i_par",
|
|
153
173
|
"i_per",
|
|
@@ -178,7 +198,7 @@ __all__ = (
|
|
|
178
198
|
"_D_downwards",
|
|
179
199
|
)
|
|
180
200
|
|
|
181
|
-
__version__ = "3.
|
|
201
|
+
__version__ = "3.4.0"
|
|
182
202
|
__author__ = "Scott Prahl"
|
|
183
203
|
__email__ = "scott.prahl@oit.edu"
|
|
184
204
|
__copyright__ = "2017-2026, Scott Prahl"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""Time-harmonic sign convention for the complex values miepython returns.
|
|
2
|
+
|
|
3
|
+
A monochromatic field can be written with time dependence exp(+jωt) or
|
|
4
|
+
exp(-iωt). The two descriptions carry the same physics and, for the
|
|
5
|
+
non-magnetic spheres handled here, every complex result in one is the complex
|
|
6
|
+
conjugate of the same result in the other:
|
|
7
|
+
|
|
8
|
+
``"+"`` (the default), exp(+jωt)
|
|
9
|
+
The convention of van de Hulst, Kerker and Wiscombe's MIEV0, natural for the
|
|
10
|
+
m = n - ik form of the refractive index that miepython has always used.
|
|
11
|
+
Outgoing spherical waves go as h_n^(2)(kr), a plane wave travelling along +z
|
|
12
|
+
as exp(-jkz), and ``S1_S2`` reproduces MIEV0's amplitudes directly.
|
|
13
|
+
|
|
14
|
+
``"-"``, exp(-iωt)
|
|
15
|
+
The convention of Bohren & Huffman, Jackson and scattnlay. Outgoing waves go
|
|
16
|
+
as h_n^(1)(kr), a plane wave along +z as exp(+ikz), and the amplitudes,
|
|
17
|
+
coefficients and phase matrix match Bohren & Huffman's equations and tables.
|
|
18
|
+
|
|
19
|
+
Only complex results depend on the choice: the Mie coefficients, S1 and S2, the
|
|
20
|
+
near and far fields, the vector spherical harmonics, and the S34 element of the
|
|
21
|
+
phase matrix (which changes sign, along with the handedness of the Stokes V).
|
|
22
|
+
Efficiencies, g, intensities and the other phase-matrix elements are identical.
|
|
23
|
+
|
|
24
|
+
The refractive index is accepted with either sign of its imaginary part and is
|
|
25
|
+
always taken to be absorbing, whatever convention is active.
|
|
26
|
+
|
|
27
|
+
The setting is global to the process. Library code that needs a particular
|
|
28
|
+
convention should use the context manager, which restores the caller's choice::
|
|
29
|
+
|
|
30
|
+
with miepython.time_convention("-"):
|
|
31
|
+
a, b = miepython.coefficients(m, x)
|
|
32
|
+
|
|
33
|
+
The raw kernels (``an_bn``, ``cn_dn``, ``_S1_S2``, ...) ignore this setting and
|
|
34
|
+
always work in exp(-iωt); the public functions convert on the way out.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
import contextlib
|
|
38
|
+
|
|
39
|
+
import numpy as np
|
|
40
|
+
|
|
41
|
+
__all__ = ("get_time_convention", "set_time_convention", "time_convention")
|
|
42
|
+
|
|
43
|
+
_VALID = ("+", "-")
|
|
44
|
+
_current = "+"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _validate(sign):
|
|
48
|
+
"""Return ``sign`` if it names a convention, else raise ``ValueError``."""
|
|
49
|
+
if not isinstance(sign, str) or sign not in _VALID:
|
|
50
|
+
raise ValueError(f"time convention must be '+' for exp(+jωt) or '-' for exp(-iωt), not {sign!r}")
|
|
51
|
+
return sign
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def get_time_convention():
|
|
55
|
+
"""Return the active time convention.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
str: ``"+"`` for exp(+jωt) or ``"-"`` for exp(-iωt).
|
|
59
|
+
"""
|
|
60
|
+
return _current
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def set_time_convention(sign):
|
|
64
|
+
"""Choose the time convention for every complex result miepython returns.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
sign (str): ``"+"`` for exp(+jωt), the default, or ``"-"`` for exp(-iωt).
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
str: The convention that was active before the call, so it can be restored.
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
ValueError: if ``sign`` is neither ``"+"`` nor ``"-"``.
|
|
74
|
+
"""
|
|
75
|
+
global _current # pylint: disable=global-statement
|
|
76
|
+
previous = _current
|
|
77
|
+
_current = _validate(sign)
|
|
78
|
+
return previous
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@contextlib.contextmanager
|
|
82
|
+
def time_convention(sign):
|
|
83
|
+
"""Use a time convention inside a ``with`` block, then restore the previous one.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
sign (str): ``"+"`` for exp(+jωt) or ``"-"`` for exp(-iωt).
|
|
87
|
+
|
|
88
|
+
Yields:
|
|
89
|
+
str: The convention in force inside the block.
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
ValueError: if ``sign`` is neither ``"+"`` nor ``"-"``.
|
|
93
|
+
"""
|
|
94
|
+
previous = set_time_convention(sign)
|
|
95
|
+
try:
|
|
96
|
+
yield sign
|
|
97
|
+
finally:
|
|
98
|
+
set_time_convention(previous)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _convert(value):
|
|
102
|
+
"""Convert between exp(-iωt), used internally, and the active convention.
|
|
103
|
+
|
|
104
|
+
Conjugation is its own inverse, so the same call takes an internal value out
|
|
105
|
+
to the user and a user-supplied value (such as ``abcd``) in.
|
|
106
|
+
"""
|
|
107
|
+
if _current == "+":
|
|
108
|
+
return np.conjugate(value)
|
|
109
|
+
return value
|