syncmoss 0.8.3__tar.gz → 0.8.4__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 (310) hide show
  1. {syncmoss-0.8.3 → syncmoss-0.8.4}/.gitignore +4 -1
  2. {syncmoss-0.8.3/syncmoss.egg-info → syncmoss-0.8.4}/PKG-INFO +1 -1
  3. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Calibration.py +49 -35
  4. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library_io.py +10 -3
  5. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/compile_functions.py +2 -1
  6. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/constants.py +9 -0
  7. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/fitting_io.py +38 -31
  8. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/hamiltonian_dual.py +25 -3
  9. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/legacy.py +57 -28
  10. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/main.py +38 -1
  11. syncmoss-0.8.4/syncmoss/model_calibration.py +409 -0
  12. syncmoss-0.8.4/syncmoss/model_calibration_window.py +292 -0
  13. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/model_io.py +18 -12
  14. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/models.py +112 -55
  15. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/models_dual.py +9 -5
  16. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/models_positions.py +5 -4
  17. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/one_model.py +13 -5
  18. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/help.md +18 -0
  19. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/help_extended.md +124 -29
  20. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/models_description.md +25 -10
  21. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters_table.py +28 -21
  22. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/spectrum_plotter.py +26 -36
  23. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/syncmoss_main.py +37 -20
  24. {syncmoss-0.8.3 → syncmoss-0.8.4/syncmoss.egg-info}/PKG-INFO +1 -1
  25. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss.egg-info/SOURCES.txt +3 -0
  26. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss.egg-info/scm_file_list.json +3 -0
  27. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/golden_models.json +8 -0
  28. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/resource_profile.json +123 -11
  29. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_calibrate_menu.py +29 -7
  30. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_calibration.py +34 -0
  31. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_console_io.py +35 -0
  32. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_faddeeva.py +2 -2
  33. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_hamiltonian_dual.py +15 -12
  34. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_hamiltonian_texture.py +202 -45
  35. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_legacy.py +40 -22
  36. syncmoss-0.8.4/tests/test_model_calibration.py +317 -0
  37. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_model_io.py +5 -5
  38. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_models_dual.py +7 -5
  39. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_polarization.py +11 -10
  40. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_sms_theory.py +3 -2
  41. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_thick_gui.py +40 -25
  42. {syncmoss-0.8.3 → syncmoss-0.8.4}/.gitattributes +0 -0
  43. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/Tests.yml +0 -0
  44. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_MacOS.yml +0 -0
  45. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_PyPI.yml +0 -0
  46. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_TagRelease.yml +0 -0
  47. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_Tests.yml +0 -0
  48. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_UploadRelease.yml +0 -0
  49. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_Version.yml +0 -0
  50. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_Wheels.yml +0 -0
  51. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/_WindowsExe.yml +0 -0
  52. {syncmoss-0.8.3 → syncmoss-0.8.4}/.github/workflows/release.yml +0 -0
  53. {syncmoss-0.8.3 → syncmoss-0.8.4}/.vscode/settings.json +0 -0
  54. {syncmoss-0.8.3 → syncmoss-0.8.4}/COPYING.txt +0 -0
  55. {syncmoss-0.8.3 → syncmoss-0.8.4}/LICENSE +0 -0
  56. {syncmoss-0.8.3 → syncmoss-0.8.4}/Lib_test/test.mdl +0 -0
  57. {syncmoss-0.8.3 → syncmoss-0.8.4}/NOTICE.txt +0 -0
  58. {syncmoss-0.8.3 → syncmoss-0.8.4}/README.md +0 -0
  59. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/MacOS.spec +0 -0
  60. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/SYNCmoss.png +0 -0
  61. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/Windows.spec +0 -0
  62. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/bundle.py +0 -0
  63. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/dmg_background.pdf +0 -0
  64. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/licenses/GPL-3.0.txt +0 -0
  65. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/licenses/LGPL-3.0.txt +0 -0
  66. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/macos_bundle.py +0 -0
  67. {syncmoss-0.8.3 → syncmoss-0.8.4}/bundle/third_party_licenses.py +0 -0
  68. {syncmoss-0.8.3 → syncmoss-0.8.4}/docs/thick_models.md +0 -0
  69. {syncmoss-0.8.3 → syncmoss-0.8.4}/docs/thick_vs_thin.md +0 -0
  70. {syncmoss-0.8.3 → syncmoss-0.8.4}/pyproject.toml +0 -0
  71. {syncmoss-0.8.3 → syncmoss-0.8.4}/requirements.txt +0 -0
  72. {syncmoss-0.8.3 → syncmoss-0.8.4}/setup.cfg +0 -0
  73. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/CMS_source_geometry_calibration.py +0 -0
  74. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/ASM P(m) from m.mdl +0 -0
  75. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/ASM m from P(m).mdl +0 -0
  76. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Central shift vs temperature.mdl +0 -0
  77. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field in applied field, Langevin.mdl +0 -0
  78. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field vs temperature, Bloch.mdl +0 -0
  79. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field vs temperature, critical.mdl +0 -0
  80. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field vs temperature, empirical.mdl +0 -0
  81. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Lamb-Mossbauer factor vs temperature.mdl +0 -0
  82. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Lifetime from line width.mdl +0 -0
  83. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Neel relaxation time vs temperature.mdl +0 -0
  84. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Paramagnetic quadrupole shift from Hamiltonian.mdl +0 -0
  85. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Quadrupole splitting, doublet.mdl +0 -0
  86. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Quadrupole splitting, sextet.mdl +0 -0
  87. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Thickness PDF, Gamma.mdl +0 -0
  88. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Thickness PDF, pressed window (clamped plate).mdl +0 -0
  89. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Expressions/Thickness PDF, pressed window (membrane).mdl +0 -0
  90. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Hamiltonian_helper.py +0 -0
  91. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Aegirine.mdl +0 -0
  92. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Akaganeite.mdl +0 -0
  93. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Almandine.mdl +0 -0
  94. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Antitaenite.mdl +0 -0
  95. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Arsenopyrite.mdl +0 -0
  96. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Bornite.mdl +0 -0
  97. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Bridgmanite (Fe,Al-bearing) @100 GPa.mdl +0 -0
  98. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Bridgmanite (Fe,Al-bearing).mdl +0 -0
  99. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Celadonite.mdl +0 -0
  100. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Cementite.mdl +0 -0
  101. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Chalcopyrite.mdl +0 -0
  102. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Clinopyroxene (augite).mdl +0 -0
  103. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Copiapite.mdl +0 -0
  104. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Cubanite.mdl +0 -0
  105. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Epidote.mdl +0 -0
  106. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Fayalite (Fe-olivine).mdl +0 -0
  107. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Ferrihydrite (2-line).mdl +0 -0
  108. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Ferropericlase.mdl +0 -0
  109. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Goethite.mdl +0 -0
  110. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Green rust (fougerite, carbonate).mdl +0 -0
  111. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Haegg carbide.mdl +0 -0
  112. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Hedenbergite.mdl +0 -0
  113. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Hematite.mdl +0 -0
  114. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Heterosite (FePO4).mdl +0 -0
  115. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Ilmenite.mdl +0 -0
  116. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Iron phosphide.mdl +0 -0
  117. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Isocubanite.mdl +0 -0
  118. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Jarosite.mdl +0 -0
  119. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Kamacite.mdl +0 -0
  120. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Lepidocrocite.mdl +0 -0
  121. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Maghemite.mdl +0 -0
  122. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Magnetite.mdl +0 -0
  123. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Marcasite.mdl +0 -0
  124. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Melanterite.mdl +0 -0
  125. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Orthopyroxene (enstatite-ferrosilite).mdl +0 -0
  126. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Prussian blue (ferric ferrocyanide).mdl +0 -0
  127. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Pyrite.mdl +0 -0
  128. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Pyrrhotite.mdl +0 -0
  129. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Rhomboclase.mdl +0 -0
  130. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Roemerite.mdl +0 -0
  131. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Siderite.mdl +0 -0
  132. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Szomolnokite.mdl +0 -0
  133. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Taenite.mdl +0 -0
  134. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Talnakhite.mdl +0 -0
  135. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Tetrataenite.mdl +0 -0
  136. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Triphylite (LiFePO4).mdl +0 -0
  137. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Troilite.mdl +0 -0
  138. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Vivianite.mdl +0 -0
  139. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/Voltaite.mdl +0 -0
  140. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library/alpha-Fe (metallic iron, bcc).mdl +0 -0
  141. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/Library_window.py +0 -0
  142. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/app_paths.py +0 -0
  143. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/bliss_channel.py +0 -0
  144. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/compile_window.py +0 -0
  145. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/components_results.py +0 -0
  146. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/components_search.py +0 -0
  147. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/components_window.py +0 -0
  148. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/console_io.py +0 -0
  149. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/dual_kernels.py +0 -0
  150. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/dual_numbers.py +0 -0
  151. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/error_reporter.py +0 -0
  152. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/exclusion_bar.py +0 -0
  153. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/exclusion_regions.py +0 -0
  154. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/experimental_features.py +0 -0
  155. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/expression_eval.py +0 -0
  156. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/expressions_io.py +0 -0
  157. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/expressions_window.py +0 -0
  158. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/faddeeva.py +0 -0
  159. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/fit_quality.py +0 -0
  160. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/frozen_cache_locator.py +0 -0
  161. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/CheckBox.png +0 -0
  162. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/CheckBox_.png +0 -0
  163. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/CheckBox_L.png +0 -0
  164. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/CheckBox_L2.png +0 -0
  165. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/DU.png +0 -0
  166. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/Switch.png +0 -0
  167. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/UD.png +0 -0
  168. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/icons/icon_r.ico +0 -0
  169. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/instrumental_dialogs.py +0 -0
  170. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/instrumental_io.py +0 -0
  171. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/instrumental_window.py +0 -0
  172. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/jit_cache.py +0 -0
  173. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/license_window.py +0 -0
  174. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/minimi_lib.py +0 -0
  175. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/models_description_window.py +0 -0
  176. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/models_removed.py +0 -0
  177. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/one_spectrum.py +0 -0
  178. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/ABSorber3.txt +0 -0
  179. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/Be.txt +0 -0
  180. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/Calibration.dat +0 -0
  181. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/GCMS.txt +0 -0
  182. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/INS_APS.txt +0 -0
  183. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/INSexp.txt +0 -0
  184. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/INSint.txt +0 -0
  185. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/INSth.txt +0 -0
  186. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/KB.txt +0 -0
  187. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/NFS.txt +0 -0
  188. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/Standard_CMS.dat +0 -0
  189. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/Standard_SMS.dat +0 -0
  190. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/parameters/calibr.png +0 -0
  191. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/result_window.py +0 -0
  192. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/results_table.py +0 -0
  193. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/sms_theory.py +0 -0
  194. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/spectrum_io.py +0 -0
  195. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/spectrum_model.py +0 -0
  196. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/spectrum_parameters.py +0 -0
  197. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/spectrum_reference.py +0 -0
  198. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/spectrum_reference_window.py +0 -0
  199. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/supp_menu.py +0 -0
  200. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/support_math.py +0 -0
  201. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/test_graf.txt +0 -0
  202. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/test_param.txt +0 -0
  203. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/theme_dark.json +0 -0
  204. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/theme_light.json +0 -0
  205. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss/thickness_distribution.py +0 -0
  206. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss.egg-info/dependency_links.txt +0 -0
  207. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss.egg-info/entry_points.txt +0 -0
  208. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss.egg-info/requires.txt +0 -0
  209. {syncmoss-0.8.3 → syncmoss-0.8.4}/syncmoss.egg-info/top_level.txt +0 -0
  210. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/README.md +0 -0
  211. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/compile_stand_ins.py +0 -0
  212. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/conftest.py +0 -0
  213. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/Distr_corr.mdl +0 -0
  214. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/Distr_distr.mdl +0 -0
  215. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/alpha_fe_sms_000.mca +0 -0
  216. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/calibration_000_golden.json +0 -0
  217. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/generate_cal_fixtures.py +0 -0
  218. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/parameters/Calibration.dat +0 -0
  219. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/parameters/GCMS.txt +0 -0
  220. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/parameters/INSexp.txt +0 -0
  221. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/parameters/INSint.txt +0 -0
  222. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/parameters/INSth.txt +0 -0
  223. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/synthetic_alpha_fe_cms_linear.mca +0 -0
  224. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/data/synthetic_alpha_fe_cms_sinus.mca +0 -0
  225. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/profile_resources.py +0 -0
  226. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/syncmoss_test.py +0 -0
  227. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_asm_p.py +0 -0
  228. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_baseline_polynomial.py +0 -0
  229. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_bliss_channel.py +0 -0
  230. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_calculation_time.py +0 -0
  231. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_calibration_helpers.py +0 -0
  232. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_calibration_path.py +0 -0
  233. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_channel_average.py +0 -0
  234. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_chi2_spread.py +0 -0
  235. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_cms_source_geometry_calibration.py +0 -0
  236. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_components_search.py +0 -0
  237. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_contact_author.py +0 -0
  238. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_cosine_smearing.py +0 -0
  239. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_create_spectrum_from_model.py +0 -0
  240. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_default_settings.py +0 -0
  241. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_distr_composition.py +0 -0
  242. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_distr_expansion.py +0 -0
  243. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_distr_mdl.py +0 -0
  244. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_distr_t.py +0 -0
  245. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_distr_targets.py +0 -0
  246. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_distr_text_references.py +0 -0
  247. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_dual_kernels.py +0 -0
  248. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_dual_numbers.py +0 -0
  249. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_error_reporter.py +0 -0
  250. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_exclusion_fit.py +0 -0
  251. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_exclusion_gui.py +0 -0
  252. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_exclusion_regions.py +0 -0
  253. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_expression_fit_start.py +0 -0
  254. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_expression_validation.py +0 -0
  255. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_expressions.py +0 -0
  256. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_find_bar.py +0 -0
  257. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_fit_core.py +0 -0
  258. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_fit_one_spectrum.py +0 -0
  259. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_fit_quality.py +0 -0
  260. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_golden_models.py +0 -0
  261. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_gui_smoke.py +0 -0
  262. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_impurity_presets.py +0 -0
  263. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_instrumental_joint.py +0 -0
  264. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_instrumental_metadata.py +0 -0
  265. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_instrumental_method_choice.py +0 -0
  266. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_instrumental_recentre.py +0 -0
  267. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_instrumental_window.py +0 -0
  268. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_integral_points.py +0 -0
  269. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_interrupt.py +0 -0
  270. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_jacobi_elliptic.py +0 -0
  271. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_jit_cache.py +0 -0
  272. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_library_dir.py +0 -0
  273. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_library_io.py +0 -0
  274. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_license_window.py +0 -0
  275. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_link_chains.py +0 -0
  276. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_minimi_batch_eval.py +0 -0
  277. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_minimi_bounds.py +0 -0
  278. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_minimi_covariance.py +0 -0
  279. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_model_append.py +0 -0
  280. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_model_only_mode.py +0 -0
  281. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_model_pointwise.py +0 -0
  282. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_nbaseline_multidistr.py +0 -0
  283. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_nbaseline_results.py +0 -0
  284. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_node_sum_reuse.py +0 -0
  285. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_one_model_expand.py +0 -0
  286. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_one_model_gui.py +0 -0
  287. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_overwrite_dat_instrumental.py +0 -0
  288. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_parameter_links.py +0 -0
  289. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_recon_composition.py +0 -0
  290. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_recon_mdl.py +0 -0
  291. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_recon_results.py +0 -0
  292. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_recon_variants.py +0 -0
  293. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_reference_shift.py +0 -0
  294. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_replaced_component_skip.py +0 -0
  295. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_result_window.py +0 -0
  296. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_results_table_image.py +0 -0
  297. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_results_table_rows.py +0 -0
  298. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_save_result_model.py +0 -0
  299. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_sdw_grid.py +0 -0
  300. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_search_guards.py +0 -0
  301. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_source_norm.py +0 -0
  302. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_spectrum_model.py +0 -0
  303. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_spectrum_parameters.py +0 -0
  304. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_support_math.py +0 -0
  305. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_table_marks.py +0 -0
  306. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_take_result.py +0 -0
  307. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_texture_s1.py +0 -0
  308. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_theory_search.py +0 -0
  309. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/test_voigt_complex.py +0 -0
  310. {syncmoss-0.8.3 → syncmoss-0.8.4}/tests/worker_plan.py +0 -0
