gratinglab 0.4.0__tar.gz → 0.4.1__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 (250) hide show
  1. {gratinglab-0.4.0/src/gratinglab.egg-info → gratinglab-0.4.1}/PKG-INFO +20 -7
  2. {gratinglab-0.4.0 → gratinglab-0.4.1}/README.md +19 -6
  3. gratinglab-0.4.1/docs/theory/mirror.md +169 -0
  4. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/__init__.py +2 -2
  5. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/docs.py +3 -0
  6. gratinglab-0.4.1/src/gratinglab/gui/materials_view.py +141 -0
  7. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/mirror_view.py +89 -24
  8. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/geometry_panel.py +49 -14
  9. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/launcher.py +64 -2
  10. gratinglab-0.4.1/src/gratinglab/gui/qt/library_bar.py +162 -0
  11. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/main_window.py +15 -3
  12. gratinglab-0.4.1/src/gratinglab/gui/qt/materials_tab.py +262 -0
  13. gratinglab-0.4.1/src/gratinglab/gui/qt/mirror_tab.py +315 -0
  14. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/setup_tab.py +29 -156
  15. gratinglab-0.4.1/src/gratinglab/gui/qt/stack_editor.py +242 -0
  16. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/__init__.py +16 -0
  17. {gratinglab-0.4.0 → gratinglab-0.4.1/src/gratinglab.egg-info}/PKG-INFO +20 -7
  18. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab.egg-info/SOURCES.txt +7 -0
  19. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_factors.py +3 -0
  20. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_docs.py +5 -0
  21. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_launcher.py +41 -2
  22. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_qt.py +63 -22
  23. gratinglab-0.4.1/tests/test_gui_stack_editor.py +105 -0
  24. gratinglab-0.4.1/tests/test_materials_view.py +131 -0
  25. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_mirror_view.py +48 -4
  26. gratinglab-0.4.0/src/gratinglab/gui/qt/mirror_tab.py +0 -212
  27. {gratinglab-0.4.0 → gratinglab-0.4.1}/LICENSE +0 -0
  28. {gratinglab-0.4.0 → gratinglab-0.4.1}/MANIFEST.in +0 -0
  29. {gratinglab-0.4.0 → gratinglab-0.4.1}/docs/conventions.md +0 -0
  30. {gratinglab-0.4.0 → gratinglab-0.4.1}/docs/theory/cmethod.md +0 -0
  31. {gratinglab-0.4.0 → gratinglab-0.4.1}/docs/theory/integral.md +0 -0
  32. {gratinglab-0.4.0 → gratinglab-0.4.1}/docs/theory/metrology.md +0 -0
  33. {gratinglab-0.4.0 → gratinglab-0.4.1}/docs/theory/rcwa.md +0 -0
  34. {gratinglab-0.4.0 → gratinglab-0.4.1}/docs/theory/scalar.md +0 -0
  35. {gratinglab-0.4.0 → gratinglab-0.4.1}/pyproject.toml +0 -0
  36. {gratinglab-0.4.0 → gratinglab-0.4.1}/setup.cfg +0 -0
  37. {gratinglab-0.4.0 → gratinglab-0.4.1}/setup.py +0 -0
  38. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/checks.py +0 -0
  39. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/compare.py +0 -0
  40. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/convergence.py +0 -0
  41. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/geometry.py +0 -0
  42. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/__init__.py +0 -0
  43. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/app.py +0 -0
  44. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/camera3d.py +0 -0
  45. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/cmethod_options.py +0 -0
  46. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/comparison.py +0 -0
  47. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/diagram.py +0 -0
  48. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/diagram3d.py +0 -0
  49. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/efficiency_plot.py +0 -0
  50. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/failures.py +0 -0
  51. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/icon.py +0 -0
  52. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/integral_options.py +0 -0
  53. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/label_layout.py +0 -0
  54. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/launcher.py +0 -0
  55. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/orders.py +0 -0
  56. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/provenance.py +0 -0
  57. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/__init__.py +0 -0
  58. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/cmethod_tab.py +0 -0
  59. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/compare_tab.py +0 -0
  60. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/geometry_tab.py +0 -0
  61. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/geometry_window.py +0 -0
  62. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/help_menu.py +0 -0
  63. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/integral_tab.py +0 -0
  64. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/profile_plot_panel.py +0 -0
  65. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/provenance_panel.py +0 -0
  66. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/rcwa_tab.py +0 -0
  67. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/recent.py +0 -0
  68. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/scalar_tab.py +0 -0
  69. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/scene3d_panel.py +0 -0
  70. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/sizing.py +0 -0
  71. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/theming.py +0 -0
  72. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/theory_viewer.py +0 -0
  73. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/qt/worker.py +0 -0
  74. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/rcwa_options.py +0 -0
  75. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/richtext.py +0 -0
  76. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/scalar_options.py +0 -0
  77. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/state.py +0 -0
  78. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/gui/theme.py +0 -0
  79. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/illumination.py +0 -0
  80. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/io/__init__.py +0 -0
  81. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/io/boundary.py +0 -0
  82. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/io/efficiency_table.py +0 -0
  83. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/io/ggp.py +0 -0
  84. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/io/txl.py +0 -0
  85. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/data/SOURCES.md +0 -0
  86. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/elements.py +0 -0
  87. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/factors.py +0 -0
  88. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/fresnel.py +0 -0
  89. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/nk.py +0 -0
  90. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/optical.py +0 -0
  91. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/refractiveindex.py +0 -0
  92. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/materials/typical.py +0 -0
  93. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/measured.py +0 -0
  94. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/__init__.py +0 -0
  95. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/_analyzer_summary.py +0 -0
  96. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/analyzer.py +0 -0
  97. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/boundary/__init__.py +0 -0
  98. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/boundary/average.py +0 -0
  99. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/boundary/cross_section.py +0 -0
  100. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/boundary/pipeline.py +0 -0
  101. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/boundary/swaths.py +0 -0
  102. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/cli.py +0 -0
  103. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/config.py +0 -0
  104. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/__init__.py +0 -0
  105. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/analysis.py +0 -0
  106. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/image_flatten.py +0 -0
  107. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/orientation.py +0 -0
  108. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/processing.py +0 -0
  109. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/region_mask.py +0 -0
  110. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/scars.py +0 -0
  111. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/core/tip.py +0 -0
  112. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/data/__init__.py +0 -0
  113. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/data/aggregation.py +0 -0
  114. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/__init__.py +0 -0
  115. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/icon.py +0 -0
  116. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/__init__.py +0 -0
  117. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/app.py +0 -0
  118. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/boundary_view.py +0 -0
  119. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/canvas.py +0 -0
  120. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/efficiency_dialog.py +0 -0
  121. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/import_view.py +0 -0
  122. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/layout.py +0 -0
  123. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/main_window.py +0 -0
  124. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/swath_dialog.py +0 -0
  125. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/wiki_view.py +0 -0
  126. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/qt/worker.py +0 -0
  127. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/gui/state.py +0 -0
  128. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/io/__init__.py +0 -0
  129. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/io/file_io.py +0 -0
  130. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/io/ibw.py +0 -0
  131. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/io/metrics.py +0 -0
  132. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/io/sem.py +0 -0
  133. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/io/spm.py +0 -0
  134. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/settings.py +0 -0
  135. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/stats/__init__.py +0 -0
  136. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/stats/analysis.py +0 -0
  137. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/stats/icc.py +0 -0
  138. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/visualization/__init__.py +0 -0
  139. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/visualization/diagnostics.py +0 -0
  140. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/visualization/profiles.py +0 -0
  141. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/visualization/statistics.py +0 -0
  142. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/__init__.py +0 -0
  143. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/facet-fitting.md +0 -0
  144. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/file-formats.md +0 -0
  145. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/flattening.md +0 -0
  146. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/groove-orientation.md +0 -0
  147. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/icc-correction.md +0 -0
  148. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/overview.md +0 -0
  149. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/reading-outputs.md +0 -0
  150. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/row-groups.md +0 -0
  151. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/scars-and-masking.md +0 -0
  152. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/swath-statistics.md +0 -0
  153. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/wiki/tip-correction.md +0 -0
  154. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/metrology/workflows.py +0 -0
  155. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/mirror.py +0 -0
  156. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/problem.py +0 -0
  157. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/profiles/__init__.py +0 -0
  158. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/profiles/_base.py +0 -0
  159. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/profiles/_polyline.py +0 -0
  160. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/profiles/_shapes.py +0 -0
  161. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/profiles/_trapezoid.py +0 -0
  162. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/profiles/_types.py +0 -0
  163. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/resolution.py +0 -0
  164. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/result.py +0 -0
  165. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/__init__.py +0 -0
  166. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/_conditioning.py +0 -0
  167. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/_execution.py +0 -0
  168. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/_scalar_groove.py +0 -0
  169. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/base.py +0 -0
  170. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/cmethod/__init__.py +0 -0
  171. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/cmethod/_core.py +0 -0
  172. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/cmethod/_series.py +0 -0
  173. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/__init__.py +0 -0
  174. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/_boundary.py +0 -0
  175. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/_core.py +0 -0
  176. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/_finite.py +0 -0
  177. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/_greens.py +0 -0
  178. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/_kernels.py +0 -0
  179. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/integral/_nystrom.py +0 -0
  180. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/rcwa/__init__.py +0 -0
  181. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/rcwa/_core.py +0 -0
  182. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/rcwa/_stack.py +0 -0
  183. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab/solvers/scalar.py +0 -0
  184. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab.egg-info/dependency_links.txt +0 -0
  185. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab.egg-info/entry_points.txt +0 -0
  186. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab.egg-info/requires.txt +0 -0
  187. {gratinglab-0.4.0 → gratinglab-0.4.1}/src/gratinglab.egg-info/top_level.txt +0 -0
  188. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_changelog.py +0 -0
  189. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_checks.py +0 -0
  190. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_cmethod.py +0 -0
  191. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_compare.py +0 -0
  192. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_conditioning.py +0 -0
  193. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_convergence.py +0 -0
  194. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_cross_method.py +0 -0
  195. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_efficiency_table.py +0 -0
  196. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_four_way.py +0 -0
  197. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_fresnel.py +0 -0
  198. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_geometry.py +0 -0
  199. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_ggp.py +0 -0
  200. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_camera3d.py +0 -0
  201. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_cmethod_options.py +0 -0
  202. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_cmethod_tab.py +0 -0
  203. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_compare_tab.py +0 -0
  204. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_diagram.py +0 -0
  205. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_diagram3d.py +0 -0
  206. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_geometry_window.py +0 -0
  207. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_help_menu.py +0 -0
  208. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_integral_options.py +0 -0
  209. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_mathtext.py +0 -0
  210. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_orders.py +0 -0
  211. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_polish.py +0 -0
  212. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_provenance.py +0 -0
  213. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_provenance_panel.py +0 -0
  214. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_rcwa_options.py +0 -0
  215. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_richtext.py +0 -0
  216. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_scalar_options.py +0 -0
  217. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_state.py +0 -0
  218. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_gui_theme.py +0 -0
  219. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_illumination.py +0 -0
  220. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_core.py +0 -0
  221. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_corpus.py +0 -0
  222. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_finite.py +0 -0
  223. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_graded.py +0 -0
  224. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_greens.py +0 -0
  225. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_kernels.py +0 -0
  226. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_measured_polygon.py +0 -0
  227. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_operators.py +0 -0
  228. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_integral_solver.py +0 -0
  229. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_io_boundary.py +0 -0
  230. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_label_layout.py +0 -0
  231. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_littrow.py +0 -0
  232. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_materials.py +0 -0
  233. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_measured.py +0 -0
  234. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_mirror.py +0 -0
  235. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_nk.py +0 -0
  236. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_perturbation.py +0 -0
  237. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_profiles.py +0 -0
  238. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_rayleigh_anomaly.py +0 -0
  239. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_rcwa.py +0 -0
  240. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_rcwa_benchmarks.py +0 -0
  241. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_refractiveindex.py +0 -0
  242. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_resolution.py +0 -0
  243. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_result.py +0 -0
  244. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_scalar.py +0 -0
  245. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_solver_conformance.py +0 -0
  246. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_solver_execution.py +0 -0
  247. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_solver_progress.py +0 -0
  248. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_trapezoidal_solvers.py +0 -0
  249. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_txl.py +0 -0
  250. {gratinglab-0.4.0 → gratinglab-0.4.1}/tests/test_typical.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gratinglab
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Open platform for diffraction grating groove metrology and efficiency analysis
5
5
  Author: Jake McCoy, Aditi Gangadharan
