BornSim 0.7.0__tar.gz → 0.9.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 (157) hide show
  1. {bornsim-0.7.0 → bornsim-0.9.0}/.zenodo.json +2 -2
  2. {bornsim-0.7.0 → bornsim-0.9.0/BornSim.egg-info}/PKG-INFO +6 -1
  3. {bornsim-0.7.0 → bornsim-0.9.0}/BornSim.egg-info/SOURCES.txt +11 -4
  4. {bornsim-0.7.0 → bornsim-0.9.0}/BornSim.egg-info/requires.txt +4 -0
  5. {bornsim-0.7.0 → bornsim-0.9.0}/CITATION.cff +1 -1
  6. {bornsim-0.7.0 → bornsim-0.9.0}/CONTRIBUTING.md +18 -0
  7. {bornsim-0.7.0/BornSim.egg-info → bornsim-0.9.0}/PKG-INFO +6 -1
  8. {bornsim-0.7.0 → bornsim-0.9.0}/README.rst +2 -0
  9. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/__init__.py +4 -0
  10. bornsim-0.9.0/bornsim/_version.py +5 -0
  11. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/angular_data.py +6 -2
  12. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/api.py +4 -0
  13. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/directions.py +2 -2
  14. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/ensemble.py +11 -2
  15. bornsim-0.9.0/bornsim/polarization.py +90 -0
  16. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/results.py +18 -10
  17. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/sampling.py +36 -6
  18. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/series.py +42 -11
  19. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/solver.py +15 -3
  20. bornsim-0.9.0/bornsim/source.py +151 -0
  21. {bornsim-0.7.0 → bornsim-0.9.0}/conda.recipe/meta.yaml +1 -1
  22. bornsim-0.9.0/docs/examples/born_orders/README.rst +10 -0
  23. bornsim-0.9.0/docs/examples/born_orders/contrast_sensitivity.py +66 -0
  24. bornsim-0.9.0/docs/examples/born_orders/coupled_spheres.py +84 -0
  25. bornsim-0.9.0/docs/examples/born_orders/wavelength_corrections.py +70 -0
  26. bornsim-0.9.0/docs/examples/results/README.rst +10 -0
  27. bornsim-0.9.0/docs/examples/results/angular_cut_and_full.py +75 -0
  28. bornsim-0.9.0/docs/examples/results/cross_section_and_volume.py +75 -0
  29. bornsim-0.9.0/docs/examples/results/phase_normalization.py +73 -0
  30. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/README.rst +4 -0
  31. bornsim-0.9.0/docs/examples/structured_media/illumination_polarization.py +136 -0
  32. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/absorption.rst +2 -1
  33. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/api.rst +66 -1
  34. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/examples.rst +28 -1
  35. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/medium_visualization.rst +3 -2
  36. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/research.rst +9 -7
  37. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/theory.rst +15 -7
  38. {bornsim-0.7.0 → bornsim-0.9.0}/makefile +4 -4
  39. {bornsim-0.7.0 → bornsim-0.9.0}/pyproject.toml +11 -3
  40. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_api_scope.py +1 -1
  41. bornsim-0.9.0/tests/numerical/test_illumination.py +397 -0
  42. bornsim-0.9.0/tests/numerical/test_polarization.py +163 -0
  43. {bornsim-0.7.0 → bornsim-0.9.0}/tests/packaging/test_release_tools.py +8 -9
  44. bornsim-0.7.0/bornsim/_version.py +0 -1
  45. bornsim-0.7.0/bornsim/source.py +0 -57
  46. bornsim-0.7.0/docs/examples/born_orders/README.rst +0 -5
  47. bornsim-0.7.0/docs/examples/results/README.rst +0 -5
  48. bornsim-0.7.0/tools/check_release.py +0 -115
  49. bornsim-0.7.0/tools/next_release_version.py +0 -81
  50. bornsim-0.7.0/tools/release_tag.py +0 -208
  51. {bornsim-0.7.0 → bornsim-0.9.0}/.coveragerc +0 -0
  52. {bornsim-0.7.0 → bornsim-0.9.0}/.pre-commit-config.yaml +0 -0
  53. {bornsim-0.7.0 → bornsim-0.9.0}/BornSim.egg-info/dependency_links.txt +0 -0
  54. {bornsim-0.7.0 → bornsim-0.9.0}/BornSim.egg-info/top_level.txt +0 -0
  55. {bornsim-0.7.0 → bornsim-0.9.0}/LICENSE +0 -0
  56. {bornsim-0.7.0 → bornsim-0.9.0}/MANIFEST.in +0 -0
  57. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/convergence.py +0 -0
  58. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/ensemble_sampling.py +0 -0
  59. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/geometry.py +0 -0
  60. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/green.py +0 -0
  61. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/grid.py +0 -0
  62. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/material.py +0 -0
  63. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/__init__.py +0 -0
  64. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/base.py +0 -0
  65. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/particles/__init__.py +0 -0
  66. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/particles/core_shell.py +0 -0
  67. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/particles/cylinder.py +0 -0
  68. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/particles/ellipsoid.py +0 -0
  69. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/particles/spheres.py +0 -0
  70. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/random/__init__.py +0 -0
  71. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/random/fields.py +0 -0
  72. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/random_medium.py +0 -0
  73. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/random_spheres.py +0 -0
  74. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/structured/__init__.py +0 -0
  75. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/structured/composite.py +0 -0
  76. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/medium/structured/periodic.py +0 -0
  77. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/rotation.py +0 -0
  78. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/units.py +0 -0
  79. {bornsim-0.7.0 → bornsim-0.9.0}/bornsim/volume.py +0 -0
  80. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/README.rst +0 -0
  81. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/born_orders/absorbing_random_medium.py +0 -0
  82. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/born_orders/born_interference.py +0 -0
  83. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/born_orders/compare_orders.py +0 -0
  84. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/README.rst +0 -0
  85. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/covariance_models.py +0 -0
  86. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/phase_function.py +0 -0
  87. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/random_medium.py +0 -0
  88. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/random_spheres.py +0 -0
  89. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/theory_random_fields.py +0 -0
  90. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/random_media/wavelength_dependence.py +0 -0
  91. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/results/coherent_diffuse.py +0 -0
  92. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/results/result_plots.py +0 -0
  93. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/results/save_load_results.py +0 -0
  94. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/antenna_rods.py +0 -0
  95. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/dielectric_sphere.py +0 -0
  96. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/particle_families.py +0 -0
  97. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/periodic_array.py +0 -0
  98. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/structured_media.py +0 -0
  99. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/structured_media/theory_directional_interference.py +0 -0
  100. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/README.rst +0 -0
  101. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/absorbing_sphere_balance.py +0 -0
  102. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/angular_convergence.py +0 -0
  103. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/convergence_reports.py +0 -0
  104. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/ensemble_sampling.py +0 -0
  105. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/finite_size_comparison.py +0 -0
  106. {bornsim-0.7.0 → bornsim-0.9.0}/docs/examples/validation/grid_refinement.py +0 -0
  107. {bornsim-0.7.0 → bornsim-0.9.0}/docs/images/bornsim_medium_opacity_3d.png +0 -0
  108. {bornsim-0.7.0 → bornsim-0.9.0}/docs/images/bornsim_spf_surface_3d.png +0 -0
  109. {bornsim-0.7.0 → bornsim-0.9.0}/docs/images/branding-prompts.rst +0 -0
  110. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/_static/favicon.png +0 -0
  111. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/_static/favicon.svg +0 -0
  112. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/_static/icon.png +0 -0
  113. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/_static/logo.png +0 -0
  114. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/_static/logo.svg +0 -0
  115. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/_static/phase_function.svg +0 -0
  116. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/conf.py +0 -0
  117. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/development.rst +0 -0
  118. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/gallery_config.py +0 -0
  119. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/getting_started.rst +0 -0
  120. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/guide.rst +0 -0
  121. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/index.rst +0 -0
  122. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/overview.rst +0 -0
  123. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/reliability.rst +0 -0
  124. {bornsim-0.7.0 → bornsim-0.9.0}/docs/source/resources.rst +0 -0
  125. {bornsim-0.7.0 → bornsim-0.9.0}/pytest.ini +0 -0
  126. {bornsim-0.7.0 → bornsim-0.9.0}/setup.cfg +0 -0
  127. {bornsim-0.7.0 → bornsim-0.9.0}/tests/analytical/mie_reference.py +0 -0
  128. {bornsim-0.7.0 → bornsim-0.9.0}/tests/analytical/reference.py +0 -0
  129. {bornsim-0.7.0 → bornsim-0.9.0}/tests/analytical/test_absorbing_mie.py +0 -0
  130. {bornsim-0.7.0 → bornsim-0.9.0}/tests/analytical/test_model.py +0 -0
  131. {bornsim-0.7.0 → bornsim-0.9.0}/tests/analytical/test_numerical_reference.py +0 -0
  132. {bornsim-0.7.0 → bornsim-0.9.0}/tests/conftest.py +0 -0
  133. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_absorption.py +0 -0
  134. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_api.py +0 -0
  135. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_api_keywords.py +0 -0
  136. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_api_ownership.py +0 -0
  137. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_configuration.py +0 -0
  138. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_directional_api.py +0 -0
  139. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_directions.py +0 -0
  140. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_engine.py +0 -0
  141. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_explicit_physics.py +0 -0
  142. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_geometry.py +0 -0
  143. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_media.py +0 -0
  144. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_medium_composition.py +0 -0
  145. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_medium_families.py +0 -0
  146. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_medium_metadata.py +0 -0
  147. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_plot_contract.py +0 -0
  148. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_random_spheres.py +0 -0
  149. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_reliability.py +0 -0
  150. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_result.py +0 -0
  151. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_result_contract.py +0 -0
  152. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_rotation.py +0 -0
  153. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_series.py +0 -0
  154. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_unit_contract.py +0 -0
  155. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_units.py +0 -0
  156. {bornsim-0.7.0 → bornsim-0.9.0}/tests/numerical/test_volume_plotting.py +0 -0
  157. {bornsim-0.7.0 → bornsim-0.9.0}/tools/check_wheel.py +0 -0