@@ -137,12 +137,15 @@ for_tests/
137
137
  source_code/
138
138
  bundle/build/
139
139
  bundle/Windows/
140
+ bundle/MacOS/
140
141
 
141
142
  # The user's saved settings (Supp -> Save settings as default): never shipped
142
143
  syncmoss/parameters/config.json
143
- # numba's compiled functions (syncmoss/jit_cache.py): the machine's own
144
+ # numba's compiled functions (syncmoss/jit_cache.py): the machine's own --
145
+ # SYNCmoss's, SYNCbunch's and SYNCisot's
144
146
  syncmoss/numba_cache/
145
147
  syncmoss/numba_cache_time/
148
+ syncmoss/numba_cache_isot/
146
149
 
147
150
  # fitting results
148
151
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syncmoss
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: SYNCmoss — Mössbauer spectroscopy analysis application
5
5
  Author: Sergey Yaroslavtsev
6
6
  License: MIT
@@ -304,11 +304,50 @@ def _deepest_line_channels(counts):
304
304
  return ch_min1, ch_min2
305
305
 
306
306
 
307
+ def sine_drive(x, p, n_ch):
308
+ """Velocity at channel x of a sinusoidal drive over *n_ch* channels.
309
+
310
+ p = [amplitude (mm/s), phase (rad), source shift (mm/s)]. The
311
+ n_ch/pi*sin(pi/n_ch) factor averages the sine over one channel width.
312
+ (Calibration's sin_cal; SYNCisot's calibration takes it too.)
313
+ """
314
+ return (p[0] / np.pi * n_ch * np.sin(np.pi / n_ch)
315
+ * np.cos(p[1] + np.pi / n_ch * (2 * x + 1)) + p[2])
316
+
317
+
318
+ def triangle_drive(x, p, n_ch):
319
+ """Velocity at channel x of a triangular drive over *n_ch* channels: two
320
+ mirrored linear ramps. p = [v at channel 0, v at the last channel, v
321
+ step/channel]. (Calibration's lin_cal; SYNCisot's calibration takes it too.)
322
+ """
323
+ return np.where(x <= int(n_ch / 2),
324
+ p[0] - p[2] * x,
325
+ p[1] - p[2] * (n_ch - 1 - x))
326
+
327
+
307
328
  def _parabola(x, p):
