miepython 2.4.0__tar.gz → 2.5.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 (53) hide show
  1. {miepython-2.4.0 → miepython-2.5.0}/CHANGELOG.rst +4 -0
  2. {miepython-2.4.0/miepython.egg-info → miepython-2.5.0}/PKG-INFO +1 -1
  3. {miepython-2.4.0 → miepython-2.5.0}/miepython/__init__.py +1 -1
  4. {miepython-2.4.0 → miepython-2.5.0}/miepython/miepython.py +9 -12
  5. {miepython-2.4.0 → miepython-2.5.0}/miepython/miepython_nojit.py +11 -16
  6. {miepython-2.4.0 → miepython-2.5.0/miepython.egg-info}/PKG-INFO +1 -1
  7. {miepython-2.4.0 → miepython-2.5.0}/.github/workflows/test.yml +0 -0
  8. {miepython-2.4.0 → miepython-2.5.0}/.gitignore +0 -0
  9. {miepython-2.4.0 → miepython-2.5.0}/.readthedocs.yaml +0 -0
  10. {miepython-2.4.0 → miepython-2.5.0}/.testignore +0 -0
  11. {miepython-2.4.0 → miepython-2.5.0}/CITATION.cff +0 -0
  12. {miepython-2.4.0 → miepython-2.5.0}/LICENSE.txt +0 -0
  13. {miepython-2.4.0 → miepython-2.5.0}/MANIFEST.in +0 -0
  14. {miepython-2.4.0 → miepython-2.5.0}/Makefile +0 -0
  15. {miepython-2.4.0 → miepython-2.5.0}/README.rst +0 -0
  16. {miepython-2.4.0 → miepython-2.5.0}/docs/01_basics.ipynb +0 -0
  17. {miepython-2.4.0 → miepython-2.5.0}/docs/01_plot.png +0 -0
  18. {miepython-2.4.0 → miepython-2.5.0}/docs/02_efficiencies.ipynb +0 -0
  19. {miepython-2.4.0 → miepython-2.5.0}/docs/02_plot.png +0 -0
  20. {miepython-2.4.0 → miepython-2.5.0}/docs/03_angular_scattering.ipynb +0 -0
  21. {miepython-2.4.0 → miepython-2.5.0}/docs/03_plot.png +0 -0
  22. {miepython-2.4.0 → miepython-2.5.0}/docs/03a_normalization.ipynb +0 -0
  23. {miepython-2.4.0 → miepython-2.5.0}/docs/04_plot.png +0 -0
  24. {miepython-2.4.0 → miepython-2.5.0}/docs/04_rayleigh.ipynb +0 -0
  25. {miepython-2.4.0 → miepython-2.5.0}/docs/05_fog.ipynb +0 -0
  26. {miepython-2.4.0 → miepython-2.5.0}/docs/06_random_deviates.ipynb +0 -0
  27. {miepython-2.4.0 → miepython-2.5.0}/docs/07_algorithm.ipynb +0 -0
  28. {miepython-2.4.0 → miepython-2.5.0}/docs/08_large_spheres.ipynb +0 -0
  29. {miepython-2.4.0 → miepython-2.5.0}/docs/09_backscattering.ipynb +0 -0
  30. {miepython-2.4.0 → miepython-2.5.0}/docs/10_basic_tests.ipynb +0 -0
  31. {miepython-2.4.0 → miepython-2.5.0}/docs/11_performance.ipynb +0 -0
  32. {miepython-2.4.0 → miepython-2.5.0}/docs/changelog.rst +0 -0
  33. {miepython-2.4.0 → miepython-2.5.0}/docs/conf.py +0 -0
  34. {miepython-2.4.0 → miepython-2.5.0}/docs/index.rst +0 -0
  35. {miepython-2.4.0 → miepython-2.5.0}/docs/miepython.rst +0 -0
  36. {miepython-2.4.0 → miepython-2.5.0}/docs/requirements.txt +0 -0
  37. {miepython-2.4.0 → miepython-2.5.0}/miepython/data/Johnson.txt +0 -0
  38. {miepython-2.4.0 → miepython-2.5.0}/miepython/data/ag-Johnson.txt +0 -0
  39. {miepython-2.4.0 → miepython-2.5.0}/miepython/data/segelstein81_index.txt +0 -0
  40. {miepython-2.4.0 → miepython-2.5.0}/miepython/examples/01_dielectric.py +0 -0
  41. {miepython-2.4.0 → miepython-2.5.0}/miepython/examples/02_glass.py +0 -0
  42. {miepython-2.4.0 → miepython-2.5.0}/miepython/examples/03_droplets.py +0 -0
  43. {miepython-2.4.0 → miepython-2.5.0}/miepython/examples/04_gold.py +0 -0
  44. {miepython-2.4.0 → miepython-2.5.0}/miepython.egg-info/SOURCES.txt +0 -0
  45. {miepython-2.4.0 → miepython-2.5.0}/miepython.egg-info/dependency_links.txt +0 -0
  46. {miepython-2.4.0 → miepython-2.5.0}/miepython.egg-info/requires.txt +0 -0
  47. {miepython-2.4.0 → miepython-2.5.0}/miepython.egg-info/top_level.txt +0 -0
  48. {miepython-2.4.0 → miepython-2.5.0}/pyproject.toml +0 -0
  49. {miepython-2.4.0 → miepython-2.5.0}/release.txt +0 -0
  50. {miepython-2.4.0 → miepython-2.5.0}/requirements-dev.txt +0 -0
  51. {miepython-2.4.0 → miepython-2.5.0}/requirements.txt +0 -0
  52. {miepython-2.4.0 → miepython-2.5.0}/setup.cfg +0 -0
  53. {miepython-2.4.0 → miepython-2.5.0}/setup.py +0 -0
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v2.5.0 (8/4/2023)
5
+ -------------------
6
+ * fix scattering function for very small spheres
7
+
4
8
  v2.4.0 (6/10/2023)