@@ -8,11 +8,11 @@
8
8
  }
9
9
  ],
10
10
  "license": "mit",
11
- "version": "0.7.0",
11
+ "version": "0.9.0",
12
12
  "keywords": [
13
13
  "Born approximation",
14
14
  "light scattering",
15
15
  "random media"
16
16
  ],
17
- "publication_date": "2026-10-23"
17
+ "publication_date": "2026-10-25"
18
18
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: BornSim
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: Vector Born-series scattering from continuous random dielectric media
5
5
  Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
6
6
  License-Expression: MIT
@@ -23,7 +23,10 @@ Requires-Dist: TypedUnit>=0.2.9
23
23
  Requires-Dist: pint<0.26,>=0.24
24
24
  Requires-Dist: matplotlib<4,>=3.7
25
25
  Requires-Dist: plotly<7,>=6
26
+ Provides-Extra: release
27
+ Requires-Dist: martinpdes-maintenance==0.2.2; extra == "release"
26
28
  Provides-Extra: testing
29
+ Requires-Dist: martinpdes-maintenance==0.2.2; extra == "testing"
27
30
  Requires-Dist: pytest<10,>=8; extra == "testing"
28
31
  Requires-Dist: pytest-cov<8,>=5; extra == "testing"
29
32
  Provides-Extra: test
@@ -142,6 +145,8 @@ What BornSim models
142
145
 
143
146
  * **Media:** Gaussian, exponential, and Whittle–Matérn random fields, seeded
144
147
  random spheres, and composable structured geometry.
148
+ * **Illumination:** arbitrary incident direction and linear, circular, or
149
+ elliptical polarization, with unpolarized illumination as the default.
145
150
  * **Numerics:** vector volume-integral propagation with configurable Born order,
146
151
  angular quadrature, grid spacing, and ensemble sampling.
147
152
  * **Results:** differential scattering, full directional phase functions,
@@ -26,6 +26,7 @@ bornsim/geometry.py
26
26
  bornsim/green.py
27
27
  bornsim/grid.py
28
28
  bornsim/material.py
29
+ bornsim/polarization.py
29
30
  bornsim/results.py
30
31
  bornsim/rotation.py
31
32
  bornsim/sampling.py
@@ -54,6 +55,9 @@ docs/examples/born_orders/README.rst
54
55
  docs/examples/born_orders/absorbing_random_medium.py
55
56
  docs/examples/born_orders/born_interference.py
56
57
  docs/examples/born_orders/compare_orders.py
58
+ docs/examples/born_orders/contrast_sensitivity.py
59
+ docs/examples/born_orders/coupled_spheres.py
60
+ docs/examples/born_orders/wavelength_corrections.py
57
61
  docs/examples/random_media/README.rst
58
62
  docs/examples/random_media/covariance_models.py
59
63
  docs/examples/random_media/phase_function.py
@@ -62,12 +66,16 @@ docs/examples/random_media/random_spheres.py
62
66
  docs/examples/random_media/theory_random_fields.py
63
67
  docs/examples/random_media/wavelength_dependence.py
64
68
  docs/examples/results/README.rst
69
+ docs/examples/results/angular_cut_and_full.py
65
70
  docs/examples/results/coherent_diffuse.py
71
+ docs/examples/results/cross_section_and_volume.py
72
+ docs/examples/results/phase_normalization.py
66
73
  docs/examples/results/result_plots.py
67
74
  docs/examples/results/save_load_results.py
68
75
  docs/examples/structured_media/README.rst
69
76
  docs/examples/structured_media/antenna_rods.py
70
77
  docs/examples/structured_media/dielectric_sphere.py
78
+ docs/examples/structured_media/illumination_polarization.py
71
79
  docs/examples/structured_media/particle_families.py
72
80
  docs/examples/structured_media/periodic_array.py
73
81
  docs/examples/structured_media/structured_media.py
@@ -120,11 +128,13 @@ tests/numerical/test_directions.py
120
128
  tests/numerical/test_engine.py
121
129
  tests/numerical/test_explicit_physics.py
122
130
  tests/numerical/test_geometry.py
131
+ tests/numerical/test_illumination.py
123
132
  tests/numerical/test_media.py
124
133
  tests/numerical/test_medium_composition.py
125
134
  tests/numerical/test_medium_families.py
126
135
  tests/numerical/test_medium_metadata.py
127
136
  tests/numerical/test_plot_contract.py
137
+ tests/numerical/test_polarization.py
128
138
  tests/numerical/test_random_spheres.py
129
139
  tests/numerical/test_reliability.py
130
140
  tests/numerical/test_result.py