308
329
  """``p[1]*(p[0]-x)**2 + p[2]`` -- the solid-angle count distortion model."""
309
330
  return p[1] * (p[0] - x) ** 2 + p[2]
310
331
 
311
332
 
333
+ def distortion_start(half1, half2, channels, n_ch):
334
+ """The start of the parabolic count distortion (STEP 8): the solid angle
335
+ seen by the detector varies with the drive's position, modulating the
336
+ count rate as a parabola of opposite sign in the two half-sweeps, and
337
+ half1 - reversed(half2) isolates that asymmetry. Returns the five values
338
+ of the final fit: centre, curvature and offset of half-sweep 1, centre and
339
+ curvature of half-sweep 2. (SYNCisot's calibration takes it too.)"""
340
+ start_time = time.time()
341
+ half2_rev = half2[::-1]
342
+ parab = mi.minimi_hi(_parabola, channels[:int(n_ch / 2)],
343
+ half1 - half2_rev + half1[0],
344
+ p0=[int(n_ch / 4), 5,
345
+ half1[int(len(half1) / 2)] - half2_rev[int(len(half2_rev) / 2)] + half1[0]])[0]
346
+ print('parabola fit took', time.time() - start_time, 'seconds')
347
+ parab[2] = parab[2] - half1[0]
348
+ return np.array([parab[0], parab[1] / 2, parab[2], parab[0] + int(n_ch / 2), (-1) * parab[1] / 2])
349
+
350
+
312
351
  def _subtract_distortion(counts, channels, pS):