5
9
  -------------------
6
10
  * add mie_phase_matrix() to calculate scattering (Mueller) matrix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: miepython
3
- Version: 2.4.0
3
+ Version: 2.5.0
4
4
  Summary: Mie scattering of a plane wave by a sphere
5
5
  Home-page: https://github.com/scottprahl/miepython.git
6
6
  Author: Scott Prahl
@@ -42,7 +42,7 @@ The scattering matrix
42
42
  miepython.mie_phase_matrix(m, x, mu)
43
43
 
44
44
  """
45
- __version__ = '2.4.0'
45
+ __version__ = '2.5.0'
46
46
  __author__ = 'Scott Prahl'
47
47
  __email__ = 'scott.prahl@oit.edu'
48
48
  __copyright__ = 'Copyright 2017-23, Scott Prahl'
@@ -476,8 +476,8 @@ def _small_mie_S1_S2(m, x, mu):
476
476
  return [S1, S2]
477
477
 
478
478
 
479
- @njit((complex128[:], complex128[:], float64, int32), cache=True)
480
- def normalization_factor(a, b, x, norm_int):
479
+ @njit((complex128, float64, int32), cache=True)
480
+ def normalization_factor(m, x, norm_int):
481
481
  """
482
482
  Figure out scattering function normalization.
483
483
 