6
6
  License-Expression: BSD-3-Clause
@@ -339,14 +339,27 @@ ladder, redrawn as the form changes, with no solver. **Send to efficiency window
339
339
  (`Ctrl+E`) copies its form into the efficiency window, opening it if need be, and
340
340
  solves nothing; the efficiency window keeps its own Grating Geometry tab.
341
341
 
342
- The **Mirror** tab treats the dock's coating stack as a flat mirror, before any
343
- grooves: the Coating as substrate under its Layers (innermost first), with the
344
- Roughness at every interface. It plots the specular reflectivity against graze angle
342
+ The efficiency window's dock describes the surface as a stack, in its **Surface**
343
+ group: one row per coating layer, outermost at the top as the light meets them, each
344
+ with a material and a thickness in nm, above the **Grating** material the grooves are
345
+ cut into. Every material box lists your library and also takes a typed model name
346
+ such as `typical:Au` or `factors:SiO2@2.2`.
347
+
348
+ The **Materials** tab builds those names from a kind, a table name or formula and an
349
+ optional density, plots the material's index against wavelength with the dock's scan
350
+ shaded, and says whether it covers that scan. Two buttons send it to the stack, as the
351
+ grating material or as a new top layer. Your library is listed there, with the buttons
352
+ that add a table to it, rescan it and open its folder. The **Setup** tab is the
353
+ reference page for what is installed and what a coating means to each solver.
354
+
355
+ The **Mirror** tab treats that stack as a flat mirror, before any grooves, with the
356
+ roughness at every interface. It plots the specular reflectivity against graze angle
345
357
  or wavelength, the 1/e penetration depth in each material, and the thickness the
346
358
  outermost layer needs before what lies beneath it changes the reflectivity by less
347
- than a tolerance, so you can see whether that layer may be modelled as bulk. The same
348
- is `gratinglab.mirror.Mirror` from Python. Coating and Layers both take model names
349
- such as `typical:Au` and `factors:SiO2@2.2`.
359
+ than a tolerance. Its answer, whether that layer reads as bulk, is one line above the
360
+ plots, and when it does a button makes the layer the grating material on its own. The
361
+ tab recomputes as you type, and an angle scan marks the graze angles your mount puts
362
+ light at. The same calculation is `gratinglab.mirror.Mirror` from Python.
350
363
 
351
364
  The windows are built with Qt (PySide6), so `pip install "gratinglab[gui]"` needs no
352
365
  system toolkit to be installed first. PySide6 is licensed under the LGPLv3 and is an
@@ -295,14 +295,27 @@ ladder, redrawn as the form changes, with no solver. **Send to efficiency window
295
295
  (`Ctrl+E`) copies its form into the efficiency window, opening it if need be, and
296
296
  solves nothing; the efficiency window keeps its own Grating Geometry tab.
297
297
 
298
- The **Mirror** tab treats the dock's coating stack as a flat mirror, before any
299
- grooves: the Coating as substrate under its Layers (innermost first), with the
300
- Roughness at every interface. It plots the specular reflectivity against graze angle
298
+ The efficiency window's dock describes the surface as a stack, in its **Surface**
299
+ group: one row per coating layer, outermost at the top as the light meets them, each
300
+ with a material and a thickness in nm, above the **Grating** material the grooves are
301
+ cut into. Every material box lists your library and also takes a typed model name
302
+ such as `typical:Au` or `factors:SiO2@2.2`.
303
+
304
+ The **Materials** tab builds those names from a kind, a table name or formula and an
305
+ optional density, plots the material's index against wavelength with the dock's scan
306
+ shaded, and says whether it covers that scan. Two buttons send it to the stack, as the
307
+ grating material or as a new top layer. Your library is listed there, with the buttons
308
+ that add a table to it, rescan it and open its folder. The **Setup** tab is the
309
+ reference page for what is installed and what a coating means to each solver.
310
+
311
+ The **Mirror** tab treats that stack as a flat mirror, before any grooves, with the
312
+ roughness at every interface. It plots the specular reflectivity against graze angle
301
313
  or wavelength, the 1/e penetration depth in each material, and the thickness the
302
314
  outermost layer needs before what lies beneath it changes the reflectivity by less
303
- than a tolerance, so you can see whether that layer may be modelled as bulk. The same
304
- is `gratinglab.mirror.Mirror` from Python. Coating and Layers both take model names
305
- such as `typical:Au` and `factors:SiO2@2.2`.
315
+ than a tolerance. Its answer, whether that layer reads as bulk, is one line above the
316
+ plots, and when it does a button makes the layer the grating material on its own. The
317
+ tab recomputes as you type, and an angle scan marks the graze angles your mount puts
318
+ light at. The same calculation is `gratinglab.mirror.Mirror` from Python.
306
319
 
307
320
  The windows are built with Qt (PySide6), so `pip install "gratinglab[gui]"` needs no
308
321
  system toolkit to be installed first. PySide6 is licensed under the LGPLv3 and is an
@@ -0,0 +1,169 @@
1
+ # The coating as a flat mirror
2
+
3
+ Implemented in [`mirror.py`](../../src/gratinglab/mirror.py), and shown by the
4
+ Mirror tab. Symbols and sign conventions follow
5
+ [`conventions.md`](../conventions.md). This page says what the calculation is,
6
+ what its three outputs mean, and what has been checked; the section numbers
7
+ are for citing.
8
+
9
+ It is not a grating solver. It answers a question that comes before one: what
10
+ does the coating do on its own, and is its top layer thick enough that the
11
+ layers under it can be left out of the grating calculation?
12
+
13
+ ---
14
+
15
+ ## 1. What is modelled
16
+
17
+ A stack of flat, parallel, homogeneous layers under vacuum, on a substrate
18
+ that is taken as infinitely thick. The stack is the one a grating `Problem`
19
+ carries: `coating` (the dock's **Grating** material) is the substrate here,
20
+ and `layers` sit on it, innermost first, so the last layer is the surface the
21
+ light meets.
22
+
23
+ Angles are grazing, measured from the surface, as in
24
+ [`materials/fresnel.py`](../../src/gratinglab/materials/fresnel.py). The
25
+ polarizations are `s` and `p` with respect to the mirror's own plane of
26
+ incidence, which are not the groove-referenced TE and TM of `conventions.md`
27
+ §7; a flat mirror has no grooves to refer to.
28
+
29
+ What a flat stack leaves out is everything the grooves do. On a grating a
30
+ layer is conformal: it follows the groove and rounds its convex corners, and
31
+ the light meets each facet at its own angle. Only the
32
+ [RCWA](rcwa.md) models that (its §6). The mirror tells you about the material
33
+ stack at one angle at a time, which is why the Mirror tab marks the angles
34
+ your mount actually uses (§5).
35
+
36
+ ## 2. Reflectivity: Parratt's recursion
37
+
38
+ In each medium `j` the wave has a normal wavevector component, divided by
39
+ `k = 2π/λ`,
40
+
41
+ ```
42
+ q_j = sqrt(n_j² − cos²θ)
43
+ ```
44
+
45
+ with the root that has a non-negative imaginary part, so the wave decays
46
+ going into the material (the `exp(−iωt)` convention of `conventions.md` §2).
47
+ At the interface between `j` and the medium below it the Fresnel coefficients
48
+ are
49
+
50
+ ```
51
+ r_s = (q_j − q_j+1) / (q_j + q_j+1)
52
+ r_p = (n_j+1² q_j − n_j² q_j+1) / (n_j+1² q_j + n_j² q_j+1)
53
+ ```
54
+
55
+ and the reflection seen from inside medium `j`, looking down at everything
56
+ beneath it, is built from the substrate upward:
57
+
58
+ ```
59
+ X_j = (r + X_j+1 e^{2ik q_j+1 d_j+1}) / (1 + r X_j+1 e^{2ik q_j+1 d_j+1})
60
+ ```
61
+
62
+ with `X = 0` in the substrate and `d` a layer's thickness. `X` in the vacuum
63
+ is the mirror's amplitude reflection coefficient, and the reflectivity is its
64
+ modulus squared; unpolarized is the mean of `s` and `p`.
65
+
66
+ The exponential only ever decays, since `Im q ≥ 0`, so the recursion is
67
+ stable for a layer of any thickness, an absorbing one many attenuation
68
+ lengths deep included. That is the same reason the RCWA propagates with a
69
+ scattering matrix (its §4).
70
+
71
+ Roughness is one RMS value `σ` applied at every interface as the
72
+ Névot–Croce factor on the amplitude,
73
+
74
+ ```
75
+ r → r · exp(−2 k² q_j q_j+1 σ²)
76
+ ```
77
+
78
+ which uses the wave on both sides, so it damps little below the critical
79
+ angle, where the transmitted wave is evanescent. One `σ` for every interface
80
+ is a simplification: a real stack's buried interfaces need not be as rough as
81
+ its surface.
82
+
83
+ ## 3. How deep the light goes
84
+
85
+ `Mirror.penetration_depth` is, for each material in the stack taken as bulk,
86
+ the depth at which the transmitted wave's intensity has fallen to `1/e`:
87
+
88
+ ```
89
+ depth = 1 / (2 k Im q)
90
+ ```
91
+
92
+ Below the material's critical angle the wave is evanescent and the depth is a
93
+ few nanometres, set by the angle and nearly independent of absorption. Above
94
+ it the wave propagates and the depth is set by absorption, and is longer by
95
+ one or two orders of magnitude. The jump between the two is the critical
96
+ angle. A material with no absorption has an infinite depth above its critical
97
+ angle, and the function returns that.
98
+
99
+ This is a property of one material at one angle and wavelength. It is drawn
100
+ for every material in the stack, not only the top one, because a layer's own
101
+ depth says how far light gets into it, while the substrate's says whether
102
+ light that reaches it comes back.
103
+
104
+ ## 4. When a layer may be taken as bulk
105
+
106
+ The practical question is whether a grating calculation needs the stack, or
107
+ may take the top layer as the grating material alone. The `1/e` depth
108
+ suggests an answer and does not give it: light reflected from the interface
109
+ under the layer interferes with light reflected from its surface, so the
110
+ reflectivity approaches the bulk value through fringes, not as a plain
111
+ exponential.
112
+
113
+ `Mirror.bulk_thickness` therefore sweeps the top layer's thickness, with the
114
+ real layers and substrate beneath it, and returns the smallest thickness
115
+ beyond which the reflectivity stays within a relative `tolerance` of that
116
+ layer's own bulk reflectivity. "Stays" is the point: a thickness where a
117
+ fringe happens to cross the bulk value does not count. The sweep steps finely
118
+ enough to follow both the fringes and the decay, runs to forty `1/e` depths,
119
+ and returns infinity if the reflectivity has not settled by then, as for a
120
+ lossless layer above its critical angle.
121
+
122
+ The Mirror tab compares that thickness with the layer as deposited, at every
123
+ point of the scan, and reports one of three things: the layer reads as bulk
124
+ across the scan, at some of it, or nowhere. For 10 nm of gold on silicon at
125
+ 1 nm, with the typical-material model, the gold reads as bulk to one part in
126
+ a thousand only from 0.1° to 0.79° graze. That is a statement about a flat
127
+ mirror at that tolerance, and the tolerance is yours to set.
128
+
129
+ ## 5. What it means for a grating
130
+
131
+ The mirror's angle is a graze angle onto a flat surface. A grating meets the
132
+ light at two such angles, and the Mirror tab draws both on an angle scan:
133
+
134
+ - onto the **grating plane**, `sin ζ = sin γ cos α`, and
135
+ - onto the **blaze facet**, `sin ζ = sin γ cos(δ − α)`, for a blazed profile
136
+ ([`geometry.facet_graze`](../../src/gratinglab/geometry.py)).
137
+
138
+ If the top layer reads as bulk at those angles, across the wavelengths of
139
+ interest, then taking it as the grating material alone is supported for the
140
+ reflectivity. It is evidence, not proof, for the efficiency: a conformal
141
+ layer on a groove is thinner along some directions than its nominal
142
+ thickness, and multiple reflections between facets see other angles. Where
143
+ the answer matters, model the layers in the RCWA and compare.
144
+
145
+ ## 6. Validation evidence
146
+
147
+ Checked in [`tests/test_mirror.py`](../../tests/test_mirror.py):
148
+
149
+ - A bare substrate reproduces the single-interface amplitudes of
150
+ `materials/fresnel.py`, in `s` and `p`, to `10⁻¹²`, from 0.3° to 45°.
151
+ - A four-medium stack agrees with a characteristic-matrix calculation (Born
152
+ and Wolf, §1.6) written out in the test, to `10⁻¹²` at four angles. The two
153
+ share no code.
154
+ - A film of the substrate's own material changes nothing; a thick absorbing
155
+ film reads as its own bulk; the reflectivity stays in `[0, 1]` over angle
156
+ and wavelength; the layer order is innermost first.
157
+ - The evanescent depth below the critical angle matches the closed form for
158
+ a lossless material, and the bulk thickness lies where the reflectivity
159
+ just leaves the tolerance band.
160
+
161
+ ## 7. Not yet validated
162
+
163
+ - Against a measured reflectivity curve, or against another code's output.
164
+ The checks above are of the mathematics, and of consistency with this
165
+ project's own Fresnel module.
166
+ - Roughness in a stack. A bare substrate agrees with `fresnel.py` in
167
+ magnitude; nothing independent checks the factor at a buried interface.
168
+ - Whether "bulk on a flat mirror" predicts "bulk on a grating". §5 gives the
169
+ reasoning; no comparison with layered RCWA runs has been made.
@@ -22,7 +22,7 @@ from .measured import MeasuredEfficiency, MeasurementProvenance
22
22
  from .resolution import ResolvingPower, resolving_power
23
23
  from .result import EfficiencyScan, OrderEfficiency, Provenance
24
24
 
25
- __version__ = "0.4.0"
25
+ __version__ = "0.4.1"
26
26
 
27
27
  #: The day this version was released, ISO 8601. It sits beside the version
28
28
  #: rather than being read from CHANGELOG.md at run time because the changelog
@@ -32,7 +32,7 @@ __version__ = "0.4.0"
32
32
  #: the `## <version>` heading, so the release commit that forgets to move it
33
33
  #: fails at the point where it is cheapest to fix, the same arrangement as
34
34
  #: the version's own section.
35
- __version_date__ = "2026-11-16"
35
+ __version_date__ = "2026-11-17"
36
36
 
37
37
  __all__ = [
38
38
  "Illumination",
@@ -71,6 +71,9 @@ _GENERAL_PAGES = (
71
71
  # made while producing that profile, and those are invisible in the curve.
72
72
  # It belongs beside the conventions for the same reason they do.
73
73
  ("metrology", "Groove Metrology", "theory/metrology.md"),
74
+ # Not a solver either: the coating as a flat stack, which is what the
75
+ # Mirror tab computes and what decides whether a layer may be taken as bulk.
76
+ ("mirror", "Flat Mirror & Coating Stacks", "theory/mirror.md"),
74
77
  )
75
78
 
76
79
  #: How many parent directories to search before giving up. gui/docs.py sits at
@@ -0,0 +1,141 @@
1
+ """What the Materials tab resolves, draws and says, with no Qt in it.
2
+
3
+ The tab answers three things about one material before it is used: what name
4
+ to write for it, what its index looks like, and whether it covers the
5
+ wavelengths the dock is about to scan. :func:`material_name` builds the name
6
+ from the tab's fields, so nobody has to remember ``factors:SiO2@2.2``;
7
+ :func:`preview` resolves it and checks the scan; :func:`draw` and
8
+ :func:`lines` turn that into the plot and the panel text.
9
+
10
+ Called by :mod:`gratinglab.gui.qt.materials_tab`; tested in
11
+ ``tests/test_materials_view.py``.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from dataclasses import dataclass
17
+ from pathlib import Path
18
+
19
+ import numpy as np
20
+
21
+ from ..materials import OpticalConstants, lookup
22
+ from ..materials.optical import HC_EV_NM
23
+ from .provenance import Line
24
+ from .theme import order_colors, set_titles, style_axes
25
+
26
+ __all__ = ["KINDS", "MaterialPreview", "material_name", "preview", "draw", "lines"]
27
+
28
+ #: The ways to name a material, as (key, label, what the name field holds).
29
+ KINDS = (
30
+ ("table", "Table in your library", "Name"),
31
+ ("factors", "Scattering factors + density", "Formula"),
32
+ ("typical", "Typical-material model", "Formula"),
33
+ )
34
+
35
+
36
+ def material_name(kind: str, name: str, density: str = "") -> str:
37
+ """The coating name for the tab's fields; ``""`` when nothing is entered.
38
+
39
+ A density is optional everywhere: a table is rescaled to it
40
+ (``Au@17.5``), and a formula with none uses its default where one exists.
41
+ """
42
+ name, density = name.strip(), density.strip()
43
+ if not name:
44
+ return ""
45
+ prefix = {"table": "", "factors": "factors:", "typical": "typical:"}[kind]
46
+ return f"{prefix}{name}" + (f"@{density}" if density else "")
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ class MaterialPreview:
51
+ name: str
52
+ constants: OpticalConstants
53
+ #: The dock's scan, nm, or None when its fields do not parse.
54
+ scan: tuple[float, float] | None
55
+ #: X-ray-like over most of its range (index near 1): plot the decrement
56
+ #: and absorption on a log axis rather than n and k.
57
+ near_unity: bool
58
+
59
+
60
+ def _scan(start: str, stop: str) -> tuple[float, float] | None:
61
+ try:
62
+ low, high = float(start), float(stop)
63
+ except ValueError:
64
+ return None
65
+ return (low, high) if 0 < low < high else None
66
+
67
+
68
+ def preview(name: str, scan_start: str = "", scan_stop: str = "") -> MaterialPreview:
69
+ """Resolve ``name`` and note the scan. Raises what :func:`lookup` raises."""
70
+ constants = lookup(name)
71
+ # Most of the table, not all of it: an X-ray table's longest wavelengths
72
+ # reach |n - 1| of 0.2, and one such corner should not flatten the plot.
73
+ near = bool(constants.near_unity(constants.wavelength_nm).mean() > 0.5)
74
+ return MaterialPreview(name, constants, _scan(scan_start, scan_stop), near)
75
+
76
+
77
+ def covers_scan(p: MaterialPreview) -> bool | None:
78
+ """Whether the table covers the whole scan; None with no scan to check."""
79
+ if p.scan is None:
80
+ return None
81
+ return bool(p.constants.covers(np.array(p.scan)).all())
82
+
83
+
84
+ def draw(axes, p: MaterialPreview, theme) -> None:
85
+ """The index against wavelength, with the dock's scan shaded."""
86
+ axes.clear()
87
+ style_axes(axes, theme)
88
+ c = p.constants
89
+ colors = order_colors(range(2), theme)
90
+ if p.near_unity:
91
+ # Log axes drop a non-positive decrement, as near an edge.
92
+ axes.plot(c.wavelength_nm, np.where(c.decrement > 0, c.decrement, np.nan),
93
+ color=colors[0], label="decrement δ")
94
+ axes.plot(c.wavelength_nm, np.where(c.absorption > 0, c.absorption, np.nan),
95
+ color=colors[1], label="absorption β")
96
+ axes.set_yscale("log")
97
+ axes.set_ylabel("1 − n, k")
98
+ else:
99
+ axes.plot(c.wavelength_nm, 1.0 - c.decrement, color=colors[0], label="n")
100
+ axes.plot(c.wavelength_nm, c.absorption, color=colors[1], label="k")
101
+ axes.set_yscale("linear")
102
+ axes.set_ylabel("n, k")
103
+ axes.set_xscale("log")
104
+ axes.set_xlabel("wavelength (nm)")
105
+ if p.scan is not None:
106
+ axes.axvspan(*p.scan, color=theme.muted, alpha=0.18, label="the dock's scan")
107
+ low, high = c.range_nm
108
+ set_titles(axes, p.name, f"{low:.4g} to {high:.4g} nm, {len(c.wavelength_nm)} points", theme)
109
+ axes.legend(fontsize=8, loc="best")
110
+
111
+
112
+ def _short(source: str) -> str:
113
+ """``source`` with the home directory written ``~``: the library a table
114
+ came from still shows, without a user's whole path in front of it."""
115
+ return source.replace(str(Path.home()), "~")
116
+
117
+
118
+ def lines(p: MaterialPreview) -> tuple[Line, ...]:
119
+ """Where it came from, what it covers, and whether that includes the scan."""
120
+ c = p.constants
121
+ low, high = c.range_nm
122
+ out = [
123
+ Line("name: ", "dim"), Line(f"{p.name}\n"),
124
+ Line("source: ", "dim"), Line(f"{_short(c.source)}\n"),
125
+ Line("covers: ", "dim"),
126
+ Line(f"{low:.4g} to {high:.4g} nm ({HC_EV_NM / high:.4g} to {HC_EV_NM / low:.4g} eV)\n"),
127
+ ]
128
+ covered = covers_scan(p)
129
+ if covered is None:
130
+ out.append(Line("The dock's wavelength scan is not set, so coverage is not checked.\n", "dim"))
131
+ elif covered:
132
+ out.append(Line(f"Covers the dock's scan, {p.scan[0]:g} to {p.scan[1]:g} nm.\n", "ok"))
133
+ else:
134
+ out.append(Line(
135
+ f"Does not cover the dock's scan, {p.scan[0]:g} to {p.scan[1]:g} nm: a solve "
136
+ "with it would be refused outside the table.\n", "warn"))
137
+ if covered:
138
+ grid = np.linspace(p.scan[0], p.scan[1], 200)
139
+ for caveat in c.caveats(grid):
140
+ out.append(Line(f"{caveat}\n", "warn"))
141
+ return tuple(out)
@@ -1,11 +1,14 @@
1
1
  """What the Mirror tab computes, draws and says, with no Qt in it.
2
2
 
3
- The stack comes from the geometry dock (Coating as the substrate, Layers,
4
- Roughness, and the wavelength scan), so a coating is described in one place
5
- whether it is about to be ruled or only reflected from. The tab's own
6
- settings choose the scan: graze angle at one wavelength, or wavelength at one
7
- graze. :func:`compute` returns a :class:`MirrorResult`; :func:`draw` and
8
- :func:`lines` turn it into the two plots and the panel text.
3
+ The stack comes from the geometry dock's Surface group (its Grating material
4
+ as the substrate, the layers and the roughness), so a coating is described in
5
+ one place whether it is about to be ruled or only reflected from. The tab's
6
+ own settings choose the scan: graze angle at one wavelength, or wavelength at
7
+ one graze, over the dock's wavelengths or the tab's own. :func:`compute`
8
+ returns a :class:`MirrorResult`; :func:`verdict` is the one-line answer,
9
+ :func:`draw` and :func:`lines` the two plots and the panel text. The dock's
10
+ mount is drawn on an angle scan as markers (:func:`mount_markers`), so the
11
+ angles the grating will actually be used at can be read off the curve.
9
12
 
10
13
  Called by :mod:`gratinglab.gui.qt.mirror_tab`; tested in
11
14
  ``tests/test_mirror_view.py``.
@@ -18,12 +21,17 @@ from dataclasses import dataclass
18
21
  import numpy as np
19
22
  from numpy.typing import NDArray
20
23
 
24
+ from ..geometry import facet_graze
21
25
  from ..mirror import Mirror
26
+ from ..profiles import Blazed
22
27
  from .provenance import Line
23
- from .state import FieldError, FormErrors, FormState, _build_layers, _number
28
+ from .state import FieldError, FormErrors, FormState, _build_layers, _number, build
24
29
  from .theme import order_colors, set_titles, style_axes
25
30
 
26
- __all__ = ["MirrorSettings", "MirrorResult", "compute", "draw", "lines"]
31
+ __all__ = [
32
+ "MirrorSettings", "MirrorResult", "compute", "draw", "lines", "verdict",
33
+ "is_bulk_throughout", "mount_markers",
34
+ ]
27
35
 
28
36
  #: Most points one scan evaluates; each one sweeps a thickness for the bulk test.
29
37
  MAX_POINTS = 1000
@@ -41,6 +49,11 @@ class MirrorSettings:
41
49
  wavelength: str = "1.0" # nm, the fixed wavelength for an angle scan
42
50
  polarization: str = "unpolarized"
43
51
  tolerance: str = "1e-3"
52
+ #: A wavelength scan uses the dock's wavelengths, or the three below.
53
+ dock_wavelengths: bool = True
54
+ wavelength_start: str = "1.0"
55
+ wavelength_stop: str = "5.0"
56
+ wavelength_count: str = "200"
44
57
 
45
58
 
46
59
  @dataclass(frozen=True)
@@ -55,6 +68,24 @@ class MirrorResult:
55
68
  bulk: NDArray[np.float64] | None
56
69
  tolerance: float
57
70
  polarization: str
71
+ #: The dock's mount as ``(label, graze in deg)``, for an angle scan.
72
+ markers: tuple[tuple[str, float], ...] = ()
73
+
74
+
75
+ def mount_markers(form: FormState) -> tuple[tuple[str, float], ...]:
76
+ """The graze angles the dock's mount puts light at: onto the grating
77
+ plane, and onto the blaze facet when the profile has one. Empty when the
78
+ form does not describe a grating, which is no concern of a mirror's."""
79
+ try:
80
+ parsed = build(form)
81
+ except FormErrors:
82
+ return ()
83
+ light, profile = parsed.illumination, parsed.problem.profile
84
+ out = [("grating plane", float(np.degrees(facet_graze(light.gamma, 0.0, light.alpha))))]
85
+ if isinstance(profile, Blazed):
86
+ blaze = np.radians(profile.blaze_angle)
87
+ out.append(("blaze facet", float(np.degrees(facet_graze(light.gamma, blaze, light.alpha)))))
88
+ return tuple(out)
58
89
 
59
90
 
60
91
  def compute(form: FormState, settings: MirrorSettings) -> MirrorResult:
@@ -63,7 +94,7 @@ def compute(form: FormState, settings: MirrorSettings) -> MirrorResult:
63
94
  errors: list[FieldError] = []
64
95
  substrate = form.coating.strip()
65
96
  if not substrate:
66
- errors.append(FieldError("coating", "a mirror needs a substrate: set Coating"))
97
+ errors.append(FieldError("coating", "a mirror needs a substrate: set the Grating material"))
67
98
  roughness = _number(form.roughness, "roughness", errors, minimum=0.0)
68
99
  layers = _build_layers(form.layers, errors)
69
100
  tolerance = _number(settings.tolerance, "tolerance", errors, minimum=0.0, exclusive_min=True, maximum=1.0)
@@ -75,9 +106,10 @@ def compute(form: FormState, settings: MirrorSettings) -> MirrorResult:
75
106
  count = _number(settings.graze_count, "graze_count", errors, minimum=2, maximum=MAX_POINTS, integer=True)
76
107
  fixed = _number(settings.wavelength, "wavelength", errors, minimum=0.0, exclusive_min=True)
77
108
  elif settings.scan == "wavelength":
78
- start = _number(form.wavelength_start, "wavelength_start", errors, minimum=0.0, exclusive_min=True)
79
- stop = _number(form.wavelength_stop, "wavelength_stop", errors, minimum=0.0, exclusive_min=True)
80
- count = _number(form.wavelength_count, "wavelength_count", errors, minimum=2, maximum=MAX_POINTS, integer=True)
109
+ source = form if settings.dock_wavelengths else settings
110
+ start = _number(source.wavelength_start, "wavelength_start", errors, minimum=0.0, exclusive_min=True)
111
+ stop = _number(source.wavelength_stop, "wavelength_stop", errors, minimum=0.0, exclusive_min=True)
112
+ count = _number(source.wavelength_count, "wavelength_count", errors, minimum=2, maximum=MAX_POINTS, integer=True)
81
113
  fixed = _number(settings.graze, "graze", errors, minimum=0.0, exclusive_min=True, maximum=90.0)
82
114
  else:
83
115
  raise ValueError(f"scan must be 'angle' or 'wavelength', got {settings.scan!r}")
@@ -96,7 +128,9 @@ def compute(form: FormState, settings: MirrorSettings) -> MirrorResult:
96
128
  bulk = np.array([
97
129
  mirror.bulk_thickness(g, w, tolerance, settings.polarization) for g, w in zip(graze, wl)
98
130
  ])
99
- return MirrorResult(mirror, settings.scan, x, fixed, reflectivity, depths, bulk, tolerance, settings.polarization)
131
+ markers = mount_markers(form) if settings.scan == "angle" else ()
132
+ return MirrorResult(mirror, settings.scan, x, fixed, reflectivity, depths, bulk, tolerance,
133
+ settings.polarization, markers)
100
134
 
101
135
 
102
136
  def _x_label(result: MirrorResult) -> str:
@@ -126,6 +160,17 @@ def draw(r_axes, depth_axes, result: MirrorResult, theme, log_r: bool = True) ->
126
160
  label=f"{top.material} needed to read as bulk")
127
161
  depth_axes.axhline(top.thickness, color=theme.muted, linestyle=":",
128
162
  label=f"{top.material} as deposited, {top.thickness:g} nm")
163
+ for i, (label, graze) in enumerate(result.markers):
164
+ if result.x[0] <= graze <= result.x[-1]:
165
+ for axes in (r_axes, depth_axes):
166
+ axes.axvline(graze, color=theme.muted, linewidth=1)
167
+ # At the foot, clear of the curve near grazing, and on alternate
168
+ # sides of their lines: the two are often a fraction of a degree apart.
169
+ left = i % 2 == 0
170
+ r_axes.annotate(f"{label} {graze:.3g}°", (graze, 0.0), xycoords=("data", "axes fraction"),
171
+ xytext=(-3 if left else 3, 4), textcoords="offset points",
172
+ ha="right" if left else "left", va="bottom", rotation=90,
173
+ fontsize=8, color=theme.muted)
129
174
  depth_axes.set_yscale("log")
130
175
  depth_axes.set_ylabel("depth (nm)")
131
176
  depth_axes.set_xlabel(_x_label(result))
@@ -133,8 +178,29 @@ def draw(r_axes, depth_axes, result: MirrorResult, theme, log_r: bool = True) ->
133
178
  depth_axes.legend(fontsize=8, loc="best")
134
179
 
135
180
 
181
+ def is_bulk_throughout(result: MirrorResult) -> bool:
182
+ """The outermost layer reads as bulk at every point of the scan, so a
183
+ grating calculation may take it as the grating material alone."""
184
+ return result.bulk is not None and bool((result.bulk <= result.mirror.layers[-1].thickness).all())
185
+
186
+
187
+ def verdict(result: MirrorResult) -> Line:
188
+ """The answer in one line: is the top layer thick enough to be bulk?"""
189
+ m = result.mirror
190
+ if result.bulk is None:
191
+ return Line(f"Bare {m.substrate}: there is no layer to test.", "dim")
192
+ top = m.layers[-1]
193
+ enough = result.bulk <= top.thickness
194
+ what = f"{top.material} at {top.thickness:g} nm"
195
+ if enough.all():
196
+ return Line(f"{what} reads as bulk across the scan.", "ok")
197
+ if not enough.any():
198
+ return Line(f"{what} is not bulk anywhere in the scan.", "warn")
199
+ return Line(f"{what} is bulk at {enough.sum()} of {enough.size} points.", "warn")
200
+
201
+
136
202
  def lines(result: MirrorResult) -> tuple[Line, ...]:
137
- """The panel: the stack, then the answer to "is the top layer bulk"."""
203
+ """The panel: the stack, then what the verdict means for modelling."""
138
204
  m = result.mirror
139
205
  stack = " / ".join(
140
206
  ["vacuum", *(f"{layer.material} {layer.thickness:g} nm" for layer in reversed(m.layers)),
@@ -150,23 +216,22 @@ def lines(result: MirrorResult) -> tuple[Line, ...]:
150
216
  top = m.layers[-1]
151
217
  enough = result.bulk <= top.thickness
152
218
  unit = "deg" if result.scan == "angle" else "nm"
219
+ out.append(verdict(result))
153
220
  if enough.all():
154
- out += [Line(f"{top.material} at {top.thickness:g} nm reads as bulk over the whole scan", "ok"),
155
- Line(f": what is beneath it changes R by under {result.tolerance:g}, so a grating "
156
- f"calculation may take {top.material} as the coating alone.\n")]
221
+ out.append(Line(f" What is beneath it changes R by under {result.tolerance:g}, so a grating "
222
+ f"calculation may take {top.material} as the grating material alone.\n"))
157
223
  elif not enough.any():
158
224
  finite = result.bulk[np.isfinite(result.bulk)]
159
- need = f"; it would need {finite.min():.3g} nm at best" if finite.size else ""
160
- out += [Line(f"{top.material} at {top.thickness:g} nm is not bulk anywhere in the scan", "warn"),
161
- Line(f"{need}. Model the stack, not {top.material} alone.\n")]
225
+ need = f" It would need {finite.min():.3g} nm at best." if finite.size else ""
226
+ out.append(Line(f"{need} Model the stack, not {top.material} alone.\n"))
162
227
  else:
163
228
  x = result.x[enough]
164
229
  where = f"at {x[0]:.4g} {unit}" if x.size == 1 else f"between {x.min():.4g} and {x.max():.4g} {unit}"
165
- out += [Line(f"{top.material} at {top.thickness:g} nm reads as bulk at {enough.sum()} of "
166
- f"{enough.size} points", "warn"),
167
- Line(f", {where}. Elsewhere the layers beneath change R by more than "
168
- f"{result.tolerance:g}, so model the stack there.\n")]
230
+ out.append(Line(f" That is {where}. Elsewhere the layers beneath change R by more than "
231
+ f"{result.tolerance:g}, so model the stack there.\n"))
169
232
  depth = result.depths[top.material]
170
233
  out.append(Line(f"1/e depth in {top.material}: {np.nanmin(depth):.3g} to {np.nanmax(depth):.3g} nm "
171
234
  "over the scan.\n", "dim"))
235
+ for label, graze in result.markers:
236
+ out.append(Line(f"The dock's mount puts light on the {label} at {graze:.3g} deg graze.\n", "dim"))
172
237
  return tuple(out)