313
352
  """Remove the fitted parabolic distortion from the raw counts.
314
353
 
@@ -728,21 +767,12 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
728
767
  # --------------------------------------------------------------------- #
729
768
 
730
769
  def sin_cal(x, p):
731
- """Velocity at channel x for a sinusoidal drive.
732
-
733
- p = [amplitude (mm/s), phase (rad), source shift (mm/s)]. The
734
- len/pi*sin(pi/len) factor averages the sine over one channel width.
735
- """
736
- return (p[0] / np.pi * n_ch * np.sin(np.pi / n_ch)
737
- * np.cos(p[1] + np.pi / n_ch * (2 * x + 1)) + p[2])
770
+ """Velocity at channel x for a sinusoidal drive (sine_drive)."""
771
+ return sine_drive(x, p, n_ch)
738
772
 
739
773
  def lin_cal(x, p):
740
- """Velocity at channel x for a triangular drive: two mirrored linear
741
- ramps. p = [v at channel 0, v at the last channel, v step/channel].
742
- """
743
- return np.where(x <= int(n_ch / 2),
744
- p[0] - p[2] * x,
745
- p[1] - p[2] * (n_ch - 1 - x))
774
+ """Velocity at channel x for a triangular drive (triangle_drive)."""
775
+ return triangle_drive(x, p, n_ch)
746
776
 
747
777
  def sin_cal_fin2(x, p):
748
778
  """Final-fit model for the sinusoidal drive (see ps1 layout in the
@@ -753,8 +783,7 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
753
783
  # second Sextet (impurity) intensity: baseline(8) + first
754
784
  # Sextet(14) -> the second Sextet block starts at nbp+14.
755
785
  pCAL2[nbp + 14] = p[imp]
756
- Hx = (p[0] / np.pi * n_ch * np.sin(np.pi / n_ch)
757
- * np.cos(p[1] + np.pi / n_ch * (2 * x + 1)) + p[2])
786
+ Hx = sine_drive(x, p, n_ch)
758
787
  if min(Hx) > -2.95 and max(Hx) < 2.95:
759
788
  p[10] = 0.0 # tiny velocity range: texture undefined -> isotropic
760
789
  pCAL2[nbp + 8] = p[10] # texture order parameter A
@@ -779,7 +808,7 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
779
808
  if imp is not None:
780
809
  pCAL2[nbp + 14] = p[imp] # impurity sextet intensity
781
810
  first = x <= int(n_ch / 2)
782
- Hx = np.where(first, p[0] - p[2] * x, p[1] - p[2] * (n_ch - 1 - x))
811
+ Hx = triangle_drive(x, p, n_ch)
783
812
  # Indicators of the two half-sweeps (x is always the sorted channel
784
813
  # axis here, so elementwise selection == the original concatenation).
785
814
  Hx1 = np.where(first, 1.0, 0.0)
@@ -992,26 +1021,11 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
992
1021
  ps1 = np.append(ps, 1) # ps1[3]: global intensity scale
993
1022
 
994
1023
  # --------------------------------------------------------------------- #
995
- # STEP 8: parabolic count distortion. The solid angle seen by the #
996
- # detector varies with drive position, modulating the count rate as a #
997
- # parabola with opposite sign in the two half-sweeps; fitting #
998
- # half1 - reversed(half2) isolates exactly that asymmetry. #
1024
+ # STEP 8: parabolic count distortion (distortion_start): ps1[4..6] the #
1025
+ # centre, curvature and offset of half-sweep 1, ps1[7..8] the centre #
1026
+ # and curvature of half-sweep 2. #
999
1027
  # --------------------------------------------------------------------- #
1000
- start_time = time.time()
1001
- half2_rev = half2[::-1]
1002
- parab = mi.minimi_hi(_parabola, channels[:int(n_ch / 2)],
1003
- half1 - half2_rev + half1[0],
1004
- p0=[int(n_ch / 4), 5,
1005
- half1[int(len(half1) / 2)] - half2_rev[int(len(half2_rev) / 2)] + half1[0]])[0]
1006
- print('parabola fit took', time.time() - start_time, 'seconds')
1007
- parab[2] = parab[2] - half1[0]
1008
-
1009
- # Split the fitted asymmetry into the two per-half parabolas of ps1.
1010
- ps1 = np.append(ps1, parab[0]) # ps1[4]: centre, half 1
1011
- ps1 = np.append(ps1, parab[1] / 2) # ps1[5]: curvature, half 1
1012
- ps1 = np.append(ps1, parab[2]) # ps1[6]: offset, half 1
1013
- ps1 = np.append(ps1, parab[0] + int(n_ch / 2)) # ps1[7]: centre, half 2
1014
- ps1 = np.append(ps1, (-1) * parab[1] / 2) # ps1[8]: curvature, half 2
1028
+ ps1 = np.concatenate((ps1, distortion_start(half1, half2, channels, n_ch)))
1015
1029
 
1016
1030
  # --------------------------------------------------------------------- #
1017
1031
  # STEP 9: final model: the alpha-Fe sextet, then the foil's impurity #
@@ -35,7 +35,7 @@ MODEL_PARAMETER_NAMES = {
35
35
  'Doublet': ['T', 'δ, mm/s', 'ε, mm/s', 'L, mm/s', 'G, mm/s', 'θk, °', 'φh, °', 'A', 'G2/G1'],
36
36
  'Sextet': ['T', 'δ, mm/s', 'ε, mm/s', 'H, T', 'L, mm/s', 'G, mm/s', 'θk, °', 'φh, °', 'A', 'Am', 'a+', 'a-', 'GH, T', 'I1/I3'],
37
37
  'MDGD': ['T', 'δ, mm/s', 'ε, mm/s', 'H, T', 'L, mm/s', 'G, mm/s', 'GH, T', 'Dδε', 'DδH', 'DεH', 'θk, °', 'φh, °', 'A', 'Am', 'a+', 'a-', 'I1/I3'],
38
- 'Hamiltonian': ['T', 'δ, mm/s', 'Q, mm/s', 'H, T', 'L, mm/s', 'G, mm/s', 'η', 'θH, °', 'φH, °', 'θ, °', 'φ, °', 'αk, °', 'A', 'Am', 'Ah'],
38
+ 'Hamiltonian': ['T', 'δ, mm/s', 'Q, mm/s', 'H, T', 'L, mm/s', 'G, mm/s', 'η', 'θH, °', 'φH, °', 'θ, °', 'φ, °', 'αk, °', 'θk, °', 'φh, °', 'A', 'Am', 'Ah'],
39
39
  # deprecated, superseded by 'Hamiltonian' (kept so old library files still preview)
40
40
  'Hamilton_mc': ['T', 'δ, mm/s', 'Q, mm/s', 'H, T', 'L, mm/s', 'G, mm/s', 'η', 'θH, °', 'φH, °', 'θ, °', 'φ, °', 'αk, °'],
41
41
  'Hamilton_pc': ['T', 'δ, mm/s', 'Q, mm/s', 'H, T', 'L, mm/s', 'G, mm/s', 'η', 'θH, °', 'φH, °'],
@@ -75,6 +75,14 @@ def _parse_metadata_comment_line(line):
75
75
  return None, None
76
76
 
77
77
 
78
+ def is_color_line(fields):
79
+ """Whether the *fields* of a model file's second line are its colors -- a
80
+ color name, '#rrggbb' or empty each; a file written before the colors were
81
+ saved has its first row there. model_io reads a file by the same rule."""
82
+ return all((field.startswith('#') and len(field) == 7) or field in mdl_color_names or field == ''
83
+ for field in fields)
84
+
85
+
78
86
  def parse_library_model_file(file_path):
79
87
  """Parse a library model file into metadata and preview-friendly structures."""
80
88
  metadata = dict(LIBRARY_METADATA_DEFAULTS)
@@ -119,8 +127,7 @@ def parse_library_model_file(file_path):
119
127
  has_colors = False
120
128
  if len(m_list) > 1:
121
129
  second_line = m_list[1]
122
- # mdl_color_names is shared with model_io so both accept the same files
123
- has_colors = all((field.startswith('#') and len(field) == 7) or field in mdl_color_names or field == '' for field in second_line)
130
+ has_colors = is_color_line(second_line)
124
131
  if has_colors:
125
132
  model_colors = list(second_line)
126
133
 
@@ -39,7 +39,8 @@ ROWS = {
39
39
  'MDGD': [8.0, 0.1, -0.05, 33.0, 0.098, 0.12, 0.3, 0.1, 0.1, 0.1, 40.0, 60.0, 0.6, 0.5, 0.02, -0.01, 3.0],
40
40
  'Relax_MS': [5.0, 0.1, -0.05, 33.0, 0.098, 40.0, 60.0, 0.6, 0.5, 1.0, 5.0],
41
41
  'Relax_2S': [5.0, 0.1, -0.05, 33.0, 0.05, 0.05, -30.0, 0.12, 40.0, 60.0, 0.6, 0.5, 0.3, 1.2],
42
- 'Hamiltonian': [5.0, 0.1, 0.4, 33.0, 0.098, 0.12, 0.3, 20.0, 30.0, 40.0, 50.0, 70.0, 0.65, 0.4, 0.55],
42
+ 'Hamiltonian': [5.0, 0.1, 0.4, 33.0, 0.098, 0.12, 0.3, 20.0, 30.0, 40.0, 50.0, 70.0, 60.0, 30.0,
43
+ 0.65, 0.4, 0.55],
43
44
  'ASM': [5.0, 0.1, 0.02, 0.2, 30.0, 5.0, 0.098, 0.12, 0.3, 35.0, 50.0, 0.6, 25.0, 3.0, 20.0],
44
45
  'SCDW': [5.0, 0.1, 0.05, 30.0, 0.3, 0.2, 35.0, 50.0, 0.7, 0.6, 0.003, 0.005, 25.0, 5.0, 1.5, 0.0, 0.0, 0.0,
45
46
  0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 12.0, 3.0],
@@ -103,6 +103,15 @@ E_RECOIL_EV = E0**2 / (2 * MC2_EV) # 1.958e-3 eV, free-atom
103
103
  # the `pol` / `sms_pol` argument. 0.98 is a realistic synchrotron beam.
104
104
  SMS_POL_DEFAULT = 0.98
105
105
 
106
+
107
+ def default_axis_angles(cms):
108
+ """(theta_k, phi_h) of the axis a polarized component points at by default --
109
+ polar angle from the beam k, azimuth from the radiation field h: h for SMS,
110
+ the beam k for CMS (an unpolarized beam has no transverse direction to
111
+ prefer). A new row starts there (parameters_table), and a 'Hamiltonian' saved
112
+ before its texture axis was free opens with it (legacy)."""
113
+ return (0.0, 0.0) if cms else (90.0, 0.0)
114
+
106
115
  # Where users reach the author: the Supp -> "Contact the author" entry, the
107
116
  # bug-report window raised by error_reporter and the README all use these.
108
117
  AUTHOR_EMAIL = 'sergey.yaroslavtsev@esrf.fr'
@@ -26,7 +26,7 @@ from syncmoss.model_io import mod_len_def, read_model as read_model_full, read_b
26
26
  from syncmoss.models_positions import mod_pos
27
27
  from syncmoss.spectrum_model import distri_count
28
28
  from syncmoss.constants import SMS_POL_DEFAULT
29
- from syncmoss.spectrum_io import load_spectrum, ns_for_background
29
+ from syncmoss.spectrum_io import load_spectrum
30
30
  from syncmoss.spectrum_parameters import first_spectrum_parameters, table_uses_names
31
31
  from syncmoss.instrumental_io import (
32
32
  resolve_instrumental_for_file,
@@ -370,6 +370,33 @@ def fixed_parameters(inputs):
370
370
  return np.unique(fix)
371
371
 
372
372
 
373
+ def start_vector(inputs):
374
+ """``(p0, confu)``: where a fit of *inputs* (read_fit_inputs) starts -- the
375
+ table's values with its links applied, then its Expressions and the
376
+ parameters linked to them, in the order minimi_hi uses on every trial
377
+ point -- and the links as minimi_hi takes them. The fit (fit_model) and
378
+ the calibration from the model (model_calibration) start from it.
379
+
380
+ The start is the model Show model draws: read_model leaves 0 in an
381
+ Expression's slot and minimi_hi takes p0 as given, so a parameter linked
382
+ to an Expression used to start at 0; when 0 fitted as well as the
383
+ Expression's value the fit never moved and returned the parameter as 0."""
384
+ p0 = np.array(inputs['p'], dtype=float)
385
+ con1, con2, con3 = inputs['con1'], inputs['con2'], inputs['con3']
386
+ if len(con1) > 0:
387
+ confu = np.array([con1, con2, con3])
388
+ for i in range(len(con1)):
389
+ p0[int(con1[i])] = p0[int(con2[i])] * con3[i]
390
+ else:
391
+ confu = np.array([[-1], [-1], [-1]])
392
+ Expr, NExpr = inputs['Expr'], inputs['NExpr']
393
+ for e_i in range(len(Expr)):
394
+ p0[NExpr[e_i]] = eval_expr(str(Expr[e_i]), p0)
395
+ for c_i in np.where(confu[1] == NExpr[e_i])[0]:
396
+ p0[int(confu[0][c_i])] = p0[int(confu[1][c_i])] * confu[2][c_i]
397
+ return p0, confu
398
+
399
+
373
400
  def free_parameter_count(inputs):
374
401
  """How many values a fit of *inputs* varies: its free slots plus every free
375
402
  Recon weight."""
@@ -437,10 +464,12 @@ def fit_single_spectrum(app, spectrum_file, pool, background=None, sequence_para
437
464
  print(f"[Fitting] Using sequence parameters (result mode)")
438
465
 
439
466
  # Each spectrum of a sequence starts from its own counts: Ns + Nnr at
440
- # that level (ns_for_background) -- unless Ns is a link: it follows that
441
- if background is not None and 0 not in inputs['con1']:
442
- inputs['p'][0] = ns_for_background(background, inputs['p'], inputs['con1'],
443
- inputs['con2'], inputs['con3'])
467
+ # that level -- unless Ns is a link: it follows that. The one-model
468
+ # fit's rule (one_model.start_ns; imported here: one_model imports this
469
+ # module)
470
+ if background is not None:
471
+ from syncmoss.one_model import start_ns
472
+ start_ns(inputs['p'], background, inputs)
444
473
  print(f"[Fitting] Counts of the spectrum {background}: Ns = {inputs['p'][0]}")
445
474
 
446
475
  # An Nbaseline model is fitted to every spectrum of the path box
@@ -480,9 +509,7 @@ def fit_model(app, inputs, spectrum_files, pool):
480
509
  con1, con2, con3 = inputs['con1'], inputs['con2'], inputs['con3']
481
510
  Distri, Cor, Expr, NExpr = inputs['Distri'], inputs['Cor'], inputs['Expr'], inputs['NExpr']
482
511
  DistriN, Recon, ReconN = inputs['DistriN'], inputs['Recon'], inputs['ReconN']
483
-
484
- p0 = np.copy(p)
485
-
512
+
486
513
  print(f"[Fitting] Read {len(p)} parameters from table")
487
514
  print(f"[Fitting] Parameters: {p}")
488
515
  print(f"[Fitting] Model: {model}")
@@ -677,29 +704,9 @@ def fit_model(app, inputs, spectrum_files, pool):
677
704
  bounds = inputs['bounds']
678
705
  fix = fixed_parameters(inputs)
679
706
 
680
- # Set up constraints from con1, con2, con3
681
- if len(con1) > 0:
682
- confu = np.array([con1, con2, con3])
683
- # Apply constraints to initial parameters p0
684
- # Constrained parameters should start with the value of their source
685
- for i in range(len(con1)):
686
- constrained_idx = int(con1[i])
687
- source_idx = int(con2[i])
688
- multiplier = con3[i]
689
- p0[constrained_idx] = p0[source_idx] * multiplier
690
- else:
691
- confu = np.array([[-1], [-1], [-1]])
692
-
693
- # Start from the model Show model draws: evaluate every Expression on p0
694
- # and carry the parameters linked to it along, in the order minimi_hi
695
- # uses on every trial point. read_model leaves 0 in an Expression's slot
696
- # and minimi_hi takes p0 as given, so a parameter linked to an Expression
697
- # used to start at 0; when 0 fitted as well as the Expression's value the
698
- # fit never moved and returned the parameter as 0.
699
- for e_i in range(len(Expr)):
700
- p0[NExpr[e_i]] = eval_expr(str(Expr[e_i]), p0)
701
- for c_i in np.where(confu[1] == NExpr[e_i])[0]:
702
- p0[int(confu[0][c_i])] = p0[int(confu[1][c_i])] * confu[2][c_i]
707
+ # The start: the table's values with its links applied, then its
708
+ # Expressions (start_vector)
709
+ p0, confu = start_vector(inputs)
703
710
 
704
711
  # --- Recon (distribution reconstruction) fit expansion --------------
705
712
  # Every 'Recon' contributes Num FREE weights. They are appended to the TAIL
@@ -240,6 +240,26 @@ def _cross(a, b):
240
240
  return dn.array([a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]])
241
241
 
242
242
 
243
+ def _texture_axis(thetak, phih):
244
+ """models._texture_axis: the texture axis in the lab frame (e1 = h, e2, k)."""
245
+ t = thetak / 180 * np.pi
246
+ ph = phih / 180 * np.pi
247
+ return dn.array([np.sin(t) * np.cos(ph), np.sin(t) * np.sin(ph), np.cos(t)])
248
+
249
+
250
+ def _turn_onto(ref, f):
251
+ """models._turn_onto: the shortest rotation carrying ref onto f, the half turn
252
+ about e2 where f = -ref exactly."""
253
+ s = ref + f
254
+ one_plus_c = 0.5 * (s[0] * s[0] + s[1] * s[1] + s[2] * s[2])
255
+ if dn.value(one_plus_c) == 0.0:
256
+ return np.diag([-1.0, 1.0, -1.0])
257
+ w = _cross(ref, f)
258
+ zero = 0.0 * w[0]
259
+ W = dn.array([[zero, -w[2], w[1]], [w[2], zero, -w[0]], [-w[1], w[0], zero]])
260
+ return _I3 + W + np.matmul(W, W) / one_plus_c
261
+
262
+
243
263
  def _rank2_scale(X, axis, lam0, lam1, lam2):
244
264
  """models._rank2_scale for the eight tensors X (8, 3, 3) at once: their
245
265
  m = 0, +-1, +-2 parts about *axis* scaled by lam0, lam1, lam2."""
@@ -260,7 +280,7 @@ def _rank2_scale(X, axis, lam0, lam1, lam2):
260
280
  return np.matmul(np.matmul(L, np.transpose(Xp, (2, 0, 1))), Lt)
261
281
 
262
282
 
263
- def Ham_mosaic(Q, Hhf, etto, phi, tet, tetr, phir, alfak, Atex, Am, Ah, cms):
283
+ def Ham_mosaic(Q, Hhf, etto, phi, tet, tetr, phir, alfak, Atex, Am, Ah, thetak, phih, cms):
264
284
  """models.Ham_mosaic: P (8, 2, 2), the lines' matrices in (e1, e2), and
265
285
  S (8), their positions in mm/s -- and moment (8,): True for what is not a
266
286
  line but the first moment of a coincident pair, in mm/s, whose shape is
@@ -268,8 +288,10 @@ def Ham_mosaic(Q, Hhf, etto, phi, tet, tetr, phir, alfak, Atex, Am, Ah, cms):
268
288
  before it). No level coincides: the kernel's eight lines."""
269
289
  It, Gc, S, moment = _tensor_core(Q, Hhf, etto, phi, tet)
270
290
  R0 = _R0_rows(tetr, phir, alfak, cms)
271
- fl = np.array([0.0, 0.0, 1.0]) if cms else np.array([1.0, 0.0, 0.0]) # the lab reference axis
272
- n0 = R0[2] if cms else R0[0] # the same axis in the EFG's
291
+ ref = np.array([0.0, 0.0, 1.0]) if cms else np.array([1.0, 0.0, 0.0]) # the axis the angles are read from
292
+ n0 = R0[2] if cms else R0[0] # (tetr, phir): the crystal direction along f
293
+ fl = _texture_axis(thetak, phih) # the texture axis f, in the lab
294
+ R0 = np.matmul(_turn_onto(ref, fl), R0) # the crystal turned with f
273
295
  c2 = (1.0 + 2.0 * Atex) / 3.0
274
296
  if dn.value(c2) < 0.0:
275
297
  c2 = 0.0
@@ -31,7 +31,10 @@ The upgrade applies the SAME transform the presets/data files were converted wit
31
31
  ``Hamiltonian`` (see :data:`_HAMILTONIAN_UPGRADES`): ``Hamilton_pc``
32
32
  (9 params, random powder) and ``Hamilton_mc`` (single crystal, 11 params
33
33
  before it gained ``alpha_k``, 12 after) are renamed and padded out to the
34
- 15-parameter layout with the order parameters that reproduce them exactly;
34
+ 17-parameter layout with the order parameters that reproduce them exactly;
35
+ the 15-parameter ``Hamiltonian`` of before its texture axis was free gains
36
+ that axis, ``theta_k, phi_h``, between ``alpha_k`` and ``A, Am, Ah``, set to
37
+ the axis its angles were read from (h for SMS, the beam k for CMS);
35
38
  * ``ASM`` additionally gained a trailing cycloid-plane angle ``omega`` (both from
36
39
  the pre-merge scalar layout AND from the pre-omega polarized layout). It is
37
40
  appended set to ``omega_0(theta_k, phi_h)`` -- the angle that reproduces the
@@ -58,6 +61,8 @@ from __future__ import annotations
58
61
 
59
62
  import math
60
63
 
64
+ from syncmoss.constants import default_axis_angles
65
+
61
66
 
62
67
  def a_scalar_to_texture(a):
63
68
  """Map an old scalar line-asymmetry ``A`` to the new texture order parameter.
@@ -90,19 +95,25 @@ _MERGED = {
90
95
  }
91
96
 
92
97
  # The single-crystal ('Hamilton_mc') and powder ('Hamilton_pc') Hamiltonians were
93
- # merged into ONE mosaic textured component, 'Hamiltonian' (15 params = the 12 of
94
- # Hamilton_mc + the order parameters A, Am, Ah). Both old names map to it, and
95
- # the row is padded out by APPENDING the values that reproduce the old model
96
- # exactly -- (1, 1, 1) is the single crystal, (0, 0, 0) the random powder (both
97
- # equalities are exact, see models.Ham_mosaic). The three old layouts have
98
- # distinct parameter counts, so the count alone identifies the source:
98
+ # merged into ONE mosaic textured component, 'Hamiltonian' (17 params = the 12 of
99
+ # Hamilton_mc, the texture axis theta_k, phi_h, and the order parameters A, Am,
100
+ # Ah). Both old names map to it, and the row is filled in with the values that
101
+ # reproduce the old model exactly -- (1, 1, 1) is the single crystal, (0, 0, 0)
102
+ # the random powder (both equalities are exact, see models.Ham_mosaic) -- and the
103
+ # axis is the one the old angles were read from (h for SMS, the beam k for CMS:
104
+ # constants.default_axis_angles, so the loader says which source is selected).
105
+ # The four old layouts have distinct parameter counts, so the count alone
106
+ # identifies the source:
99
107
  #
100
- # 9 -> 'Hamilton_pc' : append theta/phi/alpha_k = 0 (a powder ignores the
101
- # reference orientation) and A = Am = Ah = 0;
102
- # 11 -> 'Hamilton_mc' before it gained alpha_k: append alpha_k = 0, (1, 1, 1);
103
- # 12 -> 'Hamilton_mc' as published in the current layout: append (1, 1, 1).
108
+ # 9 -> 'Hamilton_pc' : theta/phi/alpha_k = 0 (a powder ignores the reference
109
+ # orientation), the axis, A = Am = Ah = 0;
110
+ # 11 -> 'Hamilton_mc' before it gained alpha_k: alpha_k = 0, the axis, (1, 1, 1);
111
+ # 12 -> 'Hamilton_mc' as published in the current layout: the axis, (1, 1, 1);
112
+ # 15 -> 'Hamiltonian' before its texture axis was free: the axis goes in
113
+ # between alpha_k and its own A, Am, Ah.
104
114
  #
105
- # {count: (appended values, appended bounds)}; every appended slot is fitted-fixed.
115
+ # {count: (orientation values it lacked, their bounds, A/Am/Ah -- None: its own)};
116
+ # every slot filled in is fitted-fixed.
106
117
  # (built below, once the shared bounds constants exist)
107
118
 
108
119
  # Pre-merge model names that are simply RENAMED to their current component.
@@ -126,11 +137,18 @@ _TET_R_BOUNDS = ('-180', '180')
126
137
  _PHI_R_BOUNDS = ('-360', '360')
127
138
 
128
139
  _HAMILTONIAN_UPGRADES = {
129
- 9: ([0, 0, 0, 0, 0, 0], [_TET_R_BOUNDS, _PHI_R_BOUNDS, _ALPHA_K_BOUNDS,
130
- _A_TEX_BOUNDS, _A_M_BOUNDS, _A_H_BOUNDS]),
131
- 11: ([0, 1, 1, 1], [_ALPHA_K_BOUNDS, _A_TEX_BOUNDS, _A_M_BOUNDS, _A_H_BOUNDS]),
132
- 12: ([1, 1, 1], [_A_TEX_BOUNDS, _A_M_BOUNDS, _A_H_BOUNDS]),
140
+ 9: ([0, 0, 0], [_TET_R_BOUNDS, _PHI_R_BOUNDS, _ALPHA_K_BOUNDS], [0, 0, 0]),
141
+ 11: ([0], [_ALPHA_K_BOUNDS], [1, 1, 1]),
142
+ 12: ([], [], [1, 1, 1]),
143
+ 15: ([], [], None),
133
144
  }
145
+ _HAMILTONIAN_ORIENTATION_SLOTS = 12 # T ... alpha_k: the slots of Hamilton_mc
146
+ _HAMILTONIAN_ORDER_BOUNDS = (_A_TEX_BOUNDS, _A_M_BOUNDS, _A_H_BOUNDS)
147
+
148
+
149
+ def _fixed_group(value, bounds):
150
+ """One .mdl parameter group the upgrade fills in: the value, its bounds, fixed."""
151
+ return [_fmt(value), bounds[0], bounds[1], '', 'True']
134
152
 
135
153
 
136
154
  def _fmt(x):
@@ -225,7 +243,7 @@ def normalize_legacy_model_name(name):
225
243
  return _RENAMED.get(name, name)
226
244
 
227
245
 
228
- def upgrade_mdl_row(model_name, row_data):
246
+ def upgrade_mdl_row(model_name, row_data, cms=False):
229
247
  """Upgrade one OLD-format ``.mdl`` parameter row to the new model layout.
230
248
 
231
249
  ``row_data`` is the flat list of string fields for one table row: groups of
@@ -243,9 +261,11 @@ def upgrade_mdl_row(model_name, row_data):
243
261
  is safe to call unconditionally while loading.
244
262
 
245
263
  A ``Hamiltonian`` row is instead recognised by its parameter count (9, 11 or
246
- 12 = the two old Hamiltonian layouts) and padded out to 15 with the order
247
- parameters that reproduce the old model exactly; see
248
- :data:`_HAMILTONIAN_UPGRADES`.
264
+ 12 = the two old Hamiltonian layouts, 15 = the Hamiltonian before its texture
265
+ axis was free) and filled in to 17 with the axis and the order parameters
266
+ that reproduce the old model exactly; see :data:`_HAMILTONIAN_UPGRADES`.
267
+ ``cms`` says which source the file is opened under: the old angles were read
268
+ from h under SMS and from the beam k under CMS.
249
269
 
250
270
  An ``ASM`` row whose anharmonicity slot is not marked ``ASM_P_NAME`` holds
251
271
  ``m`` (any layout before 2026-11): it is converted to ``P(m)``.
@@ -253,11 +273,11 @@ def upgrade_mdl_row(model_name, row_data):
253
273
  ``model_name`` must already be normalised (see
254
274
  :func:`normalize_legacy_model_name`).
255
275
  """
256
- row_data = _upgrade_layout(model_name, row_data)
276
+ row_data = _upgrade_layout(model_name, row_data, cms)
257
277
  return _asm_p_slot(row_data) if model_name == 'ASM' else row_data
258
278
 
259
279
 
260
- def _upgrade_layout(model_name, row_data):
280
+ def _upgrade_layout(model_name, row_data, cms=False):
261
281
  """upgrade_mdl_row's change of the layout: the slots a component gained."""
262
282
  info = _MERGED.get(model_name)
263
283
  if info is None and model_name != 'Hamiltonian':
@@ -274,15 +294,24 @@ def _upgrade_layout(model_name, row_data):
274
294
  real_groups = groups[:real]
275
295
 
276
296
  if model_name == 'Hamiltonian':
277
- # One of the two old Hamiltonians (identified by its parameter count):
278
- # append the slots that turn it into the textured model without changing
279
- # the spectrum. Unknown count (already 15, or unexpected) -> unchanged.
297
+ # One of the old Hamiltonians (identified by its parameter count): fill in
298
+ # the slots that turn it into the textured model with a free axis without
299
+ # changing the spectrum -- the orientation angles it lacked, the axis,
300
+ # then A, Am, Ah (its own, if it had them). Unknown count (already 17, or
301
+ # unexpected) -> unchanged.
280
302
  upgrade = _HAMILTONIAN_UPGRADES.get(real)
281
303
  if upgrade is None:
282
304
  return row_data
283
- values, bounds = upgrade
284
- upgraded = real_groups + [[_fmt(v), lo, hi, '', 'True']
285
- for v, (lo, hi) in zip(values, bounds)]
305
+ pad, pad_bounds, order = upgrade
306
+ orientation = real_groups[:_HAMILTONIAN_ORIENTATION_SLOTS] + [
307
+ _fixed_group(v, b) for v, b in zip(pad, pad_bounds)]
308
+ axis = [_fixed_group(v, b) for v, b in zip(default_axis_angles(cms),
309
+ (_THETA_K_BOUNDS, _PHI_H_BOUNDS))]
310
+ if order is None:
311
+ texture = real_groups[_HAMILTONIAN_ORIENTATION_SLOTS:real]
312
+ else:
313
+ texture = [_fixed_group(v, b) for v, b in zip(order, _HAMILTONIAN_ORDER_BOUNDS)]
314
+ upgraded = orientation + axis + texture
286
315
  return [field for g in upgraded for field in g]
287
316
  asym = info['asym']
288
317
  am_group = ['0', _A_M_BOUNDS[0], _A_M_BOUNDS[1], '', 'True']
@@ -17,7 +17,7 @@ from syncmoss.syncmoss_main import PhysicsApp, new_pool
17
17
  from syncmoss.supp_menu import apply_saved_settings
18
18
  from syncmoss.compile_functions import compile_functions
19
19
  from syncmoss.compile_window import compile_if_needed, current_stamp
20
- __VERSION__ = "0.8.3"
20
+ __VERSION__ = "0.8.4"
21
21
 
22
22
  # What --test leaves in the cache folder for --test-again: the seconds of its
23
23
  # plain fit before anything was compiled
@@ -25,6 +25,33 @@ _FIRST_FIT_FILE = 'test_first_fit.txt'
25
25
  # --test-again: its fit must take at most this part of that one
26
26
  _SECOND_FIT_SHARE = 0.5
27
27
 
28
+ # The start switches, as --help lists them (main() takes each out of sys.argv;
29
+ # tests/test_console_io.py checks that every one it takes is listed here)
30
+ _SWITCHES = (
31
+ ('--help, -h', ("this list, and nothing started",)),
32
+ ('--version', ("the version, and nothing started",)),
33
+ ('--fresh', ("a usual start that compiles the calculation functions anew",
34
+ "(e.g. after the calculation code was edited)")),
35
+ ('--compile', ("only compile the calculation functions anew, no window",)),
36
+ ('--console', ("Windows SYNCmoss.exe: a console window of its own for what",
37
+ "it prints (a traceback, for instance)")),
38
+ ('--test', ("self-check of a first start: compiled functions emptied,",
39
+ "a fit timed, everything compiled, the GUI smoke flow run")),
40
+ ('--test-again', ("self-check of a second start (after --test): nothing",
41
+ f"compiled, the fit at most {_SECOND_FIT_SHARE} of --test's time")),
42
+ )
43
+
44
+
45
+ def _help_text():
46
+ """What ``syncmoss --help`` prints: the version and _SWITCHES."""
47
+ width = max(len(name) for name, _ in _SWITCHES) + 4
48
+ lines = [f"SYNCmoss {__VERSION__}", "",
49
+ "syncmoss [switch] (SYNCmoss.exe [switch], python main.py [switch])", ""]
50
+ for name, text in _SWITCHES:
51
+ lines.append(f" {name:<{width}}{text[0]}")
52
+ lines += [f" {'':<{width}}{line}" for line in text[1:]]
53
+ return '\n'.join(lines)
54
+
28
55
 
29
56
  def _smoke():
30
57
  """The smoke driver, ``tests/syncmoss_test.py`` (the single source of truth
@@ -148,11 +175,21 @@ def main():
148
175
  if isinstance(stream, io.TextIOWrapper):
149
176
  stream.reconfigure(encoding='utf-8', errors='backslashreplace')
150
177
 
178
+ # --help: the switches (_SWITCHES), and nothing started
179
+ if console_io.consume_flag(sys.argv, '--help', '-h'):
180
+ print(_help_text())
181
+ return 0
182
+
151
183
  # --fresh: this start compiles the calculation functions anew, whatever the
152
184
  # folder holds -- e.g. after the calculation code was edited: numba dates
153
185
  # a function by its own file only, not by the files of the functions it calls
154
186
  fresh = console_io.consume_flag(sys.argv, '--fresh')
155
187
 
188
+ # --version: the version, and nothing started (no pool, no compiling, no window)
189
+ if console_io.consume_flag(sys.argv, '--version'):
190
+ print(f"SYNCmoss {__VERSION__}")
191
+ return 0
192
+
156
193
  if console_io.consume_flag(sys.argv, '--compile'):
157
194
  return _run_compile()
158
195
  if console_io.consume_flag(sys.argv, '--test'):