@@ -135,7 +145,4 @@ tests/numerical/test_unit_contract.py
135
145
  tests/numerical/test_units.py
136
146
  tests/numerical/test_volume_plotting.py
137
147
  tests/packaging/test_release_tools.py
138
- tools/check_release.py
139
- tools/check_wheel.py
140
- tools/next_release_version.py
141
- tools/release_tag.py
148
+ tools/check_wheel.py
@@ -14,9 +14,13 @@ pre-commit<5,>=4
14
14
  [documentation]
15
15
  MartinPdeS-docs<0.3,>=0.2.5
16
16
 
17
+ [release]
18
+ martinpdes-maintenance==0.2.2
19
+
17
20
  [test]
18
21
  BornSim[testing]
19
22
 
20
23
  [testing]
24
+ martinpdes-maintenance==0.2.2
21
25
  pytest<10,>=8
22
26
  pytest-cov<8,>=5
@@ -2,7 +2,7 @@ cff-version: 1.2.0
2
2
  message: "If you use BornSim in research, please cite the software version used."
3
3
  title: "BornSim"
4
4
  type: software
5
- version: "0.7.0"
5
+ version: "0.9.0"
6
6
  authors:
7
7
  - family-names: "Poinsinet de Sivry-Houle"
8
8
  given-names: "Martin"
