gratinglab 0.3.5__tar.gz → 0.3.7__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 (222) hide show
  1. gratinglab-0.3.7/MANIFEST.in +4 -0
  2. {gratinglab-0.3.5/src/gratinglab.egg-info → gratinglab-0.3.7}/PKG-INFO +33 -5
  3. {gratinglab-0.3.5 → gratinglab-0.3.7}/README.md +31 -2
  4. gratinglab-0.3.7/docs/conventions.md +525 -0
  5. gratinglab-0.3.7/docs/theory/cmethod.md +338 -0
  6. gratinglab-0.3.7/docs/theory/integral.md +679 -0
  7. gratinglab-0.3.7/docs/theory/metrology.md +485 -0
  8. gratinglab-0.3.7/docs/theory/rcwa.md +511 -0
  9. gratinglab-0.3.7/docs/theory/scalar.md +718 -0
  10. {gratinglab-0.3.5 → gratinglab-0.3.7}/pyproject.toml +19 -6
  11. gratinglab-0.3.7/setup.py +46 -0
  12. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/__init__.py +12 -1
  13. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/docs.py +61 -11
  14. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/provenance.py +30 -4
  15. gratinglab-0.3.7/src/gratinglab/gui/qt/help_menu.py +93 -0
  16. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/launcher.py +135 -6
  17. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/main_window.py +13 -30
  18. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/theory_viewer.py +17 -2
  19. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/main_window.py +15 -4
  20. {gratinglab-0.3.5 → gratinglab-0.3.7/src/gratinglab.egg-info}/PKG-INFO +33 -5
  21. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab.egg-info/SOURCES.txt +10 -0
  22. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_changelog.py +33 -0
  23. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_cmethod_tab.py +4 -0
  24. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_compare_tab.py +5 -0
  25. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_docs.py +86 -1
  26. gratinglab-0.3.7/tests/test_gui_help_menu.py +125 -0
  27. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_launcher.py +217 -0
  28. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_provenance.py +65 -0
  29. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_qt.py +61 -11
  30. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_theme.py +1 -0
  31. {gratinglab-0.3.5 → gratinglab-0.3.7}/LICENSE +0 -0
  32. {gratinglab-0.3.5 → gratinglab-0.3.7}/setup.cfg +0 -0
  33. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/checks.py +0 -0
  34. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/compare.py +0 -0
  35. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/convergence.py +0 -0
  36. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/geometry.py +0 -0
  37. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/__init__.py +0 -0
  38. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/app.py +0 -0
  39. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/cmethod_options.py +0 -0
  40. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/comparison.py +0 -0
  41. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/diagram.py +0 -0
  42. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/diagram3d.py +0 -0
  43. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/efficiency_plot.py +0 -0
  44. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/icon.py +0 -0
  45. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/integral_options.py +0 -0
  46. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/launcher.py +0 -0
  47. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/mathtext.py +0 -0
  48. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/orders.py +0 -0
  49. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/__init__.py +0 -0
  50. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/cmethod_tab.py +0 -0
  51. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/compare_tab.py +0 -0
  52. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/geometry_panel.py +0 -0
  53. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/geometry_tab.py +0 -0
  54. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/integral_tab.py +0 -0
  55. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/profile_plot_panel.py +0 -0
  56. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/rcwa_tab.py +0 -0
  57. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/scalar_tab.py +0 -0
  58. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/scene3d_panel.py +0 -0
  59. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/setup_tab.py +0 -0
  60. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/sizing.py +0 -0
  61. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/theming.py +0 -0
  62. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/qt/worker.py +0 -0
  63. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/rcwa_options.py +0 -0
  64. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/richtext.py +0 -0
  65. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/scalar_options.py +0 -0
  66. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/state.py +0 -0
  67. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/gui/theme.py +0 -0
  68. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/illumination.py +0 -0
  69. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/io/__init__.py +0 -0
  70. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/io/boundary.py +0 -0
  71. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/io/efficiency_table.py +0 -0
  72. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/io/ggp.py +0 -0
  73. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/io/txl.py +0 -0
  74. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/materials/__init__.py +0 -0
  75. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/materials/data/SOURCES.md +0 -0
  76. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/materials/fresnel.py +0 -0
  77. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/materials/optical.py +0 -0
  78. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/materials/refractiveindex.py +0 -0
  79. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/materials/typical.py +0 -0
  80. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/measured.py +0 -0
  81. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/__init__.py +0 -0
  82. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/_analyzer_summary.py +0 -0
  83. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/analyzer.py +0 -0
  84. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/boundary/__init__.py +0 -0
  85. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/boundary/average.py +0 -0
  86. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/boundary/cross_section.py +0 -0
  87. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/boundary/pipeline.py +0 -0
  88. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/boundary/swaths.py +0 -0
  89. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/cli.py +0 -0
  90. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/config.py +0 -0
  91. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/__init__.py +0 -0
  92. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/analysis.py +0 -0
  93. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/image_flatten.py +0 -0
  94. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/orientation.py +0 -0
  95. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/processing.py +0 -0
  96. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/region_mask.py +0 -0
  97. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/scars.py +0 -0
  98. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/core/tip.py +0 -0
  99. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/data/__init__.py +0 -0
  100. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/data/aggregation.py +0 -0
  101. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/__init__.py +0 -0
  102. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/icon.py +0 -0
  103. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/__init__.py +0 -0
  104. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/app.py +0 -0
  105. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/boundary_view.py +0 -0
  106. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/canvas.py +0 -0
  107. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/efficiency_dialog.py +0 -0
  108. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/import_view.py +0 -0
  109. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/layout.py +0 -0
  110. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/swath_dialog.py +0 -0
  111. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/wiki_view.py +0 -0
  112. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/qt/worker.py +0 -0
  113. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/gui/state.py +0 -0
  114. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/io/__init__.py +0 -0
  115. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/io/file_io.py +0 -0
  116. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/io/ibw.py +0 -0
  117. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/io/metrics.py +0 -0
  118. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/io/sem.py +0 -0
  119. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/io/spm.py +0 -0
  120. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/settings.py +0 -0
  121. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/stats/__init__.py +0 -0
  122. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/stats/analysis.py +0 -0
  123. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/stats/icc.py +0 -0
  124. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/visualization/__init__.py +0 -0
  125. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/visualization/diagnostics.py +0 -0
  126. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/visualization/profiles.py +0 -0
  127. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/visualization/statistics.py +0 -0
  128. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/__init__.py +0 -0
  129. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/facet-fitting.md +0 -0
  130. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/file-formats.md +0 -0
  131. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/flattening.md +0 -0
  132. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/groove-orientation.md +0 -0
  133. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/icc-correction.md +0 -0
  134. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/overview.md +0 -0
  135. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/reading-outputs.md +0 -0
  136. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/row-groups.md +0 -0
  137. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/scars-and-masking.md +0 -0
  138. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/swath-statistics.md +0 -0
  139. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/wiki/tip-correction.md +0 -0
  140. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/metrology/workflows.py +0 -0
  141. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/problem.py +0 -0
  142. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/profiles/__init__.py +0 -0
  143. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/profiles/_base.py +0 -0
  144. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/profiles/_polyline.py +0 -0
  145. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/profiles/_shapes.py +0 -0
  146. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/profiles/_trapezoid.py +0 -0
  147. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/profiles/_types.py +0 -0
  148. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/resolution.py +0 -0
  149. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/result.py +0 -0
  150. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/__init__.py +0 -0
  151. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/_conditioning.py +0 -0
  152. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/_execution.py +0 -0
  153. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/_scalar_groove.py +0 -0
  154. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/base.py +0 -0
  155. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/cmethod/__init__.py +0 -0
  156. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/cmethod/_core.py +0 -0
  157. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/cmethod/_series.py +0 -0
  158. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/__init__.py +0 -0
  159. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/_boundary.py +0 -0
  160. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/_core.py +0 -0
  161. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/_finite.py +0 -0
  162. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/_greens.py +0 -0
  163. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/_kernels.py +0 -0
  164. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/integral/_nystrom.py +0 -0
  165. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/rcwa/__init__.py +0 -0
  166. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/rcwa/_core.py +0 -0
  167. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/rcwa/_stack.py +0 -0
  168. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab/solvers/scalar.py +0 -0
  169. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab.egg-info/dependency_links.txt +0 -0
  170. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab.egg-info/entry_points.txt +0 -0
  171. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab.egg-info/requires.txt +0 -0
  172. {gratinglab-0.3.5 → gratinglab-0.3.7}/src/gratinglab.egg-info/top_level.txt +0 -0
  173. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_checks.py +0 -0
  174. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_cmethod.py +0 -0
  175. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_compare.py +0 -0
  176. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_conditioning.py +0 -0
  177. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_convergence.py +0 -0
  178. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_cross_method.py +0 -0
  179. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_efficiency_table.py +0 -0
  180. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_four_way.py +0 -0
  181. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_fresnel.py +0 -0
  182. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_geometry.py +0 -0
  183. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_ggp.py +0 -0
  184. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_cmethod_options.py +0 -0
  185. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_diagram.py +0 -0
  186. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_diagram3d.py +0 -0
  187. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_integral_options.py +0 -0
  188. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_mathtext.py +0 -0
  189. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_orders.py +0 -0
  190. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_rcwa_options.py +0 -0
  191. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_richtext.py +0 -0
  192. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_scalar_options.py +0 -0
  193. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_gui_state.py +0 -0
  194. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_illumination.py +0 -0
  195. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_core.py +0 -0
  196. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_corpus.py +0 -0
  197. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_finite.py +0 -0
  198. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_graded.py +0 -0
  199. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_greens.py +0 -0
  200. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_kernels.py +0 -0
  201. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_measured_polygon.py +0 -0
  202. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_operators.py +0 -0
  203. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_integral_solver.py +0 -0
  204. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_io_boundary.py +0 -0
  205. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_littrow.py +0 -0
  206. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_materials.py +0 -0
  207. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_measured.py +0 -0
  208. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_perturbation.py +0 -0
  209. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_profiles.py +0 -0
  210. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_rayleigh_anomaly.py +0 -0
  211. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_rcwa.py +0 -0
  212. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_rcwa_benchmarks.py +0 -0
  213. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_refractiveindex.py +0 -0
  214. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_resolution.py +0 -0
  215. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_result.py +0 -0
  216. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_scalar.py +0 -0
  217. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_solver_conformance.py +0 -0
  218. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_solver_execution.py +0 -0
  219. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_solver_progress.py +0 -0
  220. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_trapezoidal_solvers.py +0 -0
  221. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_txl.py +0 -0
  222. {gratinglab-0.3.5 → gratinglab-0.3.7}/tests/test_typical.py +0 -0
@@ -0,0 +1,4 @@
1
+ # The Help pages, which setup.py copies into the wheel. A wheel is built from
2
+ # the sdist, so they have to be in it.
3
+ include docs/conventions.md
4
+ recursive-include docs/theory *.md
@@ -1,15 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gratinglab
3
- Version: 0.3.5
3
+ Version: 0.3.7
4
4
  Summary: Open platform for diffraction grating groove metrology and efficiency analysis
5
5
  Author: Jake McCoy, Aditi Gangadharan
6
- License: BSD-3-Clause
6
+ License-Expression: BSD-3-Clause
7
7
  Project-URL: Homepage, https://github.com/jamccoy/gratinglab
8
8
  Project-URL: Changelog, https://github.com/jamccoy/gratinglab/blob/master/CHANGELOG.md
9
9
  Keywords: diffraction,grating,diffraction grating,diffraction efficiency,optics,rcwa,integral method,spectroscopy,afm,metrology,blaze,groove profile,ultraviolet,infrared,x-ray
10
10
  Classifier: Development Status :: 2 - Pre-Alpha
11
11
  Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: BSD License
13
12
  Classifier: Operating System :: OS Independent
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
@@ -316,7 +315,12 @@ gratinglab-metrology-gui # straight to AFM import, blaze angles, boundary
316
315
  There are two windows, and `gratinglab-app` is the front door that asks which one
317
316
  you want. Neither is a dead end: each carries a **Go** menu that switches to the other
318
317
  and returns to the chooser (`Ctrl+Shift+M`), and switching reuses a window that is
319
- already open rather than starting a second empty copy of it. Both halves are this one package — the metrology measures a groove and the
318
+ already open rather than starting a second empty copy of it. The chooser itself carries
319
+ the same **View → Theme** and **Help** menus the two windows do, so the theme — a
320
+ setting for the whole application — and the theory pages are reachable without opening
321
+ a window first. While it is on screen it imports both windows on a background thread,
322
+ so the first open is a fifth of a second rather than the several seconds of matplotlib
323
+ and scipy imports it used to be. Both halves are this one package — the metrology measures a groove and the
320
324
  solvers compute an efficiency from the result — but the desktop layer used to ship
321
325
  them as two commands and two application bundles, the AFM one still named after the
322
326
  repository it was merged from, which made the half in regular use the half that was
@@ -373,7 +377,12 @@ hides it), and the window has one tab for each task:
373
377
  Each registered solver receives a tab generated from the solver registry, so a
374
378
  new backend appears in the window once it is registered.
375
379
 
376
- The Help menu contains the theory pages, rendered with typeset equations and tables.
380
+ The **Help** menu contains the theory pages, rendered with typeset equations and
381
+ tables. It is on every window: the conventions page fixes the angles a measured
382
+ profile is reported in, and `theory/metrology.md` describes the metrology window's
383
+ own analysis, so the AFM window needs those pages at least as much as this one does.
384
+ **Help → About GratingLab** names the authors and states which version is running and
385
+ when it was released, so a bug report can say which copy it came from.
377
386
  **View → Theme** switches between System (following the operating system), Light,
378
387
  Dark, Solarized Light, Solarized Dark and High contrast; the choice is remembered and
379
388
  applies to the metrology window too. Diffraction orders are coloured by sign, cool for
@@ -431,6 +440,25 @@ git clone https://github.com/jamccoy/gratinglab.wiki.git ../gratinglab.wiki
431
440
  .venv/bin/ruff check .
432
441
  ```
433
442
 
443
+ A full run is about 2750 tests and some minutes of every core, most of it
444
+ thousands of small solves rather than a few long ones. For the loop before a
445
+ push there is a quicker pass, which leaves out the tests that build a real Qt
446
+ window, caps the BLAS pools at one thread and runs at a lower priority:
447
+
448
+ ```bash
449
+ .venv/bin/python tools/test_fast.py
450
+ ```
451
+
452
+ It takes pytest's own arguments (`-k`, `-x`, a path), and `--gui` puts the Qt
453
+ tests back. The deselection is a marker, so plain pytest can do it too:
454
+
455
+ ```bash
456
+ .venv/bin/python -m pytest -m "not gui"
457
+ ```
458
+
459
+ Neither replaces the full suite, which CI runs on four platform and version
460
+ legs; they are for keeping an older machine usable between pushes.
461
+
434
462
  The test suite relies on three practices in particular:
435
463
 
436
464
  - **Physical self-checks.** `checks.check_reciprocity` and `checks.check_energy_balance`
@@ -271,7 +271,12 @@ gratinglab-metrology-gui # straight to AFM import, blaze angles, boundary
271
271
  There are two windows, and `gratinglab-app` is the front door that asks which one
272
272
  you want. Neither is a dead end: each carries a **Go** menu that switches to the other
273
273
  and returns to the chooser (`Ctrl+Shift+M`), and switching reuses a window that is
274
- already open rather than starting a second empty copy of it. Both halves are this one package — the metrology measures a groove and the
274
+ already open rather than starting a second empty copy of it. The chooser itself carries
275
+ the same **View → Theme** and **Help** menus the two windows do, so the theme — a
276
+ setting for the whole application — and the theory pages are reachable without opening
277
+ a window first. While it is on screen it imports both windows on a background thread,
278
+ so the first open is a fifth of a second rather than the several seconds of matplotlib
279
+ and scipy imports it used to be. Both halves are this one package — the metrology measures a groove and the
275
280
  solvers compute an efficiency from the result — but the desktop layer used to ship
276
281
  them as two commands and two application bundles, the AFM one still named after the
277
282
  repository it was merged from, which made the half in regular use the half that was
@@ -328,7 +333,12 @@ hides it), and the window has one tab for each task:
328
333
  Each registered solver receives a tab generated from the solver registry, so a
329
334
  new backend appears in the window once it is registered.
330
335
 
331
- The Help menu contains the theory pages, rendered with typeset equations and tables.
336
+ The **Help** menu contains the theory pages, rendered with typeset equations and
337
+ tables. It is on every window: the conventions page fixes the angles a measured
338
+ profile is reported in, and `theory/metrology.md` describes the metrology window's
339
+ own analysis, so the AFM window needs those pages at least as much as this one does.
340
+ **Help → About GratingLab** names the authors and states which version is running and
341
+ when it was released, so a bug report can say which copy it came from.
332
342
  **View → Theme** switches between System (following the operating system), Light,
333
343
  Dark, Solarized Light, Solarized Dark and High contrast; the choice is remembered and
334
344
  applies to the metrology window too. Diffraction orders are coloured by sign, cool for
@@ -386,6 +396,25 @@ git clone https://github.com/jamccoy/gratinglab.wiki.git ../gratinglab.wiki
386
396
  .venv/bin/ruff check .
387
397
  ```
388
398
 
399
+ A full run is about 2750 tests and some minutes of every core, most of it
400
+ thousands of small solves rather than a few long ones. For the loop before a
401
+ push there is a quicker pass, which leaves out the tests that build a real Qt
402
+ window, caps the BLAS pools at one thread and runs at a lower priority:
403
+
404
+ ```bash
405
+ .venv/bin/python tools/test_fast.py
406
+ ```
407
+
408
+ It takes pytest's own arguments (`-k`, `-x`, a path), and `--gui` puts the Qt
409
+ tests back. The deselection is a marker, so plain pytest can do it too:
410
+
411
+ ```bash
412
+ .venv/bin/python -m pytest -m "not gui"
413
+ ```
414
+
415
+ Neither replaces the full suite, which CI runs on four platform and version
416
+ legs; they are for keeping an older machine usable between pushes.
417
+
389
418
  The test suite relies on three practices in particular:
390
419
 
391
420
  - **Physical self-checks.** `checks.check_reciprocity` and `checks.check_energy_balance`