@@ -492,7 +492,7 @@ def normalization_factor(a, b, x, norm_int):
492
492
  """
493
493
  # Qsca normalization
494
494
  if norm_int == 3:
495
- return np.sqrt(np.pi * x**2)
495
+ return x * np.sqrt(np.pi)
496
496
 
497
497
  # Bohren Normalization
498
498
  if norm_int == 5:
@@ -503,26 +503,23 @@ def normalization_factor(a, b, x, norm_int):
503
503
  return 1
504
504
 
505
505
  # calculate qsca and qext
506
- n = np.arange(1, len(a) + 1)
507
- cn = 2.0 * n + 1.0
508
- qext = 2 * np.sum(cn * (a.real + b.real)) / x**2
509
- qsca = 2 * np.sum(cn * (np.abs(a)**2 + np.abs(b)**2)) / x**2
506
+ qext, qsca, _, _ = _mie_scalar(m, x)
510
507
 
511
508
  # albedo Normalization
512
509
  if norm_int == 0:
513
- return np.sqrt(np.pi * x**2 * qext)
510
+ return x * np.sqrt(np.pi * qext)
514
511
 
515
512
  # Unity normalization
516
513
  if norm_int == 1:
517
- return np.sqrt(qsca * np.pi * x**2)
514
+ return x * np.sqrt(qsca * np.pi)
518
515
 
519
516
  # 4pi Normalization
520
517
  if norm_int == 2:
521
- return np.sqrt(qsca * x**2 / 4)
518
+ return x * np.sqrt(qsca / 4)
522
519
 
523
520
  # Qext Normalization
524
521
  if norm_int == 4: # 4pi
525
- return np.sqrt(qsca * np.pi * x**2 / qext)
522
+ return x * np.sqrt(qsca * np.pi / qext)
526
523
 
527
524
  raise ValueError("norm-int must be in the range 0..6")
528
525
 
@@ -609,7 +606,7 @@ def _mie_S1_S2(m, x, mu, norm_int):
609
606
  pi_nm1 = ((2 * n + 1) * mu[k] * pi_nm1 - (n + 1) * pi_nm2) / n
610
607
  pi_nm2 = temp
611
608
 
612
- normalization = normalization_factor(a, b, x, norm_int)
609
+ normalization = normalization_factor(m, x, norm_int)
613
610
 
614
611
  S1 /= normalization
615
612
  S2 /= normalization
@@ -465,13 +465,12 @@ def _small_mie_S1_S2(m, x, mu):
465
465
  return [S1, S2]
466
466
 
467
467
 
468
- def normalization_factor(a, b, x, norm_str):
468
+ def normalization_factor(m, x, norm_str):
469
469
  """
470
470
  Figure out scattering function normalization.
471
471
 
472
472
  Args:
473
- a: complex array of An coefficients
474
- b: complex array of Bn coefficients
473
+ m: complex index of refraction of sphere
475
474
  x: dimensionless sphere size
476
475
  norm_str: string describing type of normalization
477
476
 
@@ -486,26 +485,22 @@ def normalization_factor(a, b, x, norm_str):
486
485
  if norm in ['wiscombe']:
487
486
  return 1
488
487
 
489
- n = np.arange(1, len(a) + 1)
490
- cn = 2.0 * n + 1.0
491
- qext = 2 * np.sum(cn * (a.real + b.real)) / x**2
488
+ if norm in ['qsca', 'scattering_efficiency']:
489
+ return x * np.sqrt(np.pi)
492
490
 
493
- if norm in ['a', 'albedo']:
494
- return np.sqrt(np.pi * x**2 * qext)
491
+ qext, qsca, _, _ = _mie_scalar(m, x)
495
492
 
496
- qsca = 2 * np.sum(cn * (np.abs(a)**2 + np.abs(b)**2)) / x**2
493
+ if norm in ['a', 'albedo']:
494
+ return x * np.sqrt(np.pi * qext)
497
495
 
498
496
  if norm in ['1', 'one', 'unity']:
499
- return np.sqrt(qsca * np.pi * x**2)
497
+ return x * np.sqrt(qsca * np.pi)
500
498
 
501
499
  if norm in ['four_pi', '4pi']:
502
- return np.sqrt(qsca * x**2 / 4)
503
-
504
- if norm in ['qsca', 'scattering_efficiency']:
505
- return np.sqrt(np.pi * x**2)
500
+ return x * np.sqrt(qsca / 4)
506
501
 
507
502
  if norm in ['qext', 'extinction_efficiency']:
508
- return np.sqrt(qsca * np.pi * x**2 / qext)
503
+ return x * np.sqrt(qsca * np.pi / qext)
509
504
 
510
505
  raise ValueError("normalization must be one of 'albedo' (default), 'one'"
511
506
  "'4pi', 'qext', 'qsca', 'bohren', or 'wiscombe'")
@@ -549,7 +544,7 @@ def mie_S1_S2(m, x, mu, norm='albedo'):
549
544
  pi_nm1 = ((2 * n + 1) * mu[k] * pi_nm1 - (n + 1) * pi_nm2) / n
550
545
  pi_nm2 = temp
551
546
 
552
- normalization = normalization_factor(a, b, x, norm)
547
+ normalization = normalization_factor(m, x, norm)
553
548
 
554
549
  S1 /= normalization
555
550
  S2 /= normalization
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: miepython
3
- Version: 2.4.0
3
+ Version: 2.5.0
4
4
  Summary: Mie scattering of a plane wave by a sphere
5
5
  Home-page: https://github.com/scottprahl/miepython.git
6
6
  Author: Scott Prahl
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes