gratinglab 0.3.17__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. {gratinglab-0.3.17/src/gratinglab.egg-info → gratinglab-0.4.0}/PKG-INFO +21 -3
  2. {gratinglab-0.3.17 → gratinglab-0.4.0}/README.md +20 -2
  3. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/__init__.py +2 -2
  4. gratinglab-0.4.0/src/gratinglab/gui/mirror_view.py +172 -0
  5. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/geometry_panel.py +33 -8
  6. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/main_window.py +9 -0
  7. gratinglab-0.4.0/src/gratinglab/gui/qt/mirror_tab.py +212 -0
  8. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/setup_tab.py +16 -6
  9. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/state.py +28 -9
  10. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/materials/__init__.py +150 -4
  11. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/materials/data/SOURCES.md +4 -1
  12. gratinglab-0.4.0/src/gratinglab/materials/elements.py +59 -0
  13. gratinglab-0.4.0/src/gratinglab/materials/factors.py +189 -0
  14. gratinglab-0.4.0/src/gratinglab/materials/nk.py +167 -0
  15. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/materials/optical.py +17 -0
  16. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/materials/typical.py +3 -7
  17. gratinglab-0.4.0/src/gratinglab/mirror.py +231 -0
  18. {gratinglab-0.3.17 → gratinglab-0.4.0/src/gratinglab.egg-info}/PKG-INFO +21 -3
  19. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab.egg-info/SOURCES.txt +10 -0
  20. gratinglab-0.4.0/tests/test_factors.py +192 -0
  21. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_qt.py +44 -2
  22. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_materials.py +1 -1
  23. gratinglab-0.4.0/tests/test_mirror.py +128 -0
  24. gratinglab-0.4.0/tests/test_mirror_view.py +75 -0
  25. gratinglab-0.4.0/tests/test_nk.py +107 -0
  26. {gratinglab-0.3.17 → gratinglab-0.4.0}/LICENSE +0 -0
  27. {gratinglab-0.3.17 → gratinglab-0.4.0}/MANIFEST.in +0 -0
  28. {gratinglab-0.3.17 → gratinglab-0.4.0}/docs/conventions.md +0 -0
  29. {gratinglab-0.3.17 → gratinglab-0.4.0}/docs/theory/cmethod.md +0 -0
  30. {gratinglab-0.3.17 → gratinglab-0.4.0}/docs/theory/integral.md +0 -0
  31. {gratinglab-0.3.17 → gratinglab-0.4.0}/docs/theory/metrology.md +0 -0
  32. {gratinglab-0.3.17 → gratinglab-0.4.0}/docs/theory/rcwa.md +0 -0
  33. {gratinglab-0.3.17 → gratinglab-0.4.0}/docs/theory/scalar.md +0 -0
  34. {gratinglab-0.3.17 → gratinglab-0.4.0}/pyproject.toml +0 -0
  35. {gratinglab-0.3.17 → gratinglab-0.4.0}/setup.cfg +0 -0
  36. {gratinglab-0.3.17 → gratinglab-0.4.0}/setup.py +0 -0
  37. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/checks.py +0 -0
  38. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/compare.py +0 -0
  39. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/convergence.py +0 -0
  40. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/geometry.py +0 -0
  41. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/__init__.py +0 -0
  42. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/app.py +0 -0
  43. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/camera3d.py +0 -0
  44. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/cmethod_options.py +0 -0
  45. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/comparison.py +0 -0
  46. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/diagram.py +0 -0
  47. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/diagram3d.py +0 -0
  48. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/docs.py +0 -0
  49. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/efficiency_plot.py +0 -0
  50. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/failures.py +0 -0
  51. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/icon.py +0 -0
  52. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/integral_options.py +0 -0
  53. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/label_layout.py +0 -0
  54. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/launcher.py +0 -0
  55. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/orders.py +0 -0
  56. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/provenance.py +0 -0
  57. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/__init__.py +0 -0
  58. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/cmethod_tab.py +0 -0
  59. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/compare_tab.py +0 -0
  60. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/geometry_tab.py +0 -0
  61. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/geometry_window.py +0 -0
  62. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/help_menu.py +0 -0
  63. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/integral_tab.py +0 -0
  64. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/launcher.py +0 -0
  65. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/profile_plot_panel.py +0 -0
  66. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/provenance_panel.py +0 -0
  67. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/rcwa_tab.py +0 -0
  68. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/recent.py +0 -0
  69. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/scalar_tab.py +0 -0
  70. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/scene3d_panel.py +0 -0
  71. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/sizing.py +0 -0
  72. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/theming.py +0 -0
  73. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/theory_viewer.py +0 -0
  74. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/qt/worker.py +0 -0
  75. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/rcwa_options.py +0 -0
  76. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/richtext.py +0 -0
  77. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/scalar_options.py +0 -0
  78. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/gui/theme.py +0 -0
  79. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/illumination.py +0 -0
  80. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/io/__init__.py +0 -0
  81. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/io/boundary.py +0 -0
  82. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/io/efficiency_table.py +0 -0
  83. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/io/ggp.py +0 -0
  84. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/io/txl.py +0 -0
  85. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/materials/fresnel.py +0 -0
  86. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/materials/refractiveindex.py +0 -0
  87. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/measured.py +0 -0
  88. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/__init__.py +0 -0
  89. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/_analyzer_summary.py +0 -0
  90. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/analyzer.py +0 -0
  91. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/boundary/__init__.py +0 -0
  92. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/boundary/average.py +0 -0
  93. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/boundary/cross_section.py +0 -0
  94. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/boundary/pipeline.py +0 -0
  95. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/boundary/swaths.py +0 -0
  96. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/cli.py +0 -0
  97. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/config.py +0 -0
  98. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/__init__.py +0 -0
  99. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/analysis.py +0 -0
  100. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/image_flatten.py +0 -0
  101. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/orientation.py +0 -0
  102. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/processing.py +0 -0
  103. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/region_mask.py +0 -0
  104. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/scars.py +0 -0
  105. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/core/tip.py +0 -0
  106. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/data/__init__.py +0 -0
  107. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/data/aggregation.py +0 -0
  108. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/__init__.py +0 -0
  109. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/icon.py +0 -0
  110. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/__init__.py +0 -0
  111. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/app.py +0 -0
  112. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/boundary_view.py +0 -0
  113. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/canvas.py +0 -0
  114. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/efficiency_dialog.py +0 -0
  115. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/import_view.py +0 -0
  116. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/layout.py +0 -0
  117. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/main_window.py +0 -0
  118. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/swath_dialog.py +0 -0
  119. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/wiki_view.py +0 -0
  120. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/qt/worker.py +0 -0
  121. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/gui/state.py +0 -0
  122. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/io/__init__.py +0 -0
  123. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/io/file_io.py +0 -0
  124. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/io/ibw.py +0 -0
  125. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/io/metrics.py +0 -0
  126. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/io/sem.py +0 -0
  127. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/io/spm.py +0 -0
  128. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/settings.py +0 -0
  129. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/stats/__init__.py +0 -0
  130. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/stats/analysis.py +0 -0
  131. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/stats/icc.py +0 -0
  132. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/visualization/__init__.py +0 -0
  133. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/visualization/diagnostics.py +0 -0
  134. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/visualization/profiles.py +0 -0
  135. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/visualization/statistics.py +0 -0
  136. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/__init__.py +0 -0
  137. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/facet-fitting.md +0 -0
  138. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/file-formats.md +0 -0
  139. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/flattening.md +0 -0
  140. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/groove-orientation.md +0 -0
  141. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/icc-correction.md +0 -0
  142. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/overview.md +0 -0
  143. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/reading-outputs.md +0 -0
  144. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/row-groups.md +0 -0
  145. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/scars-and-masking.md +0 -0
  146. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/swath-statistics.md +0 -0
  147. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/wiki/tip-correction.md +0 -0
  148. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/metrology/workflows.py +0 -0
  149. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/problem.py +0 -0
  150. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/profiles/__init__.py +0 -0
  151. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/profiles/_base.py +0 -0
  152. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/profiles/_polyline.py +0 -0
  153. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/profiles/_shapes.py +0 -0
  154. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/profiles/_trapezoid.py +0 -0
  155. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/profiles/_types.py +0 -0
  156. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/resolution.py +0 -0
  157. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/result.py +0 -0
  158. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/__init__.py +0 -0
  159. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/_conditioning.py +0 -0
  160. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/_execution.py +0 -0
  161. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/_scalar_groove.py +0 -0
  162. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/base.py +0 -0
  163. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/cmethod/__init__.py +0 -0
  164. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/cmethod/_core.py +0 -0
  165. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/cmethod/_series.py +0 -0
  166. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/__init__.py +0 -0
  167. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/_boundary.py +0 -0
  168. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/_core.py +0 -0
  169. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/_finite.py +0 -0
  170. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/_greens.py +0 -0
  171. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/_kernels.py +0 -0
  172. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/integral/_nystrom.py +0 -0
  173. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/rcwa/__init__.py +0 -0
  174. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/rcwa/_core.py +0 -0
  175. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/rcwa/_stack.py +0 -0
  176. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab/solvers/scalar.py +0 -0
  177. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab.egg-info/dependency_links.txt +0 -0
  178. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab.egg-info/entry_points.txt +0 -0
  179. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab.egg-info/requires.txt +0 -0
  180. {gratinglab-0.3.17 → gratinglab-0.4.0}/src/gratinglab.egg-info/top_level.txt +0 -0
  181. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_changelog.py +0 -0
  182. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_checks.py +0 -0
  183. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_cmethod.py +0 -0
  184. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_compare.py +0 -0
  185. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_conditioning.py +0 -0
  186. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_convergence.py +0 -0
  187. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_cross_method.py +0 -0
  188. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_efficiency_table.py +0 -0
  189. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_four_way.py +0 -0
  190. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_fresnel.py +0 -0
  191. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_geometry.py +0 -0
  192. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_ggp.py +0 -0
  193. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_camera3d.py +0 -0
  194. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_cmethod_options.py +0 -0
  195. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_cmethod_tab.py +0 -0
  196. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_compare_tab.py +0 -0
  197. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_diagram.py +0 -0
  198. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_diagram3d.py +0 -0
  199. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_docs.py +0 -0
  200. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_geometry_window.py +0 -0
  201. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_help_menu.py +0 -0
  202. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_integral_options.py +0 -0
  203. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_launcher.py +0 -0
  204. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_mathtext.py +0 -0
  205. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_orders.py +0 -0
  206. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_polish.py +0 -0
  207. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_provenance.py +0 -0
  208. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_provenance_panel.py +0 -0
  209. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_rcwa_options.py +0 -0
  210. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_richtext.py +0 -0
  211. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_scalar_options.py +0 -0
  212. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_state.py +0 -0
  213. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_gui_theme.py +0 -0
  214. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_illumination.py +0 -0
  215. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_core.py +0 -0
  216. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_corpus.py +0 -0
  217. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_finite.py +0 -0
  218. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_graded.py +0 -0
  219. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_greens.py +0 -0
  220. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_kernels.py +0 -0
  221. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_measured_polygon.py +0 -0
  222. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_operators.py +0 -0
  223. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_integral_solver.py +0 -0
  224. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_io_boundary.py +0 -0
  225. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_label_layout.py +0 -0
  226. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_littrow.py +0 -0
  227. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_measured.py +0 -0
  228. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_perturbation.py +0 -0
  229. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_profiles.py +0 -0
  230. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_rayleigh_anomaly.py +0 -0
  231. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_rcwa.py +0 -0
  232. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_rcwa_benchmarks.py +0 -0
  233. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_refractiveindex.py +0 -0
  234. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_resolution.py +0 -0
  235. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_result.py +0 -0
  236. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_scalar.py +0 -0
  237. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_solver_conformance.py +0 -0
  238. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_solver_execution.py +0 -0
  239. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_solver_progress.py +0 -0
  240. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_trapezoidal_solvers.py +0 -0
  241. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_txl.py +0 -0
  242. {gratinglab-0.3.17 → gratinglab-0.4.0}/tests/test_typical.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gratinglab
3
- Version: 0.3.17
3
+ Version: 0.4.0
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
@@ -257,11 +257,12 @@ material per file, each named after its material:
257
257
  | `Pt.txt` | a [CXRO](https://henke.lbl.gov/optical_constants/) export | x-ray |
258
258
  | `Pt.yml` | a [refractiveindex.info](https://refractiveindex.info) file, renamed from its author's name | ultraviolet to infrared |
259
259
  | `Pt.ari` | a PCGrate table | whatever it covers |
260
+ | `Pt.nk` or `Pt.csv` | your own `wavelength, n, k` columns, such as an ellipsometry export; the header names the unit (`wavelength (nm), n, k`) | whatever it covers |
260
261
 
261
262
  Saving one as `~/.gratinglab/materials/Pt.yml` makes `coating="Pt"` available.
262
263
  `GRATINGLAB_MATERIALS` points to a different directory, and
263
- `materials.from_cxro_file(path)` or `from_refractiveindex_file(path)` reads a single
264
- file without a library. The YAML files require the `refractiveindex` extra.
264
+ `materials.from_cxro_file(path)`, `from_refractiveindex_file(path)` or
265
+ `from_nk_file(path)` reads a single file without a library. The YAML files require the `refractiveindex` extra.
265
266
  [`SOURCES.md`](https://github.com/jamccoy/gratinglab/blob/master/src/gratinglab/materials/data/SOURCES.md)
266
267
  explains why none are distributed.
267
268
 
@@ -272,6 +273,14 @@ an absorption edge or at low energy, the result's provenance says so.
272
273
  [`docs/typical-materials.md`](https://github.com/jamccoy/gratinglab/blob/master/docs/typical-materials.md)
273
274
  has the model and how far it agrees with real tables.
274
275
 
276
+ With tabulated atomic scattering factors, `coating="factors:SiO2@2.2"` computes
277
+ the index of any formula at any density from one `<Symbol>.nff` file per element
278
+ in the library, as CXRO publishes them
279
+ ([henke.lbl.gov/optical_constants/asf.html](https://henke.lbl.gov/optical_constants/asf.html)),
280
+ H to U. It keeps the edge structure the model lacks, and still ignores chemical
281
+ bonding. `coating="Au@17.5"` rescales a CXRO export to another density, such as a
282
+ sputtered film's.
283
+
275
284
  The core install does not include a plotting stack, so a user who only runs the solvers
276
285
  does not install one. A subpackage that needs an optional extra names it when it is
277
286
  missing, instead of failing with a bare `ModuleNotFoundError`.
@@ -330,6 +339,15 @@ ladder, redrawn as the form changes, with no solver. **Send to efficiency window
330
339
  (`Ctrl+E`) copies its form into the efficiency window, opening it if need be, and
331
340
  solves nothing; the efficiency window keeps its own Grating Geometry tab.
332
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
345
+ or wavelength, the 1/e penetration depth in each material, and the thickness the
346
+ 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`.
350
+
333
351
  The windows are built with Qt (PySide6), so `pip install "gratinglab[gui]"` needs no
334
352
  system toolkit to be installed first. PySide6 is licensed under the LGPLv3 and is an
335
353
  optional, dynamically linked extra, so this package remains under the BSD-3 licence.
@@ -213,11 +213,12 @@ material per file, each named after its material:
213
213
  | `Pt.txt` | a [CXRO](https://henke.lbl.gov/optical_constants/) export | x-ray |
214
214
  | `Pt.yml` | a [refractiveindex.info](https://refractiveindex.info) file, renamed from its author's name | ultraviolet to infrared |
215
215
  | `Pt.ari` | a PCGrate table | whatever it covers |
216
+ | `Pt.nk` or `Pt.csv` | your own `wavelength, n, k` columns, such as an ellipsometry export; the header names the unit (`wavelength (nm), n, k`) | whatever it covers |
216
217
 
217
218
  Saving one as `~/.gratinglab/materials/Pt.yml` makes `coating="Pt"` available.
218
219
  `GRATINGLAB_MATERIALS` points to a different directory, and
219
- `materials.from_cxro_file(path)` or `from_refractiveindex_file(path)` reads a single
220
- file without a library. The YAML files require the `refractiveindex` extra.
220
+ `materials.from_cxro_file(path)`, `from_refractiveindex_file(path)` or
221
+ `from_nk_file(path)` reads a single file without a library. The YAML files require the `refractiveindex` extra.
221
222
  [`SOURCES.md`](https://github.com/jamccoy/gratinglab/blob/master/src/gratinglab/materials/data/SOURCES.md)
222
223
  explains why none are distributed.
223
224
 
@@ -228,6 +229,14 @@ an absorption edge or at low energy, the result's provenance says so.
228
229
  [`docs/typical-materials.md`](https://github.com/jamccoy/gratinglab/blob/master/docs/typical-materials.md)
229
230
  has the model and how far it agrees with real tables.
230
231
 
232
+ With tabulated atomic scattering factors, `coating="factors:SiO2@2.2"` computes
233
+ the index of any formula at any density from one `<Symbol>.nff` file per element
234
+ in the library, as CXRO publishes them
235
+ ([henke.lbl.gov/optical_constants/asf.html](https://henke.lbl.gov/optical_constants/asf.html)),
236
+ H to U. It keeps the edge structure the model lacks, and still ignores chemical
237
+ bonding. `coating="Au@17.5"` rescales a CXRO export to another density, such as a
238
+ sputtered film's.
239
+
231
240
  The core install does not include a plotting stack, so a user who only runs the solvers
232
241
  does not install one. A subpackage that needs an optional extra names it when it is
233
242
  missing, instead of failing with a bare `ModuleNotFoundError`.
@@ -286,6 +295,15 @@ ladder, redrawn as the form changes, with no solver. **Send to efficiency window
286
295
  (`Ctrl+E`) copies its form into the efficiency window, opening it if need be, and
287
296
  solves nothing; the efficiency window keeps its own Grating Geometry tab.
288
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
301
+ or wavelength, the 1/e penetration depth in each material, and the thickness the
302
+ 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`.
306
+
289
307
  The windows are built with Qt (PySide6), so `pip install "gratinglab[gui]"` needs no
290
308
  system toolkit to be installed first. PySide6 is licensed under the LGPLv3 and is an
291
309
  optional, dynamically linked extra, so this package remains under the BSD-3 licence.
@@ -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.3.17"
25
+ __version__ = "0.4.0"
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.3.17"
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-15"
35
+ __version_date__ = "2026-11-16"
36
36
 
37
37
  __all__ = [
38
38
  "Illumination",
@@ -0,0 +1,172 @@
1
+ """What the Mirror tab computes, draws and says, with no Qt in it.
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.
9
+
10
+ Called by :mod:`gratinglab.gui.qt.mirror_tab`; tested in
11
+ ``tests/test_mirror_view.py``.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from dataclasses import dataclass
17
+
18
+ import numpy as np
19
+ from numpy.typing import NDArray
20
+
21
+ from ..mirror import Mirror
22
+ from .provenance import Line
23
+ from .state import FieldError, FormErrors, FormState, _build_layers, _number
24
+ from .theme import order_colors, set_titles, style_axes
25
+
26
+ __all__ = ["MirrorSettings", "MirrorResult", "compute", "draw", "lines"]
27
+
28
+ #: Most points one scan evaluates; each one sweeps a thickness for the bulk test.
29
+ MAX_POINTS = 1000
30
+
31
+
32
+ @dataclass(frozen=True, slots=True)
33
+ class MirrorSettings:
34
+ """The tab's own fields, as typed."""
35
+
36
+ scan: str = "angle" # "angle" or "wavelength"
37
+ graze_start: str = "0.1"
38
+ graze_stop: str = "6.0"
39
+ graze_count: str = "300"
40
+ graze: str = "2.0" # deg, the fixed graze for a wavelength scan
41
+ wavelength: str = "1.0" # nm, the fixed wavelength for an angle scan
42
+ polarization: str = "unpolarized"
43
+ tolerance: str = "1e-3"
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class MirrorResult:
48
+ mirror: Mirror
49
+ scan: str
50
+ x: NDArray[np.float64] # graze in deg, or wavelength in nm
51
+ fixed: float # the wavelength (angle scan) or graze (wavelength scan)
52
+ reflectivity: NDArray[np.float64]
53
+ depths: dict[str, NDArray[np.float64]]
54
+ #: Thickness the outermost layer needs to read as bulk, per point, or None.
55
+ bulk: NDArray[np.float64] | None
56
+ tolerance: float
57
+ polarization: str
58
+
59
+
60
+ def compute(form: FormState, settings: MirrorSettings) -> MirrorResult:
61
+ """Build the mirror and evaluate it, raising :class:`FormErrors` for
62
+ every bad field at once."""
63
+ errors: list[FieldError] = []
64
+ substrate = form.coating.strip()
65
+ if not substrate:
66
+ errors.append(FieldError("coating", "a mirror needs a substrate: set Coating"))
67
+ roughness = _number(form.roughness, "roughness", errors, minimum=0.0)
68
+ layers = _build_layers(form.layers, errors)
69
+ tolerance = _number(settings.tolerance, "tolerance", errors, minimum=0.0, exclusive_min=True, maximum=1.0)
70
+ if settings.polarization not in ("s", "p", "unpolarized"):
71
+ errors.append(FieldError("polarization", "must be s, p or unpolarized"))
72
+ if settings.scan == "angle":
73
+ start = _number(settings.graze_start, "graze_start", errors, minimum=0.0, exclusive_min=True, maximum=90.0)
74
+ stop = _number(settings.graze_stop, "graze_stop", errors, minimum=0.0, exclusive_min=True, maximum=90.0)
75
+ count = _number(settings.graze_count, "graze_count", errors, minimum=2, maximum=MAX_POINTS, integer=True)
76
+ fixed = _number(settings.wavelength, "wavelength", errors, minimum=0.0, exclusive_min=True)
77
+ 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)
81
+ fixed = _number(settings.graze, "graze", errors, minimum=0.0, exclusive_min=True, maximum=90.0)
82
+ else:
83
+ raise ValueError(f"scan must be 'angle' or 'wavelength', got {settings.scan!r}")
84
+ if start is not None and stop is not None and stop <= start:
85
+ errors.append(FieldError(f"{'graze' if settings.scan == 'angle' else 'wavelength'}_stop", "must exceed the start"))
86
+ if errors:
87
+ raise FormErrors(tuple(errors))
88
+
89
+ mirror = Mirror(substrate, layers, roughness)
90
+ x = np.linspace(start, stop, int(count))
91
+ graze, wl = (x, np.full_like(x, fixed)) if settings.scan == "angle" else (np.full_like(x, fixed), x)
92
+ reflectivity = mirror.reflectivity(graze, wl, settings.polarization)
93
+ depths = mirror.penetration_depth(graze, wl)
94
+ bulk = None
95
+ if layers:
96
+ bulk = np.array([
97
+ mirror.bulk_thickness(g, w, tolerance, settings.polarization) for g, w in zip(graze, wl)
98
+ ])
99
+ return MirrorResult(mirror, settings.scan, x, fixed, reflectivity, depths, bulk, tolerance, settings.polarization)
100
+
101
+
102
+ def _x_label(result: MirrorResult) -> str:
103
+ return "graze angle (deg)" if result.scan == "angle" else "wavelength (nm)"
104
+
105
+
106
+ def _fixed(result: MirrorResult) -> str:
107
+ return f"at {result.fixed:g} nm" if result.scan == "angle" else f"at {result.fixed:g} deg graze"
108
+
109
+
110
+ def draw(r_axes, depth_axes, result: MirrorResult, theme, log_r: bool = True) -> None:
111
+ """Reflectivity above; 1/e depth per material and the bulk thickness below."""
112
+ for axes in (r_axes, depth_axes):
113
+ axes.clear()
114
+ style_axes(axes, theme)
115
+ r_axes.plot(result.x, result.reflectivity, color=theme.ink)
116
+ r_axes.set_yscale("log" if log_r else "linear")
117
+ r_axes.set_ylabel("reflectivity")
118
+ set_titles(r_axes, "Specular reflectivity", f"{result.polarization}, {_fixed(result)}", theme)
119
+
120
+ colors = order_colors(range(len(result.depths)), theme)
121
+ for i, (name, depth) in enumerate(result.depths.items()):
122
+ depth_axes.plot(result.x, depth, color=colors[i], label=f"1/e depth in {name}")
123
+ if result.bulk is not None:
124
+ top = result.mirror.layers[-1]
125
+ depth_axes.plot(result.x, result.bulk, color=theme.ink, linestyle="--",
126
+ label=f"{top.material} needed to read as bulk")
127
+ depth_axes.axhline(top.thickness, color=theme.muted, linestyle=":",
128
+ label=f"{top.material} as deposited, {top.thickness:g} nm")
129
+ depth_axes.set_yscale("log")
130
+ depth_axes.set_ylabel("depth (nm)")
131
+ depth_axes.set_xlabel(_x_label(result))
132
+ set_titles(depth_axes, "How deep", f"bulk within {result.tolerance:g} of R", theme)
133
+ depth_axes.legend(fontsize=8, loc="best")
134
+
135
+
136
+ def lines(result: MirrorResult) -> tuple[Line, ...]:
137
+ """The panel: the stack, then the answer to "is the top layer bulk"."""
138
+ m = result.mirror
139
+ stack = " / ".join(
140
+ ["vacuum", *(f"{layer.material} {layer.thickness:g} nm" for layer in reversed(m.layers)),
141
+ f"{m.substrate} (substrate)"]
142
+ )
143
+ out = [Line("stack: ", "dim"), Line(stack + "\n"), Line(f"{_fixed(result)}, {result.polarization}", "dim")]
144
+ if m.roughness:
145
+ out.append(Line(f", {m.roughness:g} nm RMS at every interface", "dim"))
146
+ out.append(Line("\n"))
147
+ if result.bulk is None:
148
+ out.append(Line("No layers: the substrate is the whole mirror, so there is no thickness to test.\n", "dim"))
149
+ return tuple(out)
150
+ top = m.layers[-1]
151
+ enough = result.bulk <= top.thickness
152
+ unit = "deg" if result.scan == "angle" else "nm"
153
+ 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")]
157
+ elif not enough.any():
158
+ 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")]
162
+ else:
163
+ x = result.x[enough]
164
+ 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")]
169
+ depth = result.depths[top.material]
170
+ out.append(Line(f"1/e depth in {top.material}: {np.nanmin(depth):.3g} to {np.nanmax(depth):.3g} nm "
171
+ "over the scan.\n", "dim"))
172
+ return tuple(out)
@@ -136,21 +136,28 @@ class GeometryPanel(QWidget):
136
136
 
137
137
  surface = QGroupBox("Surface")
138
138
  surface_form = QFormLayout(surface)
139
- # A dropdown, not a text field: the set of materials is finite and
140
- # known, and a free-form string is what let `coating` mean nothing for
141
- # four milestones. Empty entry first, because no coating is the
142
- # ordinary default and gives relative efficiency -- a correct answer to
143
- # a different question, not a missing input.
139
+ # A dropdown of the library, so an installed table is one click; and
140
+ # editable, because typical:, factors: and Au@17.5 names resolve with
141
+ # no file to list. A free-form string is what let `coating` mean
142
+ # nothing for four milestones, so a typed name is still resolved by
143
+ # `state.build` and refused there if nothing answers to it. Empty
144
+ # entry first, because no coating is the ordinary default and gives
145
+ # relative efficiency -- a correct answer to a different question.
144
146
  coating = QComboBox()
147
+ coating.setEditable(True)
148
+ coating.setInsertPolicy(QComboBox.InsertPolicy.NoInsert)
145
149
  coating.setToolTip(
146
150
  "With no coating, efficiencies are relative to a perfect "
147
151
  "reflector. Naming a material makes them absolute: the Scalar "
148
152
  "tab applies its Fresnel "
149
153
  "reflectivity, and the Integral tab reads its complex index when "
150
154
  'Conductivity is "tabulated" (and ignores it when "perfect"). '
151
- "The provenance panel shows which applies."
155
+ "The provenance panel shows which applies.\n"
156
+ "Pick a table from your library, or type a model: typical:Au, "
157
+ "factors:SiO2@2.2, or Au@17.5 for a table at another density."
152
158
  )
153
159
  coating.activated.connect(lambda _i: self.changed.emit())
160
+ coating.lineEdit().editingFinished.connect(self.changed.emit)
154
161
  self._fields["coating"] = coating
155
162
  self.refresh_coatings()
156
163
  surface_form.addRow("Coating", coating)
@@ -227,7 +234,7 @@ class GeometryPanel(QWidget):
227
234
  from ...materials import available
228
235
 
229
236
  combo = self._fields["coating"]
230
- current = combo.currentData() or ""
237
+ current = _value(combo)
231
238
  try:
232
239
  names = available()
233
240
  except ValueError: # two tables for one name; Setup reports it
@@ -240,9 +247,11 @@ class GeometryPanel(QWidget):
240
247
  combo.addItem(name, userData=name)
241
248
  index = combo.findData(current)
242
249
  combo.setCurrentIndex(max(index, 0))
250
+ if index < 0 and _is_model_name(current):
251
+ combo.setEditText(current) # never in a library listing
243
252
  finally:
244
253
  combo.blockSignals(False)
245
- if current and index < 0:
254
+ if current and index < 0 and not _is_model_name(current):
246
255
  self.changed.emit()
247
256
 
248
257
  def _check_fields_match_formstate(self) -> None:
@@ -308,6 +317,8 @@ class GeometryPanel(QWidget):
308
317
  if index < 0:
309
318
  index = widget.findText(value)
310
319
  widget.setCurrentIndex(max(index, 0))
320
+ if index < 0 and value and widget.isEditable():
321
+ widget.setEditText(value)
311
322
  else:
312
323
  widget.setText(value)
313
324
  path = form.profile_path
@@ -363,6 +374,20 @@ def _value(widget: QWidget) -> str:
363
374
  unknown material name.
364
375
  """
365
376
  if isinstance(widget, QComboBox):
377
+ if widget.isEditable():
378
+ # A typed name leaves the current index where it was, so read
379
+ # the text, and map it back to its data when it names an item.
380
+ text = widget.currentText().strip()
381
+ index = widget.findText(text)
382
+ if index < 0:
383
+ return text
384
+ data = widget.itemData(index)
385
+ return text if data is None else str(data)
366
386
  data = widget.currentData()
367
387
  return widget.currentText() if data is None else str(data)
368
388
  return widget.text()
389
+
390
+
391
+ def _is_model_name(name: str) -> bool:
392
+ """A coating that resolves without a library file, so no listing has it."""
393
+ return name.startswith(("typical:", "factors:")) or "@" in name
@@ -45,6 +45,7 @@ from .cmethod_tab import CMethodTab
45
45
  from .compare_tab import CompareTab
46
46
  from .geometry_panel import GeometryPanel
47
47
  from .geometry_tab import GeometryTab
48
+ from .mirror_tab import MirrorTab
48
49
  from .integral_tab import IntegralTab
49
50
  from .rcwa_tab import RcwaTab
50
51
  from .scalar_tab import ScalarTab
@@ -221,6 +222,14 @@ class MainWindow(QMainWindow):
221
222
  self.geometry_tab = GeometryTab()
222
223
  self._tab_widget.addTab(self.geometry_tab, "Grating Geometry")
223
224
 
225
+ # About the problem too, so it sits with Geometry rather than among
226
+ # the solvers, and like it is not in `self.tabs`: no solve contract.
227
+ self.mirror_tab = MirrorTab(self.geometry.read_form)
228
+ index = self._tab_widget.addTab(self.mirror_tab, "Mirror")
229
+ self._tab_widget.setTabToolTip(
230
+ index, "The coating stack as a flat mirror: reflectivity and penetration depth"
231
+ )
232
+
224
233
  for name in available_solvers():
225
234
  factory = _TAB_FACTORIES.get(name)
226
235
  if factory is None:
@@ -0,0 +1,212 @@
1
+ """The Mirror tab: the coating stack as a flat mirror, before any grooves.
2
+
3
+ Reads the stack from the geometry dock through ``read_form`` (Coating is the
4
+ substrate, then Layers and Roughness) and its own fields for the scan, and
5
+ shows the reflectivity, how deep the field reaches into each material, and
6
+ whether the outermost layer is thick enough to treat as bulk. Everything it
7
+ computes and says is in :mod:`gratinglab.gui.mirror_view`; this is widgets.
8
+
9
+ Built by :class:`~gratinglab.gui.qt.main_window.MainWindow`, beside the
10
+ Grating Geometry tab. It solves in the GUI thread, since a scan takes about a
11
+ second; it is not a solver and has no worker.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from typing import Callable
17
+
18
+ from endstation.qt.canvas import restyle_toolbar
19
+ from PySide6.QtCore import Qt
20
+ from PySide6.QtWidgets import (
21
+ QCheckBox,
22
+ QComboBox,
23
+ QFormLayout,
24
+ QGroupBox,
25
+ QLabel,
26
+ QLineEdit,
27
+ QPushButton,
28
+ QScrollArea,
29
+ QSplitter,
30
+ QTextEdit,
31
+ QVBoxLayout,
32
+ QWidget,
33
+ )
34
+
35
+ from .. import provenance
36
+ from ..mirror_view import MirrorResult, MirrorSettings, compute, draw, lines
37
+ from ..state import FormErrors, FormState
38
+ from ..theme import provenance_colors, style_figure
39
+ from . import theming
40
+ from .sizing import fit_width_to_contents
41
+
42
+ __all__ = ["MirrorTab"]
43
+
44
+
45
+ class MirrorTab(QWidget):
46
+ """Reflectivity and penetration of the dock's coating stack."""
47
+
48
+ def __init__(self, read_form: Callable[[], FormState], parent: QWidget | None = None) -> None:
49
+ super().__init__(parent)
50
+ self._read_form = read_form
51
+ self._result: MirrorResult | None = None
52
+ self._lines: tuple = ()
53
+ self._fields: dict[str, QLineEdit] = {}
54
+ self._build()
55
+
56
+ # -- construction ----------------------------------------------------
57
+
58
+ def _build(self) -> None:
59
+ controls = QWidget()
60
+ column = QVBoxLayout(controls)
61
+ column.setContentsMargins(0, 0, 0, 0)
62
+ column.addWidget(self._build_scan_group())
63
+ self._calculate = QPushButton("Calculate")
64
+ self._calculate.setToolTip("Reflect from the dock's Coating, Layers and Roughness as a flat mirror.")
65
+ self._calculate.clicked.connect(self.calculate)
66
+ column.addWidget(self._calculate)
67
+ column.addStretch(1)
68
+
69
+ scroller = QScrollArea()
70
+ scroller.setWidget(controls)
71
+ scroller.setWidgetResizable(True)
72
+ fit_width_to_contents(scroller)
73
+
74
+ right = QSplitter(Qt.Orientation.Vertical)
75
+ right.addWidget(self._build_plot())
76
+ right.addWidget(self._build_panel())
77
+ right.setStretchFactor(0, 1)
78
+ right.setSizes([560, 160])
79
+
80
+ body = QSplitter(Qt.Orientation.Horizontal)
81
+ body.addWidget(scroller)
82
+ body.addWidget(right)
83
+ body.setStretchFactor(1, 1)
84
+ body.setSizes([260, 700])
85
+
86
+ outer = QVBoxLayout(self)
87
+ outer.setContentsMargins(0, 0, 0, 0)
88
+ outer.addWidget(body)
89
+
90
+ def _build_scan_group(self) -> QGroupBox:
91
+ defaults = MirrorSettings()
92
+ group = QGroupBox("Scan")
93
+ form = QFormLayout(group)
94
+
95
+ self._scan = QComboBox()
96
+ self._scan.addItem("Graze angle", "angle")
97
+ self._scan.addItem("Wavelength (dock's scan)", "wavelength")
98
+ self._scan.currentIndexChanged.connect(self._on_scan_change)
99
+ form.addRow("Scan", self._scan)
100
+
101
+ def entry(label: str, key: str, tip: str) -> None:
102
+ field = QLineEdit(getattr(defaults, key))
103
+ field.setToolTip(tip)
104
+ field.returnPressed.connect(self.calculate)
105
+ self._fields[key] = field
106
+ form.addRow(label, field)
107
+
108
+ entry("From (deg)", "graze_start", "Graze angle from the surface; 0 is grazing.")
109
+ entry("To (deg)", "graze_stop", "Graze angle from the surface.")
110
+ entry("Points", "graze_count", "Angles in the scan, at most 1000.")
111
+ entry("At wavelength (nm)", "wavelength", "The one wavelength an angle scan uses.")
112
+ entry("At graze (deg)", "graze", "The one graze angle a wavelength scan uses.")
113
+
114
+ self._polarization = QComboBox()
115
+ for label, value in (("Unpolarized", "unpolarized"), ("s", "s"), ("p", "p")):
116
+ self._polarization.addItem(label, value)
117
+ self._polarization.setToolTip("s and p are local to the mirror's plane of incidence.")
118
+ form.addRow("Polarization", self._polarization)
119
+
120
+ entry("Bulk within", "tolerance",
121
+ "The outermost layer reads as bulk once the layers beneath it\n"
122
+ "change the reflectivity by less than this, relative.")
123
+ self._log = QCheckBox("Log reflectivity")
124
+ self._log.setChecked(True)
125
+ self._log.toggled.connect(self._redraw)
126
+ form.addRow(self._log)
127
+ self._on_scan_change()
128
+ return group
129
+
130
+ def _build_plot(self) -> QWidget:
131
+ from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg, NavigationToolbar2QT
132
+ from matplotlib.figure import Figure
133
+
134
+ self._figure = Figure(figsize=(8, 5), layout="constrained")
135
+ grid = self._figure.add_gridspec(2, 1, height_ratios=(1, 1))
136
+ self._r_axes = self._figure.add_subplot(grid[0])
137
+ self._depth_axes = self._figure.add_subplot(grid[1], sharex=self._r_axes)
138
+ self._canvas = FigureCanvasQTAgg(self._figure)
139
+ style_figure(self._figure, theming.current())
140
+ theming.subscribe(self._on_theme)
141
+
142
+ panel = QWidget()
143
+ layout = QVBoxLayout(panel)
144
+ layout.setContentsMargins(0, 0, 0, 0)
145
+ self._toolbar = NavigationToolbar2QT(self._canvas, panel)
146
+ layout.addWidget(self._toolbar)
147
+ layout.addWidget(self._canvas)
148
+ return panel
149
+
150
+ def _build_panel(self) -> QWidget:
151
+ panel = QWidget()
152
+ layout = QVBoxLayout(panel)
153
+ layout.setContentsMargins(8, 4, 8, 8)
154
+ heading = QLabel("Mirror")
155
+ bold = heading.font()
156
+ bold.setBold(True)
157
+ heading.setFont(bold)
158
+ self._panel = QTextEdit()
159
+ self._panel.setReadOnly(True)
160
+ layout.addWidget(heading)
161
+ layout.addWidget(self._panel)
162
+ self._paint((provenance.Line(
163
+ "The dock's Coating is the substrate, under its Layers (innermost "
164
+ "first). Press Calculate to see how far the light goes in, and "
165
+ "whether the top layer can be treated as bulk.\n", "dim",
166
+ ),))
167
+ return panel
168
+
169
+ # -- what the window and tests ask ---------------------------------------
170
+
171
+ def settings(self) -> MirrorSettings:
172
+ values = {key: field.text() for key, field in self._fields.items()}
173
+ return MirrorSettings(scan=self._scan.currentData(), polarization=self._polarization.currentData(), **values)
174
+
175
+ def calculate(self) -> None:
176
+ try:
177
+ self._result = compute(self._read_form(), self.settings())
178
+ except FormErrors as exc:
179
+ self._result = None
180
+ self._paint(provenance.error_lines(exc.errors))
181
+ return
182
+ except (ValueError, KeyError) as exc:
183
+ # A material that does not cover the scan, or one not installed.
184
+ self._result = None
185
+ self._paint((provenance.Line(f"{exc}\n", "bad"),))
186
+ return
187
+ self._redraw()
188
+
189
+ # -- internals -------------------------------------------------------
190
+
191
+ def _on_scan_change(self, *_args) -> None:
192
+ angle = self._scan.currentData() == "angle"
193
+ for key in ("graze_start", "graze_stop", "graze_count", "wavelength"):
194
+ self._fields[key].setEnabled(angle)
195
+ self._fields["graze"].setEnabled(not angle)
196
+
197
+ def _paint(self, lines_) -> None:
198
+ self._lines = tuple(lines_)
199
+ self._panel.setHtml(provenance.to_html(self._lines, provenance_colors(theming.current())))
200
+
201
+ def _on_theme(self, theme) -> None:
202
+ restyle_toolbar(self._toolbar, theme)
203
+ style_figure(self._figure, theme)
204
+ self._redraw()
205
+ if self._lines:
206
+ self._paint(self._lines)
207
+
208
+ def _redraw(self, *_args) -> None:
209
+ if self._result is not None:
210
+ draw(self._r_axes, self._depth_axes, self._result, theming.current(), self._log.isChecked())
211
+ self._paint(lines(self._result))
212
+ self._canvas.draw_idle()
@@ -302,7 +302,10 @@ class SetupTab(QWidget):
302
302
  chosen = self._choose_file()
303
303
  if not chosen:
304
304
  return
305
- name = self._choose_name(Path(chosen).stem)
305
+ # One element's scattering factors are filed under its symbol, which
306
+ # the file name already gives, so there is no coating name to ask for.
307
+ factors = Path(chosen).suffix.lower() == ".nff"
308
+ name = Path(chosen).stem.capitalize() if factors else self._choose_name(Path(chosen).stem)
306
309
  if not name:
307
310
  return
308
311
  try:
@@ -318,10 +321,16 @@ class SetupTab(QWidget):
318
321
  self._status.setText(f"{Path(chosen).name} was not added: {refused}")
319
322
  return
320
323
  self._render()
321
- self._status.setText(
322
- f"Added {name} from {Path(chosen).name} as {written}. It is in the "
323
- "Coating dropdown now."
324
- )
324
+ if factors:
325
+ self._status.setText(
326
+ f"Added {name}'s scattering factors as {written}. Use them as "
327
+ f"factors:<formula>@<density>, e.g. factors:{name}@<g/cm^3>."
328
+ )
329
+ else:
330
+ self._status.setText(
331
+ f"Added {name} from {Path(chosen).name} as {written}. It is in the "
332
+ "Coating dropdown now."
333
+ )
325
334
  self.library_changed.emit()
326
335
 
327
336
  def open_library_folder(self) -> None:
@@ -344,7 +353,8 @@ class SetupTab(QWidget):
344
353
  self,
345
354
  "Add material",
346
355
  recent.start_in("tables", fallback=str(Path.home())),
347
- "Optical constants (*.txt *.yml *.yaml *.ari);;All files (*)",
356
+ "Optical constants or scattering factors "
357
+ "(*.txt *.yml *.yaml *.ari *.nk *.csv *.nff);;All files (*)",
348
358
  )
349
359
  recent.remember("tables", path)
350
360
  return path