@@ -21,3 +21,21 @@ Install local hooks with `.venv/bin/pre-commit install`. Format changes with `ma
21
21
  Versions are declared in project metadata and checked across the package, citation, Zenodo and Conda files. Commit work before tagging. `make tag VERSION=v0.1.0` creates a local release commit and annotated tag. `make release patch`, `minor`, or `major` chooses a version above the highest semantic Git tag, aligns all metadata, commits, tags and pushes the resulting HEAD and that specific tag. These commands are never part of ordinary tests.
22
22
 
23
23
  CI builds/tests on Python 3.11–3.13 across Linux, macOS and Windows. The tag-triggered PyPI workflow requires the repository's `PYPI_API_TOKEN` secret. Documentation builds are checked by CI; hosting configuration is separate. Conda builds can be verified manually through the Conda workflow; no channel upload is configured. Remote repository creation and publishing credentials must be configured before publication.
24
+
25
+ ## Shared release versioning
26
+
27
+ Versions are explicit in `[project].version`; builds never derive versions from
28
+ Git. Install the pinned release tool in the interpreter used by Make:
29
+
30
+ ```sh
31
+ python -m pip install "martinpdes-maintenance==0.2.2"
32
+ make release-check PYTHON=python
33
+ ```
34
+
35
+ The `release` extra declares the same tool. The Makefile calls the installed module directly, and
36
+ `[tool.mps-maintenance]` declares the package's release files. Use
37
+ `python -m martinpdes_maintenance.cli tag vX.Y.Z --dry-run` to preview changes from a clean,
38
+ full checkout. The tool aligns configured metadata, commits, and creates an
39
+ annotated tag; it never pushes. Existing Makefile publishing shortcuts retain
40
+ their push behavior. Fetch remote tags first. With no release tags, `next` uses
41
+ the explicit project version as its starting point.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: BornSim
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: Vector Born-series scattering from continuous random dielectric media
5
5
  Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
6
6
  License-Expression: MIT
@@ -23,7 +23,10 @@ Requires-Dist: TypedUnit>=0.2.9
23
23
  Requires-Dist: pint<0.26,>=0.24
24
24
  Requires-Dist: matplotlib<4,>=3.7
25
25
  Requires-Dist: plotly<7,>=6
26
+ Provides-Extra: release
27
+ Requires-Dist: martinpdes-maintenance==0.2.2; extra == "release"
26
28
  Provides-Extra: testing
29
+ Requires-Dist: martinpdes-maintenance==0.2.2; extra == "testing"
27
30
  Requires-Dist: pytest<10,>=8; extra == "testing"
28
31
  Requires-Dist: pytest-cov<8,>=5; extra == "testing"
29
32
  Provides-Extra: test
@@ -142,6 +145,8 @@ What BornSim models
142
145
 
143
146
  * **Media:** Gaussian, exponential, and Whittle–Matérn random fields, seeded
144
147
  random spheres, and composable structured geometry.
148
+ * **Illumination:** arbitrary incident direction and linear, circular, or
149
+ elliptical polarization, with unpolarized illumination as the default.
145
150
  * **Numerics:** vector volume-integral propagation with configurable Born order,
146
151
  angular quadrature, grid spacing, and ensemble sampling.
147
152
  * **Results:** differential scattering, full directional phase functions,
@@ -102,6 +102,8 @@ What BornSim models
102
102
 
103
103
  * **Media:** Gaussian, exponential, and Whittle–Matérn random fields, seeded
104
104
  random spheres, and composable structured geometry.
105
+ * **Illumination:** arbitrary incident direction and linear, circular, or
106
+ elliptical polarization, with unpolarized illumination as the default.
105
107
  * **Numerics:** vector volume-integral propagation with configurable Born order,
106
108
  angular quadrature, grid spacing, and ensemble sampling.
107
109
  * **Results:** differential scattering, full directional phase functions,
@@ -7,6 +7,7 @@ from .volume import Volume
7
7
  from .geometry import Layer, Sphere, Ellipsoid, Box, Cylinder, StructuredMedium
8
8
  from .rotation import Rotation
9
9
  from .source import Source
10
+ from .polarization import PolarizationState, LeftCircular, RightCircular
10
11
  from .solver import Solver
11
12
  from .grid import Grid
12
13
  from .directions import Directions
@@ -37,6 +38,9 @@ __all__ = [
37
38
  "StructuredMedium",
38
39
  "Volume",
39
40
  "Source",
41
+ "PolarizationState",
42
+ "LeftCircular",
43
+ "RightCircular",
40
44
  "Solver",
41
45
  "Grid",
42
46
  "AngularSampling",
@@ -0,0 +1,5 @@
1
+ """Release version maintained by martinpdes-maintenance."""
2
+
3
+ __version__ = version = "0.9.0"
4
+ __version_tuple__ = version_tuple = tuple(int(part) for part in version.split("."))
5
+ __commit_id__ = commit_id = None
@@ -12,7 +12,7 @@ class AngularData:
12
12
  Full angular data have shape (order, polar angle, azimuth). Cuts and
13
13
  explicitly averaged curves have shape (order, observation). Directions
14
14
  have the same observation axes and a final Cartesian axis of size three.
15
- Amplitudes add incident-polarization and vector axes of sizes two and
15
+ Amplitudes add incident-polarization and vector axes of sizes one or two and
16
16
  three. Ensemble amplitudes are absent: intensities, not amplitudes, are
17
17
  averaged across realizations. Arrays are copied, unitful and read-only.
18
18
  """
@@ -76,7 +76,11 @@ class AngularData:
76
76
  if self.directions is not None and self.directions.shape != (*shape[1:], 3):
77
77
  raise ValueError("directions must match the observation axes.")
78
78
 
79
- if self.amplitudes is not None and self.amplitudes.shape != (*shape, 2, 3):
79
+ valid_amplitudes = self.amplitudes is None or (
80
+ self.amplitudes.shape[:-2] == shape and self.amplitudes.shape[-2:] in ((1, 3), (2, 3))
81
+ )
82
+
83
+ if not valid_amplitudes:
80
84
  raise ValueError("amplitudes must have shape matching the order and observation axes.")
81
85
 
82
86
  self._validate_values()
@@ -4,6 +4,7 @@ Implementations live in source.py, solver.py, and results.py.
4
4
  """
5
5
 
6
6
  from .source import Source
7
+ from .polarization import PolarizationState, LeftCircular, RightCircular
7
8
  from .solver import Solver
8
9
  from .results import Result
9
10
  from .convergence import ConvergenceReport
@@ -20,6 +21,9 @@ __all__ = [
20
21
  "Material",
21
22
  "EnsembleSampling",
22
23
  "Source",
24
+ "PolarizationState",
25
+ "LeftCircular",
26
+ "RightCircular",
23
27
  "Solver",
24
28
  "Result",
25
29
  "Grid",
@@ -20,8 +20,8 @@ class Directions:
20
20
 
21
21
  Notes
22
22
  -----
23
- Coordinates use the global x, y, z axes. The incident wave propagates
24
- along positive z. Vector order is preserved in scattered amplitudes.
23
+ Coordinates use the global x, y, z axes, independently of the source
24
+ incident direction. Vector order is preserved in scattered amplitudes.
25
25
  Use ``vectors`` to access the NumPy array and :meth:`from_angles` to
26
26
  construct vectors from explicitly unit-bearing spherical coordinates.
27
27
  """
@@ -1,12 +1,14 @@
1
1
  """Numerical ensemble quadrature and realization sampling uncertainty."""
2
2
 
3
3
  from typing import Any
4
+ from numpy.typing import ArrayLike
4
5
  import numpy as np
5
6
  from .medium import Medium
6
7
  from .grid import Grid
7
8
  from .sampling import AngularSampling
8
9
  from .ensemble_sampling import EnsembleSampling
9
10
  from .series import BornSeries
11
+ from .polarization import PolarizationState
10
12
  from .units import Quantity, _integer, validate_units, ureg
11
13
 
12
14
 
@@ -17,6 +19,8 @@ def ensemble_scattering(
17
19
  grid: Grid,
18
20
  sampling: AngularSampling | None = None,
19
21
  order: int = 3,
22
+ incident_direction: ArrayLike = (0.0, 0.0, 1.0),
23
+ polarization: PolarizationState | ArrayLike | None = None,
20
24
  ensemble_sampling: EnsembleSampling | None = None,
21
25
  ) -> dict[str, Any]:
22
26
  """Run numerical Born ensembles on an explicit Grid.
@@ -71,6 +75,8 @@ def ensemble_scattering(
71
75
  grid=grid,
72
76
  background_refractive_index=medium.background_refractive_index,
73
77
  wavelength=wavelength,
78
+ incident_direction=incident_direction,
79
+ polarization=polarization,
74
80
  directions=sampling.directions,
75
81
  order=order,
76
82
  )
@@ -98,7 +104,10 @@ def ensemble_scattering(
98
104
 
99
105
  result = engine.solve(volume=volume)
100
106
 
101
- sampled = sampling.summarize(result=result)
107
+ sampled = sampling.summarize(
108
+ result=result,
109
+ incident_direction=engine.incident_direction,
110
+ )
102
111
 
103
112
  assert result.mu_a is not None and result.residual_norms is not None
104
113
  absorption_samples.append(result.mu_a)
@@ -163,7 +172,7 @@ def ensemble_scattering(
163
172
  ),
164
173
  "residual_norms": np.asarray(residual_samples),
165
174
  "coherent_differential": np.sum(np.abs(amplitude_sum / realizations) ** 2, axis=(-1, -2))
166
- / (2 * float(grid.volume.to("meter**3").magnitude)),
175
+ / (amplitude_sum.shape[-2] * float(grid.volume.to("meter**3").magnitude)),
167
176
  "angles": sampling.angles.copy(),
168
177
  "azimuths": sampling.azimuths,
169
178
  "directional_differential": directional.mean(axis=0),
@@ -0,0 +1,90 @@
1
+ """Pure polarization states in a source's local transverse Jones basis."""
2
+
3
+ from dataclasses import dataclass
4
+ import numpy as np
5
+ from numpy.typing import ArrayLike
6
+ from .units import Quantity, validate_units
7
+
8
+
9
+ @dataclass(frozen=True, kw_only=True, init=False, eq=False)
10
+ class PolarizationState:
11
+ """Define linear polarization by angle or a general pure Jones state.
12
+
13
+ Parameters
14
+ ----------
15
+ angle : Quantity, optional
16
+ Linear polarization orientation with explicit angular units. Zero
17
+ aligns with the source's first transverse basis vector; positive
18
+ angles turn toward its second. Cannot be combined with jones_vector.
19
+ jones_vector : array_like, optional
20
+ Two finite, complex, unitless electric-field components. Nonzero
21
+ vectors are normalized to unit incident intensity, retaining relative
22
+ phase. Cannot be combined with angle. Supply exactly one argument.
23
+
24
+ Notes
25
+ -----
26
+ Source projects laboratory +x onto the plane normal to its incident
27
+ direction to obtain the first basis vector. For incidence parallel to x,
28
+ laboratory +y is used instead. The second vector is direction cross first,
29
+ so the basis and propagation direction form a right-handed frame.
30
+ For positive-z incidence the Jones basis is exactly laboratory x, y.
31
+ The time convention is exp(-i omega t). Jones vectors describe pure states;
32
+ unpolarized illumination is selected by omitting Source.polarization.
33
+ """
34
+
35
+ jones_vector: np.ndarray
36
+ angle: Quantity | None
37
+
38
+ def __init__(self, *, angle: Quantity | None = None, jones_vector: ArrayLike | None = None) -> None:
39
+ if (angle is None) == (jones_vector is None):
40
+ raise ValueError("Supply exactly one of angle or jones_vector.")
41
+
42
+ if angle is not None:
43
+ validate_units(
44
+ angle,
45
+ unit="radian",
46
+ name="angle",
47
+ scalar=True,
48
+ )
49
+
50
+ if np.iscomplexobj(angle.magnitude) or not np.isfinite(angle):
51
+ raise ValueError("angle must be a finite real angular quantity.")
52
+
53
+ vector = np.array([np.cos(angle).magnitude, np.sin(angle).magnitude], dtype=complex)
54
+ else:
55
+ if isinstance(jones_vector, Quantity):
56
+ raise TypeError("jones_vector must contain plain unitless components.")
57
+
58
+ vector = np.asarray(jones_vector, dtype=complex)
59
+
60
+ if vector.shape != (2,) or not np.all(np.isfinite(vector)):
61
+ raise ValueError("jones_vector must contain two finite complex components.")
62
+
63
+ scale = max(np.max(np.abs(vector.real)), np.max(np.abs(vector.imag)))
64
+
65
+ if scale == 0:
66
+ raise ValueError("jones_vector must be nonzero.")
67
+
68
+ scaled = vector / scale
69
+
70
+ normalized = scaled / np.linalg.norm(scaled)
71
+
72
+ immutable = np.frombuffer(normalized.tobytes(), dtype=np.complex128)
73
+
74
+ object.__setattr__(self, "jones_vector", immutable)
75
+
76
+ object.__setattr__(self, "angle", None if angle is None else angle.copy())
77
+
78
+
79
+ class LeftCircular(PolarizationState):
80
+ """Unit Jones state (1, +i)/sqrt(2), matching PyMieSim's convention."""
81
+
82
+ def __init__(self) -> None:
83
+ super().__init__(jones_vector=[1, 1j])
84
+
85
+
86
+ class RightCircular(PolarizationState):
87
+ """Unit Jones state (1, -i)/sqrt(2), matching PyMieSim's convention."""
88
+
89
+ def __init__(self) -> None:
90
+ super().__init__(jones_vector=[1, -1j])
@@ -40,7 +40,7 @@ class Result:
40
40
  Full solves retain ``differential`` and ``term_differential`` with shape
41
41
  (order, polar angle, azimuth). Cuts and explicitly averaged results use
42
42
  (order, observation). ``amplitudes`` always adds polarization and Cartesian
43
- axes of sizes two and three to the differential shape. Ensembles retain
43
+ axes of sizes one or two and three to the differential shape. Ensembles retain
44
44
  intensities and standard errors, without coherent amplitudes.
45
45
 
46
46
  ``angular`` groups read-only coordinates, intensities, amplitudes and phase
@@ -68,7 +68,7 @@ class Result:
68
68
  scattering. Arrays and JSON-compatible provenance are copied and validated.
69
69
  Use differential and amplitudes for both cuts and full solves.
70
70
 
71
- Save and load use schema 2 archives; unsupported schemas are rejected.
71
+ Save and load use schema 3 archives (schema 2 remains readable); unsupported schemas are rejected.
72
72
  Numerical cumulative intensities retain coherent amplitude interference.
73
73
  Isolated intensities must not be summed to reconstruct cumulative results.
74
74
  """
@@ -207,6 +207,9 @@ class Result:
207
207
  **{name: getattr(state, name) for name in _ANGULAR_FIELDS}, kind=kind, azimuth_averaged=azimuth_averaged
208
208
  )
209
209
 
210
+ if angular.amplitudes is not None and angular.amplitudes.shape[-2] != len(source.polarization_vectors):
211
+ raise ValueError("amplitudes polarization channels must match the source.")
212
+
210
213
  self._validate_state(result=state)
211
214
 
212
215
  for name, value in {
@@ -517,7 +520,8 @@ class Result:
517
520
 
518
521
  metadata = {
519
522
  "format": "bornsim-result",
520
- "schema_version": 2,
523
+ "schema_version": 3,
524
+ "source": self.source.metadata,
521
525
  "azimuth_averaged": self.azimuth_averaged,
522
526
  "wavelength_m": float(self.source.wavelength.to("meter").magnitude),
523
527
  "kind": self.kind,
@@ -567,7 +571,7 @@ class Result:
567
571
  unsupported_schema = (
568
572
  metadata["format"] != "bornsim-result"
569
573
  or type(metadata["schema_version"]) is not int
570
- or metadata["schema_version"] != 2
574
+ or metadata["schema_version"] not in (2, 3)
571
575
  )
572
576
 
573
577
  if unsupported_schema:
@@ -587,7 +591,11 @@ class Result:
587
591
  arrays = {name: archive[name] * ureg.Unit(unit) for name, unit in units.items()}
588
592
 
589
593
  return cls(
590
- source=Source(wavelength=metadata["wavelength_m"] * ureg.meter),
594
+ source=(
595
+ Source._from_metadata(metadata=metadata["source"])
596
+ if metadata["schema_version"] == 3
597
+ else Source(wavelength=metadata["wavelength_m"] * ureg.meter)
598
+ ),
591
599
  kind=metadata["kind"],
592
600
  azimuth_averaged=metadata.get("azimuth_averaged", False),
593
601
  realizations=metadata["realizations"],
@@ -752,7 +760,7 @@ class Result:
752
760
  the ensemble intensity average. Older archives lacking directional
753
761
  data must be recomputed for a directional 3D view. Angular and polar
754
762
  views select sampled meridians; averaging requires azimuth_average(). A flat phase function produces a spherical
755
- surface; forward scattering extends towards +z.
763
+ surface in laboratory coordinates; forward scattering follows the source direction.
756
764
  Samples are sorted by angle for rendering. Error bars for normalized
757
765
  ratios are omitted because the required covariance is not stored."""
758
766
 
@@ -888,7 +896,7 @@ class Result:
888
896
 
889
897
  axis.set(
890
898
  title=default_title if title is None else title,
891
- xlabel="Direction index" if result.angles is None else "Scattering angle (degrees)",
899
+ xlabel="Direction index" if result.angles is None else "Laboratory polar angle (degrees)",
892
900
  ylabel=ylabel,
893
901
  yscale="log" if log_y else "linear",
894
902
  )
@@ -1085,7 +1093,7 @@ class Result:
1085
1093
  scene={
1086
1094
  "xaxis_title": "p ŝx (sr⁻¹)",
1087
1095
  "yaxis_title": "p ŝy (sr⁻¹)",
1088
- "zaxis_title": "p ŝz (sr⁻¹); incidence +z",
1096
+ "zaxis_title": "p ŝz (sr⁻¹); laboratory z",
1089
1097
  "aspectmode": "data",
1090
1098
  },
1091
1099
  )
@@ -1123,7 +1131,7 @@ class Result:
1123
1131
  axis.set(
1124
1132
  xlabel="p ŝx (sr⁻¹)",
1125
1133
  ylabel="p ŝy (sr⁻¹)",
1126
- zlabel="p ŝz (sr⁻¹); incidence +z",
1134
+ zlabel="p ŝz (sr⁻¹); laboratory z",
1127
1135
  )
1128
1136
 
1129
1137
  axis.set_title(f"{title}\nThrough order {selected + 1} · {surface_label}")
@@ -1180,7 +1188,7 @@ class Result:
1180
1188
  else:
1181
1189
  axis.set(
1182
1190
  title=title,
1183
- xlabel="Scattering angle θ (degrees)",
1191
+ xlabel="Laboratory polar angle θ (degrees)",
1184
1192
  ylabel="Phase function p (sr⁻¹)",
1185
1193
  yscale="log" if log_y else "linear",
1186
1194
  )
@@ -2,6 +2,7 @@
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from typing import cast
5
+ from numpy.typing import ArrayLike
5
6
  import numpy as np
6
7
  from .directions import Directions
7
8
  from .grid import Grid
@@ -244,11 +245,17 @@ class AngularSampling:
244
245
  if realizations * np.prod(grid.shape) * directions * order > 100_000_000:
245
246
  raise ValueError("Requested scattering is too large; reduce grid, angles, order, or realizations.")
246
247
 
247
- def summarize(self, *, result: BornResult) -> dict[str, np.ndarray]:
248
+ def summarize(
249
+ self, *, result: BornResult, incident_direction: ArrayLike = (0.0, 0.0, 1.0)
250
+ ) -> dict[str, np.ndarray]:
248
251
  """Reduce numeric Born data while retaining all directional intensities.
249
252
 
250
253
  Parameters
251
254
  ----------
255
+ incident_direction : array_like, optional
256
+ Cartesian unit beam direction used for anisotropy and reduced
257
+ scattering moments. Defaults to positive z; output angles stay
258
+ in laboratory coordinates.
252
259
  result : BornResult
253
260
  Numeric Born amplitudes, cumulative differential data, and
254
261
  isolated-term differential data for one volume.
@@ -260,7 +267,7 @@ class AngularSampling:
260
267
  (order, output angle); ``directional_terms`` and
261
268
  ``directional_differential`` have shape (order, output angle,
262
269
  azimuth); ``directional_amplitudes`` adds incident polarization
263
- and vector-component axes of sizes two and three; ``integrals``
270
+ and vector-component axes of sizes one or two and three; ``integrals``
264
271
  has shape (order, 3), for total, first-moment, and reduced
265
272
  coefficients.
266
273
 
@@ -285,22 +292,45 @@ class AngularSampling:
285
292
 
286
293
  terms = directional_terms.mean(axis=-1)
287
294
 
288
- cosine, weights = np.polynomial.legendre.leggauss(self.polar_samples)
295
+ _, weights = np.polynomial.legendre.leggauss(self.polar_samples)
289
296
 
290
297
  quadrature = averaged[:, count:]
291
298
 
292
299
  mu = 2 * np.pi * np.sum(quadrature * weights, axis=-1)
293
300
 
294
- moment = 2 * np.pi * np.sum(quadrature * weights * cosine, axis=-1)
301
+ # Moments use the physical scattering cosine, not the laboratory z axis.
302
+ direction = Directions(vectors=np.asarray(incident_direction)[None, :]).vectors[0]
295
303
 
296
- reduced = 2 * np.pi * np.sum(quadrature * weights * (1 - cosine), axis=-1)
304
+ integration_directions = self.directions.vectors.reshape(-1, self.azimuth_samples, 3)[count:]
305
+
306
+ scattering_cosine = np.einsum("ijc,c->ij", integration_directions, direction)
307
+
308
+ integrated_differential = directional[:, count:]
309
+
310
+ moment = (
311
+ 2
312
+ * np.pi
313
+ * np.sum(
314
+ np.mean(integrated_differential * scattering_cosine, axis=-1) * weights,
315
+ axis=-1,
316
+ )
317
+ )
318
+
319
+ reduced = (
320
+ 2
321
+ * np.pi
322
+ * np.sum(
323
+ np.mean(integrated_differential * (1 - scattering_cosine), axis=-1) * weights,
324
+ axis=-1,
325
+ )
326
+ )
297
327
 
298
328
  return {
299
329
  "mean": averaged[:, :count],
300
330
  "terms": terms[:, :count],
301
331
  "directional_terms": directional_terms[:, :count],
302
332
  "directional_differential": directional[:, :count],
303
- "directional_amplitudes": result.amplitudes.reshape(*shape, 2, 3)[:, :count],
333
+ "directional_amplitudes": result.amplitudes.reshape(*shape, result.amplitudes.shape[-2], 3)[:, :count],
304
334
  "integrals": np.stack([mu, moment, reduced], axis=-1),
305
335
  }
306
336