@@ -0,0 +1,525 @@
1
+ # Conventions
2
+
3
+ This document is normative: every solver backend, importer, and exporter in
4
+ `gratinglab` obeys it. Where an external code or a source paper disagrees with it, the
5
+ difference is absorbed in an adapter at the boundary and never inside a solver.
6
+
7
+ Projects that compare methods most often fail on conventions. Two codes that disagree
8
+ by a sign in the grating equation, or by an obliquity factor, produce plots that appear
9
+ to show a physical result but in fact reflect a bookkeeping error. These choices are
10
+ therefore fixed once, in this document, and are not revisited in code review.
11
+
12
+ ---
13
+
14
+ ## 1. Units
15
+
16
+ At the public API boundary, every length is in nanometres and every angle is in degrees.
17
+
18
+ | Quantity | Unit |
19
+ |---|---|
20
+ | Wavelength λ | nm |
21
+ | Period p | nm |
22
+ | Groove depth, coating thickness, RMS roughness σ | nm |
23
+ | All angles (α, β, γ, δ, ζ) | degrees |
24
+ | Wavenumber k = 2π/λ | nm⁻¹ |
25
+
26
+ Nanometres give human-readable magnitudes in both target regimes: soft X-ray work uses
27
+ λ ≈ 0.6–5 nm with p ≈ 150–350 nm, and visible work uses λ ≈ 400–700 nm with
28
+ p ≈ 1400 nm. In micrometres, soft-X-ray wavelengths would sit at 6 × 10⁻⁴, which is
29
+ error-prone both to read and to type.
30
+
31
+ Angles are given in degrees at the API and held in radians internally, and the
32
+ conversion happens once, at construction. No function takes an angle whose unit is
33
+ ambiguous from its name.
34
+
35
+ ### Inside the metrology package
36
+
37
+ `gratinglab.metrology` reads instrument files, and instruments do not report in
38
+ nanometres. Four unit regimes therefore coexist in this package, each confined to its
39
+ own layer:
40
+
41
+ | Where | Unit | Set by |
42
+ |---|---|---|
43
+ | `core.processing.load_afm_data` returns heights | **metres** | the file formats (Nanoscope and Gwyddion both write SI) |
44
+ | lateral axis, scan width | **µm** | the same file formats, and the unit an AFM operator works in |
45
+ | `raw_data` onward, profile heights | **nm** | the project convention above |
46
+ | `BoundaryProfile.x_norm` / `y_norm`, and `.ggp` | **dimensionless**, fraction of the period | PCGrate's polygonal border |
47
+
48
+ Conversion occurs in exactly two places: `raw_data` (metres → nm) and
49
+ `normalize_profile` (nm → fraction of period). No function accepts a length whose
50
+ regime is ambiguous from its name, which is why the fields are named `y_avg_nm`,
51
+ `x_avg_um` and `y_norm` instead of all three being called `y`.
52
+
53
+ Because the normalised layer expresses heights as fractions of the period, the period
54
+ must be carried separately. `y_norm` is a fraction of the period, so physical depth is
55
+ `y_norm × period`. An incorrect period therefore produces an incorrect groove depth,
56
+ and groove depth enters the scalar phase term directly instead of serving only as a
57
+ label on the result. `BoundaryProfile.to_problem` carries the measured period for this
58
+ reason; a `.ggp` file cannot carry it.
59
+
60
+ ---
61
+
62
+ ## 2. Time convention and the sign of the extinction coefficient
63
+
64
+ The time dependence is `exp(-iωt)`, and a plane wave is written
65
+
66
+ $$\mathbf{E}(\mathbf{r}, t) = \mathbf{E}_0 e^{i\mathbf{k}\cdot\mathbf{r}} e^{-i\omega t}$$
67
+
68
+ This follows McCoy, *Scalar Treatment of Diffraction Gratings* (2022), slide 7, and the
69
+ thesis throughout.
70
+
71
+ The consequence of this choice, and the only part of this section that most readers
72
+ need, is that a lossy material has
73
+
74
+ $$n = n' + i k, \qquad k > 0$$
75
+
76
+ The opposite time convention `exp(+iωt)` would require `n = n' - ik`. Optical constant
77
+ tables must be checked against this convention on import. CXRO/Henke tables give δ and
78
+ β with `n = 1 - δ + iβ`, which is already correct for `exp(-iωt)` with β > 0.
79
+ refractiveindex.info gives `n` and `k` with `k ≥ 0`, which is also already in this
80
+ convention; the few negative `k` values in its database (round-off, or Kramers-Kronig
81
+ artifacts) are clipped to zero on import and recorded in the table's `source`.
82
+
83
+ ---
84
+
85
+ ## 3. Coordinate frame
86
+
87
+ The coordinate frame is right-handed and follows Heilmann, Huenemoerder, McCoy &
88
+ McEntaffer (2024), §2.1:
89
+
90
+ | Vector | Direction | Meaning |
91
+ |---|---|---|
92
+ | `d̂` | `x̂` | dispersion direction; periodicity is along this axis |
93
+ | `n̂` | `ŷ` | grating normal, pointing into the vacuum half-space |
94
+ | `ĝ` | `-ẑ` | groove direction; grooves run along this axis |
95
+
96
+ with `d̂ × ĝ = n̂`.
97
+
98
+ The grating surface occupies `y ≤ g(x)`, where `g(x + p) = g(x)` is the groove profile.
99
+ Vacuum (or the incident medium) is `y > g(x)`.
100
+
101
+ ### Wave vectors
102
+
103
+ $$\mathbf{k}_i = k\left[-\sin\alpha\,\sin\gamma\,\hat{x} - \cos\alpha\,\sin\gamma\,\hat{y} + \cos\gamma\,\hat{z}\right]$$
104
+
105
+ $$\mathbf{k}_m = k\left[\sin\beta_m\,\sin\gamma\,\hat{x} + \cos\beta_m\,\sin\gamma\,\hat{y} + \cos\gamma\,\hat{z}\right]$$
106
+
107
+ The incident wave travels toward the grating (negative ŷ component), and reflected
108
+ orders travel away from it (positive ŷ component). `k_z` is conserved for all orders.
109
+
110
+ Every wave vector carries `k_z = +k cos γ > 0` for γ < 90°, so all propagation is
111
+ toward `−ĝ`. The choice `ĝ = −ẑ` in the frame table is forced by `d̂ × ĝ = n̂` and is
112
+ not a free choice.
113
+
114
+ ### Angles
115
+
116
+ - **α**: azimuthal angle of incidence, measured from the grating normal `n̂` in the
117
+ plane containing `n̂` and `d̂`. Its range is α ∈ (−90°, 90°), enforced by
118
+ `Illumination`, because an incidence angle at or past grazing carries no power onto
119
+ the grating.
120
+ - **β_m**: azimuthal angle of diffracted order *m*, measured from the same reference.
121
+ - **γ**: half-angle of the diffraction cone about the groove axis. The cone's axis is
122
+ the groove-axis line, and γ is the acute angle between a wave vector and that line.
123
+ γ is the angle that sweeps out the cone, and α gives the azimuthal position around it.
124
+
125
+ Stated as a directed angle, γ is the polar angle in the spherical system whose pole
126
+ is `+ẑ = −ĝ`, since every wave vector above carries `k_z = +k cos γ`. At γ = 1.5°,
127
+ for example, every ray lies 1.5000° from `+ẑ` and 178.5000° from `ĝ`, so the cone
128
+ opens along `−ĝ` and not along `ĝ`. A drawing that opens it along `ĝ` places every
129
+ ray 180° out. Code that consumes γ only through the scalars `sin γ` / `cos γ` cannot
130
+ detect the difference, which is why this convention went unstated until something had
131
+ to draw the cone (see `docs/findings.md`).
132
+
133
+ In operational terms, `k_z = k cos γ` is conserved, and `sin γ = 1` (γ = 90°) is the
134
+ in-plane case. Extreme off-plane mounts have small γ, and the soft-X-ray work uses
135
+ γ ≈ 1.5°. The range is γ ∈ (0°, 90°], enforced by `Illumination`: γ = 90° is the
136
+ in-plane case, and γ = 0° would send the wave along the grooves, which produces no
137
+ diffraction.
138
+ - **δ**: groove-facet (blaze) angle of a sawtooth profile.
139
+ - **ζ**: graze angle onto the groove facet, `sin ζ = sin γ · cos(δ - α)`.
140
+
141
+ The geometry is stored as direction cosines instead of angles (see `Illumination`). The
142
+ three constructors (`classical`, `conical`, `offplane`) allow each community to pass
143
+ the angles it uses, and all three resolve to the same internal representation.
144
+
145
+ ### Direction of the profile parameter
146
+
147
+ $$\hat{t} = -\hat{d}$$
148
+
149
+ `Profile.height(t)` describes a shape in a normalised parameter `t`. `gratinglab.profiles` does
150
+ not state which physical direction `+t` points in, because nothing required it until a
151
+ profile and a ray were drawn in the same frame. The wave conventions above determine
152
+ it: `+t` runs along `-d̂`, that is, against the dispersion direction.
153
+
154
+ Two independent derivations give this result.
155
+
156
+ **From the blaze direction.** `geometry.blaze_direction` returns `β_b = 2δ - α`.
157
+ Reflecting the projected incident direction `(-sin α, -cos α)` about a facet with
158
+ outward normal `n̂_f` gives `sin β = sin(2δ - α)` for `n̂_f = (+sin δ, cos δ)`, and
159
+ `sin β = -sin(2δ + α)` for `n̂_f = (-sin δ, cos δ)`. At the reference geometry
160
+ (δ = 29.5°, α = 25°) these give +34.0° and −84.0° respectively. The active facet's
161
+ outward normal therefore sits at azimuth `+δ`, which means that the facet descends with
162
+ increasing `x`. However, `Blazed.slope()` returns `+tan δ` for `t ≤ apex`, so the
163
+ active facet rises with `t`. A facet that rises in `t` and descends in `x` implies
164
+ `t̂ = -d̂`.
165
+
166
+ **From the Kirchhoff integral.** `solvers/scalar.py` forms
167
+ `G_m = ∫ e^{+iΦ_m(t)} e^{-2πimt} dt`, whereas the time convention of §2 and the `k`
168
+ vectors above give `∫ e^{-iΦ_m(t)} e^{-2πimt} dx/p` when `t ↔ +x`. Substituting
169
+ `t ↔ -x` maps one integral onto the complex conjugate of the other.
170
+
171
+ No numerical result depends on this choice. Conjugation leaves `|G_m|²`, the only
172
+ quantity any caller consumes, bit-identical, which is why the convention remained
173
+ consistent but unstated for so long. It matters only where a drawing places a facet
174
+ relative to a ray. If the direction is reversed, the incident beam strikes the
175
+ anti-blaze facet and the blaze arrow leaves through the back of the active facet.
176
+
177
+ The relation is recorded here instead of being enforced by flipping the signs in
178
+ `scalar.py`. That change would also preserve the modulus, but it would move the
179
+ module's headline formula away from the form transcribed from the two primary
180
+ references. The references themselves state no handedness and quote only `|G_m|²`; this
181
+ omission is itself the finding. The behaviour is pinned by
182
+ `tests/test_geometry.py::TestFacetHandedness`; see also `docs/findings.md`.
183
+
184
+ Not every consumer takes only `|G_m|²`. The integral solver places the curve
185
+ itself, and through 0.1.12 it placed it at `x = t P`, solving every asymmetric
186
+ groove as its mirror image. It now places it at `x = (1 − t) P`
187
+ (`solvers/integral/_boundary.py`), and
188
+ `tests/test_cross_method.py::TestAgreementOnAnAsymmetricGroove` holds both
189
+ solvers to the same blaze order. Files that run along `+d̂`, PCGrate's `.ggp`
190
+ and the metrology pipeline's `x_norm`, cross into `t` in one place,
191
+ `FromProfileData.along_dispersion` and its inverse `dispersion_axis`, as the
192
+ preamble of this document requires of an external convention.
193
+
194
+ #### Alternate names in the literature
195
+
196
+ Two naming conflicts in the literature are described here so that neither is resolved
197
+ silently.
198
+
199
+ In spherical coordinates with the groove axis as the pole, γ is strictly the polar
200
+ angle and α is azimuthal. The off-plane-grating literature, however, often calls α "the
201
+ polar" or "the incidence" angle. In the classical special case (in-plane, γ = 90°), α is
202
+ the ordinary incidence angle measured from the grating normal, and that name is carried
203
+ into the conical case by habit. Both usages exist; this document uses the strict
204
+ spherical reading.
205
+
206
+ Some sources parametrize the cone by its complement. Where this document uses γ
207
+ directly (small γ = grazing, γ = 90° = in-plane), others use `φ ≡ 90° − γ` (small φ =
208
+ in-plane, φ = 0° = grazing), and correspondingly may write `θ` where this document
209
+ writes `α`. The translation is as follows:
210
+
211
+ | Here | Elsewhere | Relation |
212
+ |---|---|---|
213
+ | α | θ | same angle |
214
+ | γ | φ | `φ ≡ 90° − γ`, so `sin γ = cos φ` |
215
+
216
+ The `θ` in this table is unrelated to `θ_c`, the total-external-reflection critical
217
+ angle used elsewhere in this project (`docs/theory/scalar.md` §7). The two never appear
218
+ in the same equation, but a reader of both documents should not conflate them.
219
+
220
+ ### Conformal layers
221
+
222
+ `Problem.layers` lists the layers on a coated grating, innermost first. Layer
223
+ `k` occupies every point within its `thickness` of the surface beneath it and
224
+ outside that surface, so its outer surface is the true offset of the one below
225
+ along the normal: a convex corner becomes an arc of radius `thickness` and a
226
+ concave corner stays sharp (decided 2026-10-27, as the closest description of
227
+ an evaporated or sputtered film). Thickness is in nm, like every length here.
228
+ `coating` (or `substrate`) remains the material the grating is cut into. A
229
+ solver that cannot model layers refuses a problem that has any
230
+ (`Capabilities.handles_layers`).
231
+
232
+ ---
233
+
234
+ ## 4. The grating equation
235
+
236
+ $$\sin\alpha + \sin\beta_m = \frac{m\lambda}{p\,\sin\gamma}, \qquad m = 0, \pm1, \pm2, \dots$$
237
+
238
+ This is the *generalized (conical) grating equation*, ISSI eq. (7), which reduces to the
239
+ familiar in-plane form at `sin γ = 1`. It is the only form used internally.
240
+
241
+ The sign convention is the `+ sin β_m` form: reflected orders with `m > 0` diffract to
242
+ the side of specular reflection given by increasing `sin β_m`.
243
+
244
+ Transmission gratings are sometimes written `mλ/p = sin α − sin β_m` by redefining
245
+ `β_m → β_m − π`. This redefinition is not used internally. A transmitted order keeps
246
+ the same convention and is identified by `cos β_m < 0`, and the R/T flag is carried
247
+ explicitly on the order record.
248
+
249
+ ### Propagating orders
250
+
251
+ Order *m* propagates if and only if
252
+
253
+ $$\left|\frac{m\lambda}{p\,\sin\gamma} - \sin\alpha\right| \leq 1$$
254
+
255
+ which is `|sin β_m| ≤ 1` with `sin β_m` taken from the equation above, and is what
256
+ `geometry.is_propagating(geometry.sin_beta(...))` computes. Mind the sign on
257
+ `sin α`: the mirrored form `|sin α + mλ/(p sin γ)| ≤ 1` describes a different
258
+ mount, and stood here until 2026-10-30 (`findings.md`, "The June 2017 SCIL
259
+ campaign", for what it cost). `tests/test_geometry.py::TestTheDocumentedPropagationTest`
260
+ pins the prose and the code together.
261
+
262
+ Orders that fail this condition are evanescent. They are retained in the record with
263
+ `efficiency = 0.0` and `propagating = False`; they are never dropped silently and never
264
+ represented as `NaN`. Dropping them would shift order indices between wavelengths,
265
+ which is the single most common source of off-by-one errors in scan post-processing.
266
+ (The existing prototype scripts index efficiency columns as `data[i+11]`, and this rule
267
+ prevents that kind of fragility.)
268
+
269
+ ---
270
+
271
+ ## 5. Efficiency normalization
272
+
273
+ Efficiencies are absolute, referenced to the power incident on the grating:
274
+
275
+ $$\mathscr{E}_m = \frac{I(m)}{I_0}$$
276
+
277
+ This matches PCGrate's `Eff.TE(m,R)` columns, so the on-disk reference corpus imports
278
+ without rescaling.
279
+
280
+ Relative (referenced-to-mirror) efficiency is available as a derived quantity but is
281
+ never the default. At γ = 1.5° the difference between absolute and relative efficiency
282
+ is a large factor, and mislabelling one as the other silently invalidates a throughput
283
+ budget.
284
+
285
+ For a lossless structure, `Σ_m over propagating E_m = 1`, and this identity is asserted
286
+ in the tests.
287
+
288
+ ### Energy conservation as a check
289
+
290
+ Energy balance is treated asymmetrically, according to two rules:
291
+
292
+ - **A deficit is ordinary.** Power may go into absorption or into evanescent orders, or
293
+ an approximate method may fail to capture it.
294
+ - **An excess is not ordinary.** No passive grating returns more power than it
295
+ receives, whatever method is used to compute it. By default
296
+ `checks.check_energy_balance` enforces only this weaker condition, because it has no
297
+ legitimate exception. This check identified the unphysical finite-conductivity run in
298
+ the reference corpus, in which the sum reached 3.6.
299
+
300
+ Scalar theory as normally written does not conserve energy, and this is accepted as a
301
+ deliberate trade-off. With the order-dependent phase of ISSI eq. (15) and thesis
302
+ Appendix-D.tex:651, the summed efficiency deviates from unity in both directions, with
303
+ measured values up to 1.61 across a broad parameter sweep.
304
+
305
+ An alternative exists and was rejected. Dropping `cos β_m` from the phase restores a
306
+ genuine Fourier pair and conserves energy to 1e-10, but it violates Lorentz reciprocity
307
+ (measured 0.44) and reproduces the blaze direction only at Littrow. Reciprocity requires
308
+ the phase to be symmetric under `α ↔ β_m`, whereas Parseval requires a single fixed
309
+ function that excludes `β_m`, so the two cannot hold together. Reciprocity is the
310
+ invariant that is kept.
311
+
312
+ The deviation does not indicate a fault in the implementation: in the shallow-groove
313
+ limit the sum is exactly 1.00000, and it degrades smoothly with depth (0.0001 → 1.00000;
314
+ 0.10 → 0.92902). The deviation scales with the phase excursion across the groove, that
315
+ is, with depth relative to wavelength and hence with working order. It does not scale
316
+ with λ/p or with the number of propagating orders.
317
+
318
+ The full derivation and evidence are given in [`theory/scalar.md`](theory/scalar.md) §5.
319
+
320
+ The deviation is reported and never rescaled; it is recorded as a `Provenance` warning.
321
+ The extent to which an approximate theory departs from a conservation law is what a
322
+ scalar validity map should show, and normalising the deviation away would destroy that
323
+ information.
324
+
325
+ ### The symmetric obliquity factor
326
+
327
+ Thesis Appendix D includes two factors that ISSI §2.1 does not. One of them has a
328
+ correct counterpart and the other does not:
329
+
330
+ | Form | Source | Status |
331
+ |---|---|---|
332
+ | `E_m = O_m ‖G_m‖²`, `O_m = 4 cos α cos β_m / (cos α + cos β_m)²` | first-order Rayleigh perturbation theory | **correct; what the code does** |
333
+ | `E_m = ‖G_m‖²` | ISSI §2.1, eq. groove_func | wrong by `1/O_m`; up to 64% off |
334
+ | `E_m ∝ [cos β_m / cos α] ‖G_m‖²` | thesis Appendix-D.tex:418 | removed: asymmetric, breaks reciprocity |
335
+ | renormalise so `Σ_m E_m = 1` | thesis Appendix-D.tex:420 | removed as an error |
336
+
337
+ The two factors differ in their symmetry. Appendix D's `cos β_m / cos α` is asymmetric
338
+ under `α ↔ β_m` and does violate Lorentz reciprocity, which is why it was rejected. The
339
+ conclusion that was then drawn, that the efficiency is the norm-squared Fourier
340
+ coefficient alone, went one step too far. `O_m` is symmetric, so reciprocity is
341
+ unaffected by it, and it is the factor that brings the shallow-groove limit into
342
+ agreement with a theory derived from the boundary condition instead of from a
343
+ transmittance function. See [`theory/scalar.md`](theory/scalar.md) §3 and
344
+ [`tests/test_perturbation.py`](../tests/test_perturbation.py).
345
+
346
+ By the AM–GM inequality `O_m ≤ 1`, and it equals 1 exactly at Littrow, at specular, and
347
+ for every `m = 0`. It can therefore only reduce an efficiency, and it leaves the
348
+ shallow-limit energy identity unchanged.
349
+
350
+ The renormalization has no comparable justification, since forcing the sum to unity
351
+ would erase the signal described above. It is not offered as an option, because an
352
+ error offered as a choice invites misuse.
353
+
354
+ ---
355
+
356
+ ## 6. Wave-vector signs
357
+
358
+ Wave-vector components are always stored with their signs:
359
+
360
+ - `k_y,i < 0`: the incident wave travels toward the grating.
361
+ - `k_y,m > 0`: the reflected order travels away from it.
362
+ - `k_y,m` is purely imaginary for an evanescent order.
363
+
364
+ Efficiency is formed from magnitudes:
365
+
366
+ $$\mathscr{E}_m = \frac{|k_{y,m}|}{|k_{y,i}|}\left\|\frac{A_m}{A_0}\right\|^2 = \frac{\cos\beta_m}{\cos\alpha}\left\|\frac{A_m}{A_0}\right\|^2$$
367
+
368
+ The convention is stated because the source material is ambiguous about it. In the
369
+ thesis, the Green's-theorem derivation at Chapter-2.tex:1006–1007 yields the stated
370
+ result only if `k_y < 0` for the incident wave, while the equation at line 905 writes `k''_{y,n}/k_y ≡
371
+ cos β / cos α`, which requires `k_y > 0`. Each can be recovered consistently with care,
372
+ but an ambiguity of this kind can flip a sign in code without causing any visible
373
+ failure.
374
+
375
+ The rule is therefore that the fields use signed components and the efficiency ratio
376
+ uses magnitudes. Any solver that needs the unsigned value writes `abs()` explicitly.
377
+
378
+ ---
379
+
380
+ ## 7. Polarization
381
+
382
+ - **TE**: electric field parallel to the grooves (`ĝ`).
383
+ - **TM**: magnetic field parallel to the grooves.
384
+ - **Unpolarized**: `(TE + TM) / 2`, computed and never assumed.
385
+
386
+ In conical mounts, TE and TM are defined with respect to the grooves and not with
387
+ respect to the plane of incidence; the two definitions coincide only in-plane. This is
388
+ stated explicitly because the other convention is common in the RCWA literature and is
389
+ a frequent source of cross-code disagreement in conical geometry.
390
+
391
+ In the `(E_z, B_z)` basis of the conical field decomposition (grooves along z), TE is a
392
+ pure incident `E_z` state (`(p_z, q_z) = (1, 0)`; Goray & Schmidt's "`B_z = 0`") and TM
393
+ is a pure incident `B_z` state (`(0, 1)`; their "`E_z = 0`"), and each reduces to the
394
+ in-plane definition above. With finite conductivity, a pure incident state diffracts
395
+ into orders that carry both components, since cross-polarization conversion does occur
396
+ off-plane. The per-order efficiency is then the flux-weighted sum
397
+ `(γ_m/γ₀)(|E_m|² + |B_m|²)`, which gives one number per order. The conversion is
398
+ identically zero only for a perfect conductor.
399
+
400
+ At grazing incidence in the soft X-ray, reflectivity is nearly polarization-independent
401
+ (thesis §C.1.2), which is why the existing PCGrate corpus carries only `Eff.TE`. That
402
+ approximation is justified in that regime but not in general, and it is not built into
403
+ the core.
404
+
405
+ ---
406
+
407
+ ## 8. Symbols
408
+
409
+ The two primary references use `d` for two different quantities:
410
+
411
+ | Symbol | McCoy thesis | ISSI chapter | **gratinglab** |
412
+ |---|---|---|---|
413
+ | period | `d` | `p` | **`period`** |
414
+ | groove depth | `h₀` | `d` | **`depth`** |
415
+ | blaze / facet angle | `δ` | `δ` | `blaze_angle` |
416
+ | facet graze angle | `ζ` | `ζ` | `facet_graze` |
417
+ | order index | `n` | `m` | `order` |
418
+ | index decrement | `δ` | `δ` | **`decrement`** |
419
+ | index absorption | `β` | `β` | **`absorption`** |
420
+
421
+ The last two rows present the same problem in a second place. The optics literature
422
+ writes `n = 1 - δ + iβ`, but both letters already have meanings in this project: `δ` is
423
+ the blaze angle and `β` is the diffracted-order angle throughout. `fresnel.reflectivity`
424
+ is called a few lines from `facet_graze(gamma, blaze_angle, alpha)`, and two meanings of
425
+ `δ` within one call stack would allow a sign error to be written without being noticed.
426
+ The materials layer therefore uses unambiguous names.
427
+
428
+ Bare `d` never appears in the code, whether as a variable, as a keyword argument, or in
429
+ a docstring formula without an accompanying definition. When an equation is transcribed
430
+ from either source, the first step is to rewrite `d` explicitly as `period` or `depth`.
431
+
432
+ ---
433
+
434
+ ## 9. Reference formulas, in gratinglab symbols
435
+
436
+ For an ideal sawtooth (blazed) reflection grating:
437
+
438
+ | Quantity | Formula |
439
+ |---|---|
440
+ | Facet depth | `depth = period · tan(blaze_angle)` |
441
+ | Facet graze angle | `sin ζ = sin γ · cos(blaze_angle − α)` |
442
+ | Sawtooth phase shift | `φ = k · depth · sin γ · [cos α + cos β_m]` |
443
+ | Flux obliquity | `O_m = 4 cos α cos β_m / (cos α + cos β_m)²` |
444
+ | Scalar DE | `E_m = O_m · sinc²(φ/2 − mπ)`, `sinc(x) ≡ sin(x)/x` |
445
+ | Blaze direction | `β_b = 2·blaze_angle − α` |
446
+ | Blaze wavelength | `m·λ_b = 2·period·sin ζ·sin(blaze_angle)` |
447
+ | Finite-N interference | `[sin(Ns)/(N sin s)]²`, `s ≡ [sin α + sin β_m]·sin γ·period·π/λ` |
448
+ | Resolving power (Rayleigh) | `R = |m|·N`; `Δλ = λ/R`. `N` is the illuminated groove count |
449
+
450
+ The phase shift includes the factor `sin γ`. The thesis expression at
451
+ Appendix-D.tex:651 omits it and is inconsistent with the thesis's own Φ_b at line 672,
452
+ which includes it. The thesis form is the in-plane special case and is valid only under
453
+ the substitution `λ → λ csc γ` introduced at line 446. This project uses the ISSI form,
454
+ which is general.
455
+
456
+ The finite-N factor is retained deliberately. Appendix D drops it in the `N → ∞` limit,
457
+ but the factor links efficiency to resolving power and therefore belongs in the API,
458
+ where it is now provided as `gratinglab.resolution`, with the factor itself in
459
+ `gratinglab.geometry`. The Rayleigh row above is derived from it. The first zeros sit at
460
+ `s = mπ ± π/N`, and placing the peak of one wavelength on the first zero of the other
461
+ gives `m·Δλ = λ/N` in any mount, because `sin γ` scales the line width and the
462
+ dispersion equally.
463
+
464
+ ### Scalar validity guards
465
+
466
+ The following guards are reported alongside any scalar result:
467
+
468
+ - **Reduced wavelength ratio:** `λ/(period · sin γ) ≲ 0.1`. The smallness that scalar
469
+ theory requires is judged at the reduced wavelength `λ/sin γ`, which is the wavelength
470
+ of the transverse problem posed by the grooves (the same decoupling on which the
471
+ integral method relies). It is not judged at `λ/period`, because that ratio passes
472
+ extreme off-plane mounts that lie far outside the regime. In-plane, the two coincide.
473
+ - **Total external reflection** (ISSI §4): `θ_c ≈ √(2δ_n)`; the model is meaningful
474
+ only for `ζ < θ_c`.
475
+ - **Fraunhofer smoothness** (ISSI §4): `λ > 32 · sin(ζ) · σ`.
476
+
477
+ A scalar result outside these bounds is returned with a warning flag on its provenance
478
+ record instead of being suppressed. Mapping where scalar theory breaks down is one of
479
+ the project's deliverables, so out-of-bounds values must remain available for
480
+ inspection.
481
+
482
+ ---
483
+
484
+ ## 10. Deviations from source references
485
+
486
+ The deviations below are recorded so that a deliberate choice is not reverted to match
487
+ a source that is in error.
488
+
489
+ | # | Source | Issue | Our choice |
490
+ |---|---|---|---|
491
+ | 1 | thesis Appendix-D.tex:651 | `Φ_g` missing `sin γ` | ISSI eq. (15) form |
492
+ | 2 | thesis Appendix-D.tex:418, 420 | obliquity factor `cos β/cos α`, plus renormalization so `Σ E = 1` | renormalization removed, and not available as an option. The obliquity factor is removed in that form (it is asymmetric, so it breaks reciprocity) and replaced by the symmetric `O_m` of §5, which perturbation theory requires |
493
+ | 2a | ISSI §2.1, groove function | `E_m = ‖G_m‖²` with no flux factor at all | wrong by `1/O_m`, by up to 64% away from Littrow. This is the one place where this project's normative reference is the source in error; see `theory/scalar.md` §3 for the evidence, which is independent of both sources |
494
+ | 3 | thesis Appendix-D.tex:699 | `∂Φ_b/∂α` missing factor `period` (dimensionally required) | corrected |
495
+ | 4 | thesis Appendix-D.tex:462, 622 | `for n = 0, ±1, …` on expressions singular at `n = 0` | `G₀` stated separately: `A₀·𝒲/period` (square), `A₀/2` (sawtooth) |
496
+ | 5 | thesis Chapter-2.tex:1016, 1045 | claims PCGrate internally multiplies by Fresnel reflectivity in perfect-conductivity mode, which contradicts the `ΣE = 1` result proved just above | Treat `ΣE ≈ R_F(ζ)` as an emergent result of an impedance-type (Leontovich) boundary condition. Follow Goray & Schmidt (2010) for the rigorous finite-conductivity case |
497
+ | 6 | thesis Chapter-2.tex:1006–1007 | `A_n'` should be `A_n''`; evanescent exponential missing its `y` | corrected |
498
+ | 7 | thesis Chapter-2.tex:905 vs 1006 | inconsistent `k_y` sign convention | §6 above |
499
+ | 8 | PyXFocus `grating.py` (`62454cd`), `blazeYaw`, `blazeAngle`, `blazeAngle2`, `litBetaAlpha` | a different frame, not an error: `inc` is the graze onto the grating surface, `sin inc = sin γ cos α`, and the yaw ψ is the beam's projection on the surface measured from the grooves, `tan ψ = sin γ sin α / cos γ`. Its dispersion cosine is signed opposite to ours, so `blazeAngle` returns −α where `blazeAngle2` returns α. `litBetaAlpha`'s "cone angle" `beta1` is `cos γ`, not γ | `geometry.littrow_alpha` in (α, γ); the mapping is pinned from direction cosines in `tests/test_littrow.py`, never by equating `cos inc` with `sin γ`, which is wrong by up to ~1 at grazing incidence |
500
+
501
+ Items 3, 4, 6 are transcription errors with no effect on published results. Items 1, 2,
502
+ 5, 7 change what the code computes. Item 8 is no error at all, only a second frame, and
503
+ is recorded because the obvious reading of it is wrong.
504
+
505
+ ---
506
+
507
+ ## 11. Adapters
508
+
509
+ External formats are converted at the boundary, and an adapter is the only place in
510
+ which a foreign convention may appear.
511
+
512
+ | Format | Direction | Notes |
513
+ |---|---|---|
514
+ | PCGrate-SX `.txt` efficiency tables | import | 7 header lines; tab-separated; quoted `"Eff.TE(m,R)"` headers carry the order index and R/T flag; `--` marks missing/evanescent. Order mapping comes from the headers, never from a column offset |
515
+ | CXRO / Henke optical constants | import | `(energy_eV, δ, β)` → `n = 1 − δ + iβ` on a wavelength grid |
516
+ | refractiveindex.info YAML | import | Wavelength in µm. `n` and `k` tabulated, or `n` from one of nine dispersion formulas sampled adaptively to 1e-7; stored as `decrement = 1 − n`, `absorption = k`, so a glass has a negative decrement. `tabulated n2` is the nonlinear Kerr index and is refused |
517
+ | PCGrate `.ari` refractive index | export | `wavelength_nm δ β`, space-delimited |
518
+ | PCGrate `.ggp` border profile | import + export | Normalised: `t` on [0,1], `y` as a fraction of the period. Carries a period but not its unit, and no provenance and no version. All five border profile types are read (10, p. 59), selected by the first control string's type code: `0 n` trapezoidal (general, lamellar, triangular, sawtooth), `1 n` sine trapezoidal (general, sinusoidal), `2 0` trigonometric, `3 0` polygonal; section-dependent is refused, carrying no code in any known file. The analytic types arrive as `t`/`y` like the polygonal one, with their parameters alongside. Only the polygonal type is written: the points alone by default, and `header=True` writes the pair 10.2.2 (p. 63) specifies, `3 0 - 20 harmonics - Polygonal type` then `Period: 1 PSC: 1`. Five control-string variants exist on disk; all are read. Polygonal geometry: between 2 and 5000 data strings, x on [0,1] non-decreasing, y on [0,100], first point `0 0`, last `1 0` (10.2.3, p. 63). A measured profile should instead reach a solver through `BoundaryProfile.to_problem`, which keeps the period *and* its unit |
519
+ | Nanoscope `.spm` (AFM) | import | Binary. Heights in metres. The `Sens. Zsens` / `Sens. ZsensSens` distinction is load-bearing: the wrong one gives heights 5.13× too small |
520
+ | Gwyddion text export (AFM) | import | 4 header lines, tab-separated, heights in metres, scan width scraped from the header comments |
521
+ | GSolver, RETICOLO | planned | |
522
+
523
+ Round-tripping a `Problem` through an adapter and back must leave it unchanged. This
524
+ requirement is enforced by a test, which catches sign and normalization errors before
525
+ any physics is written.