syncmoss 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_MacOS.yml +1 -1
  2. {syncmoss-0.5.0 → syncmoss-0.5.1}/PKG-INFO +1 -1
  3. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Calibration.py +27 -20
  4. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/fitting_io.py +38 -2
  5. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/instrumental_io.py +82 -57
  6. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/main.py +1 -1
  7. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/minimi_lib.py +69 -28
  8. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/model_io.py +75 -2
  9. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/models.py +437 -81
  10. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/one_model.py +3 -2
  11. syncmoss-0.5.1/syncmoss/parameters/INSexp.txt +1 -0
  12. syncmoss-0.5.1/syncmoss/parameters/INSint.txt +1 -0
  13. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/help.md +28 -12
  14. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/models_description.md +20 -3
  15. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters_table.py +200 -29
  16. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/spectrum_io.py +4 -4
  17. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/spectrum_plotter.py +2 -2
  18. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/supp_menu.py +3 -3
  19. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/syncmoss_main.py +118 -32
  20. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/PKG-INFO +1 -1
  21. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/SOURCES.txt +9 -0
  22. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/scm_file_list.json +9 -0
  23. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/conftest.py +16 -54
  24. syncmoss-0.5.1/tests/data/generate_cal_fixtures.py +124 -0
  25. syncmoss-0.5.1/tests/data/synthetic_alpha_fe_cms_sinus.mca +4 -0
  26. syncmoss-0.5.1/tests/test_baseline_polynomial.py +156 -0
  27. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_calibration.py +58 -3
  28. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_distr_targets.py +123 -2
  29. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_instrumental_joint.py +3 -1
  30. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_instrumental_metadata.py +117 -0
  31. syncmoss-0.5.1/tests/test_link_chains.py +166 -0
  32. syncmoss-0.5.1/tests/test_minimi_batch_eval.py +29 -0
  33. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_model_only_mode.py +2 -3
  34. syncmoss-0.5.1/tests/test_nbaseline_multidistr.py +71 -0
  35. syncmoss-0.5.1/tests/test_node_sum_reuse.py +163 -0
  36. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_one_model_gui.py +2 -1
  37. syncmoss-0.5.1/tests/test_recon_variants.py +92 -0
  38. syncmoss-0.5.1/tests/test_replaced_component_skip.py +69 -0
  39. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_results_table_rows.py +2 -2
  40. syncmoss-0.5.1/tests/test_source_norm.py +228 -0
  41. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_take_result.py +88 -23
  42. syncmoss-0.5.0/syncmoss/parameters/INSexp.txt +0 -1
  43. syncmoss-0.5.0/syncmoss/parameters/INSint.txt +0 -1
  44. syncmoss-0.5.0/tests/data/generate_cal_fixtures.py +0 -80
  45. {syncmoss-0.5.0 → syncmoss-0.5.1}/.gitattributes +0 -0
  46. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/Tests.yml +0 -0
  47. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_PyPI.yml +0 -0
  48. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_TagRelease.yml +0 -0
  49. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_Tests.yml +0 -0
  50. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_UploadRelease.yml +0 -0
  51. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_Version.yml +0 -0
  52. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_Wheels.yml +0 -0
  53. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/_WindowsExe.yml +0 -0
  54. {syncmoss-0.5.0 → syncmoss-0.5.1}/.github/workflows/release.yml +0 -0
  55. {syncmoss-0.5.0 → syncmoss-0.5.1}/.gitignore +0 -0
  56. {syncmoss-0.5.0 → syncmoss-0.5.1}/.vscode/settings.json +0 -0
  57. {syncmoss-0.5.0 → syncmoss-0.5.1}/COPYING.txt +0 -0
  58. {syncmoss-0.5.0 → syncmoss-0.5.1}/LICENSE +0 -0
  59. {syncmoss-0.5.0 → syncmoss-0.5.1}/Lib_test/test.mdl +0 -0
  60. {syncmoss-0.5.0 → syncmoss-0.5.1}/NOTICE.txt +0 -0
  61. {syncmoss-0.5.0 → syncmoss-0.5.1}/README.md +0 -0
  62. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/MacOS.spec +0 -0
  63. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/SYNCmoss.png +0 -0
  64. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/Windows.spec +0 -0
  65. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/bundle.py +0 -0
  66. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/dmg_background.pdf +0 -0
  67. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/licenses/GPL-3.0.txt +0 -0
  68. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/licenses/LGPL-3.0.txt +0 -0
  69. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/macos_bundle.py +0 -0
  70. {syncmoss-0.5.0 → syncmoss-0.5.1}/bundle/third_party_licenses.py +0 -0
  71. {syncmoss-0.5.0 → syncmoss-0.5.1}/docs/thick_models.md +0 -0
  72. {syncmoss-0.5.0 → syncmoss-0.5.1}/docs/thick_vs_thin.md +0 -0
  73. {syncmoss-0.5.0 → syncmoss-0.5.1}/pyproject.toml +0 -0
  74. {syncmoss-0.5.0 → syncmoss-0.5.1}/requirements.txt +0 -0
  75. {syncmoss-0.5.0 → syncmoss-0.5.1}/setup.cfg +0 -0
  76. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Hamiltonian_helper.py +0 -0
  77. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Aegirine.mdl +0 -0
  78. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Akaganeite.mdl +0 -0
  79. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Almandine.mdl +0 -0
  80. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Antitaenite.mdl +0 -0
  81. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Arsenopyrite.mdl +0 -0
  82. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Bornite.mdl +0 -0
  83. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Bridgmanite (Fe,Al-bearing) @100 GPa.mdl +0 -0
  84. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Bridgmanite (Fe,Al-bearing).mdl +0 -0
  85. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Celadonite.mdl +0 -0
  86. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Cementite.mdl +0 -0
  87. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Chalcopyrite.mdl +0 -0
  88. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Clinopyroxene (augite).mdl +0 -0
  89. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Copiapite.mdl +0 -0
  90. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Cubanite.mdl +0 -0
  91. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Epidote.mdl +0 -0
  92. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Fayalite (Fe-olivine).mdl +0 -0
  93. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Ferrihydrite (2-line).mdl +0 -0
  94. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Ferropericlase.mdl +0 -0
  95. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Goethite.mdl +0 -0
  96. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Green rust (fougerite, carbonate).mdl +0 -0
  97. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Haegg carbide.mdl +0 -0
  98. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Hedenbergite.mdl +0 -0
  99. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Hematite.mdl +0 -0
  100. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Heterosite (FePO4).mdl +0 -0
  101. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Ilmenite.mdl +0 -0
  102. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Iron phosphide.mdl +0 -0
  103. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Isocubanite.mdl +0 -0
  104. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Jarosite.mdl +0 -0
  105. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Kamacite.mdl +0 -0
  106. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Lepidocrocite.mdl +0 -0
  107. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Maghemite.mdl +0 -0
  108. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Magnetite.mdl +0 -0
  109. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Marcasite.mdl +0 -0
  110. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Melanterite.mdl +0 -0
  111. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Orthopyroxene (enstatite-ferrosilite).mdl +0 -0
  112. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Prussian blue (ferric ferrocyanide).mdl +0 -0
  113. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Pyrite.mdl +0 -0
  114. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Pyrrhotite.mdl +0 -0
  115. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Rhomboclase.mdl +0 -0
  116. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Roemerite.mdl +0 -0
  117. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Siderite.mdl +0 -0
  118. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Szomolnokite.mdl +0 -0
  119. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Taenite.mdl +0 -0
  120. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Talnakhite.mdl +0 -0
  121. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Tetrataenite.mdl +0 -0
  122. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Triphylite (LiFePO4).mdl +0 -0
  123. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Troilite.mdl +0 -0
  124. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Vivianite.mdl +0 -0
  125. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/Voltaite.mdl +0 -0
  126. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library/alpha-Fe (metallic iron, bcc).mdl +0 -0
  127. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library_io.py +0 -0
  128. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/Library_window.py +0 -0
  129. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/bliss_channel.py +0 -0
  130. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/constants.py +0 -0
  131. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/error_reporter.py +0 -0
  132. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/exclusion_bar.py +0 -0
  133. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/exclusion_regions.py +0 -0
  134. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/CheckBox.png +0 -0
  135. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/CheckBox_.png +0 -0
  136. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/CheckBox_L.png +0 -0
  137. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/CheckBox_L2.png +0 -0
  138. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/DU.png +0 -0
  139. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/Switch.png +0 -0
  140. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/UD.png +0 -0
  141. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/icons/icon_r.ico +0 -0
  142. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/instrumental_window.py +0 -0
  143. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/legacy.py +0 -0
  144. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/license_window.py +0 -0
  145. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/models_description_window.py +0 -0
  146. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/models_positions.py +0 -0
  147. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/one_spectrum.py +0 -0
  148. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/ABSorber3.txt +0 -0
  149. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/Be.txt +0 -0
  150. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/Calibration.dat +0 -0
  151. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/GCMS.txt +0 -0
  152. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/INS_APS.txt +0 -0
  153. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/INSth.txt +0 -0
  154. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/KB.txt +0 -0
  155. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/NFS.txt +0 -0
  156. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/parameters/calibr.png +0 -0
  157. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/result_window.py +0 -0
  158. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/results_table.py +0 -0
  159. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/sms_theory.py +0 -0
  160. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/spectrum_parameters.py +0 -0
  161. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/support_math.py +0 -0
  162. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/test_graf.txt +0 -0
  163. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/test_param.txt +0 -0
  164. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/theme_dark.json +0 -0
  165. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss/theme_light.json +0 -0
  166. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/dependency_links.txt +0 -0
  167. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/entry_points.txt +0 -0
  168. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/requires.txt +0 -0
  169. {syncmoss-0.5.0 → syncmoss-0.5.1}/syncmoss.egg-info/top_level.txt +0 -0
  170. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/Distr_corr.mdl +0 -0
  171. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/Distr_distr.mdl +0 -0
  172. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/alpha_fe_sms_000.mca +0 -0
  173. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/calibration_000_golden.json +0 -0
  174. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/parameters/Calibration.dat +0 -0
  175. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/parameters/GCMS.txt +0 -0
  176. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/parameters/INSexp.txt +0 -0
  177. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/parameters/INSint.txt +0 -0
  178. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/parameters/INSth.txt +0 -0
  179. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/data/synthetic_alpha_fe_cms_linear.mca +0 -0
  180. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/golden_models.json +0 -0
  181. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/syncmoss_test.py +0 -0
  182. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_bliss_channel.py +0 -0
  183. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_calibration_helpers.py +0 -0
  184. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_calibration_path.py +0 -0
  185. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_chi2_spread.py +0 -0
  186. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_contact_author.py +0 -0
  187. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_create_spectrum_from_model.py +0 -0
  188. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_distr_composition.py +0 -0
  189. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_distr_expansion.py +0 -0
  190. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_distr_mdl.py +0 -0
  191. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_error_reporter.py +0 -0
  192. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_exclusion_fit.py +0 -0
  193. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_exclusion_gui.py +0 -0
  194. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_exclusion_regions.py +0 -0
  195. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_expression_fit_start.py +0 -0
  196. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_expression_validation.py +0 -0
  197. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_fit_core.py +0 -0
  198. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_fit_one_spectrum.py +0 -0
  199. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_golden_models.py +0 -0
  200. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_gui_smoke.py +0 -0
  201. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_hamiltonian_texture.py +0 -0
  202. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_impurity_presets.py +0 -0
  203. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_instrumental_method_choice.py +0 -0
  204. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_instrumental_recentre.py +0 -0
  205. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_instrumental_window.py +0 -0
  206. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_integral_points.py +0 -0
  207. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_interrupt.py +0 -0
  208. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_legacy.py +0 -0
  209. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_library_dir.py +0 -0
  210. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_library_io.py +0 -0
  211. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_license_window.py +0 -0
  212. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_minimi_bounds.py +0 -0
  213. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_model_append.py +0 -0
  214. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_model_io.py +0 -0
  215. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_model_pointwise.py +0 -0
  216. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_nbaseline_results.py +0 -0
  217. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_one_model_expand.py +0 -0
  218. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_overwrite_dat_instrumental.py +0 -0
  219. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_parameter_links.py +0 -0
  220. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_polarization.py +0 -0
  221. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_recon_composition.py +0 -0
  222. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_recon_mdl.py +0 -0
  223. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_recon_results.py +0 -0
  224. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_reference_shift.py +0 -0
  225. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_result_window.py +0 -0
  226. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_results_table_image.py +0 -0
  227. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_save_result_model.py +0 -0
  228. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_sdw_grid.py +0 -0
  229. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_search_guards.py +0 -0
  230. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_sms_theory.py +0 -0
  231. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_spectrum_parameters.py +0 -0
  232. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_support_math.py +0 -0
  233. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_table_marks.py +0 -0
  234. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_texture_s1.py +0 -0
  235. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_theory_search.py +0 -0
  236. {syncmoss-0.5.0 → syncmoss-0.5.1}/tests/test_thick_gui.py +0 -0
@@ -135,7 +135,7 @@ jobs:
135
135
  name: Merge, sign and notarize the universal2 app
136
136
  needs: build
137
137
  runs-on: macos-15
138
- timeout-minutes: 90
138
+ timeout-minutes: 120
139
139
  steps:
140
140
  - uses: actions/checkout@v6
141
141
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syncmoss
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: SYNCmoss — Mössbauer spectroscopy analysis application
5
5
  Author: Sergey Yaroslavtsev
6
6
  License: MIT
@@ -76,8 +76,9 @@ has many steps. The steps, in order (mirrored by the STEP banners in
76
76
  Parameter-vector layouts used throughout (``nbp`` = number_of_baseline_parameters = 8):
77
77
 
78
78
  * Spectrum model ``p`` / ``p00`` / ``pCAL`` -- ``[0..nbp-1]`` baseline
79
- (``[0]`` count rate of half-sweep 1, ``[4]`` count rate of half-sweep 2 for
80
- CMS), then one polarized Sextet block of 14:
79
+ (``[0]`` count rate seen through the absorber; for CMS also ``[4]``, a
80
+ background count rate the absorber does not attenuate -- both apply to the
81
+ whole spectrum, not to one half-sweep), then one polarized Sextet block of 14:
81
82
  ``T(+0) d(+1) e(+2) H(+3) L(+4) G(+5) theta_k(+6) phi_h(+7) A(+8) Am(+9)
82
83
  a+(+10) a-(+11) GH(+12) I13(+13)``.
83
84
  ``theta_k=90, phi_h=0, A=0`` make the polarized Sextet identical to the old
@@ -89,8 +90,8 @@ Parameter-vector layouts used throughout (``nbp`` = number_of_baseline_parameter
89
90
  intensity scale, ``[4..6]`` parabola of half-sweep 1 (centre, curvature,
90
91
  offset), ``[7..8]`` parabola of half-sweep 2 (centre, curvature),
91
92
  ``[9]`` main sextet intensity, ``[10]`` texture parameter A, then
92
- ``[11]`` impurity sextet intensity (SMS) or ``[11..12]`` the two baseline
93
- count rates (CMS).
93
+ ``[11]`` impurity sextet intensity (SMS) or ``[11..12]`` the count rate and
94
+ the unattenuated background, ``pCAL[0]`` and ``pCAL[4]`` (CMS).
94
95
  """
95
96
 
96
97
  import os
@@ -594,10 +595,10 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
594
595
  p[10] = 0.0 # tiny velocity range: texture undefined -> isotropic
595
596
  pCAL2[nbp + 8] = p[10] # texture order parameter A
596
597
  if VVV == 1:
597
- pCAL2[0] = p[11] # baseline of half-sweep 1
598
+ pCAL2[0] = p[11] # count rate through the absorber
598
599
  if p[12] > p[11] * 10:
599
- p[12] = p[11] * 10 # keep baseline 2 sane
600
- pCAL2[4] = p[12] # baseline of half-sweep 2
600
+ p[12] = p[11] * 10 # keep the background sane
601
+ pCAL2[4] = p[12] # unattenuated background
601
602
  half = int(len(x) / 2)
602
603
  # Velocity of the same channel in the OTHER half-sweep: sign(|Hx-Hx1|)
603
604
  # masks the parabola of half 1 to half 2 and vice versa.
@@ -620,10 +621,10 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
620
621
  if min(Hx) > -2.95 and max(Hx) < 2.95:
621
622
  p[10] = 0.0 # tiny velocity range: texture undefined -> isotropic
622
623
  pCAL2[nbp + 8] = p[10] # texture order parameter A
623
- pCAL2[0] = p[11] # baseline of half-sweep 1
624
+ pCAL2[0] = p[11] # count rate through the absorber
624
625
  if p[12] > p[11] * 10:
625
- p[12] = p[11] * 10 # keep baseline 2 sane
626
- pCAL2[4] = p[12] # baseline of half-sweep 2
626
+ p[12] = p[11] * 10 # keep the background sane
627
+ pCAL2[4] = p[12] # unattenuated background
627
628
  return (fit_func(Hx, pCAL2)
628
629
  + (p[5] * (p[4] - channels) ** 2 + p[6]) * Hx1
629
630
  + (p[8] * (p[7] - channels) ** 2) * Hx2)
@@ -638,7 +639,8 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
638
639
  # STEP 4: alpha-Fe reference model, start values and bounds. #
639
640
  # --------------------------------------------------------------------- #
640
641
  # Baseline guess: max counts minus 2 sigma; CMS splits it 60/40 between
641
- # the two half-sweep count rates (indices 0 and 4).
642
+ # the count rate through the absorber (index 0) and the unattenuated
643
+ # background (index 4).
642
644
  baseline_guess = max(counts) - 2 * np.sqrt(max(counts))
643
645
  p00 = np.array([baseline_guess * (1 - 0.4 * (VVV == 1)), 0, 0, 0,
644
646
  baseline_guess * (0.4 * (VVV == 1)), 0, 0, 0,
@@ -847,7 +849,7 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
847
849
  # --------------------------------------------------------------------- #
848
850
  # STEP 9: final model. SMS reference foils show a second (impurity) #
849
851
  # sextet and the Be-window doublet (parameters from Be.txt); CMS keeps #
850
- # the single sextet but frees both half-sweep count rates. #
852
+ # the single sextet but frees the count rate and the background. #
851
853
  # --------------------------------------------------------------------- #
852
854
  if method == 0:
853
855
  if VVV == 3:
@@ -867,7 +869,7 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
867
869
  pCAL = np.concatenate((pCAL, Be_param))
868
870
  if VVV == 1:
869
871
  model = ['Sextet']
870
- pCAL = np.array([p[0], 0, 0, 0, p[3], 0, 0, 0,
872
+ pCAL = np.array([p[0], 0, 0, 0, p[4], 0, 0, 0,
871
873
  8.08, 0, 0, ALPHA_FE_FIELD, NAT_WIDTH, 0, 90, 0, 0, 0, 0, 0, 0, 3])
872
874
  print('background ', pCAL[0], pCAL[4], ps1[3])
873
875
  if method == 1:
@@ -882,14 +884,14 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
882
884
  if VVV == 3:
883
885
  ps1 = np.append(ps1, 0.5) # ps1[11]: impurity intensity
884
886
  if VVV == 1:
885
- # Free both half-sweep count rates, starting from a 60/40 split of the
886
- # fitted total; rescale the intensity guess accordingly.
887
+ # Free the count rate and the background, starting from a 60/40 split
888
+ # of the fitted total; rescale the intensity guess accordingly.
887
889
  tot = (pCAL[0] + pCAL[4])
888
890
  ps1[9] = pCAL[nbp] * pCAL[0] / tot / 3 * 5
889
891
  pCAL[0] = tot * 0.6
890
892
  pCAL[4] = tot * 0.4
891
- ps1 = np.append(ps1, pCAL[0]) # ps1[11]: count rate, half 1
892
- ps1 = np.append(ps1, pCAL[4]) # ps1[12]: count rate, half 2
893
+ ps1 = np.append(ps1, pCAL[0]) # ps1[11]: count rate through the absorber
894
+ ps1 = np.append(ps1, pCAL[4]) # ps1[12]: unattenuated background
893
895
  print('baseline ', ps1[11], ps1[12])
894
896
 
895
897
  print('parameter set after preliminary fit ', ps1)
@@ -910,10 +912,15 @@ def Calibration(dir_path, Cal_file, pool, VVV, INS, JN, x0, MulCo, Vel_start=1,
910
912
  v_axis = cal(channels, pS) # final channel -> velocity map
911
913
 
912
914
  # Fold the fitted global scale into the count rates so pS[3] == 1 from
913
- # here on (the folded outputs must be in true count units).
914
- pCAL[0] = pCAL[0] * pS[3]
915
+ # here on (the folded outputs must be in true count units). For CMS the
916
+ # count rates are pS[11]/pS[12]: cal_fin2 copies them into pCAL[0]/pCAL[4]
917
+ # on every call, and only sin_cal_fin2 applies pS[3] at all.
915
918
  if VVV == 1:
916
- pCAL[4] = pCAL[4] * pS[3]
919
+ if method == 0:
920
+ pS[11] = pS[11] * pS[3]
921
+ pS[12] = pS[12] * pS[3]
922
+ else:
923
+ pCAL[0] = pCAL[0] * pS[3]
917
924
  pS[3] = 1
918
925
 
919
926
  flat_counts = _subtract_distortion(counts, channels, pS)
@@ -588,6 +588,10 @@ def fit_model(app, inputs, spectrum_files, pool):
588
588
  return m5.TI(x, p, model, JN, pool, mp0['x0'], mp0['MulCo'], mp0['INS'],
589
589
  Distri, Cor, Met=mp0['Met'], Norm=mp0['Norm'], pol=pol, Recon=recon,
590
590
  lengths=lengths)
591
+
592
+ def func_variants(x, p, recons, lengths=lengths):
593
+ return m5.TI_recon_variants(x, p, model, JN, pool, mp0['x0'], mp0['MulCo'], mp0['INS'],
594
+ Distri, Cor, mp0['Met'], mp0['Norm'], pol, recons, lengths)
591
595
  else:
592
596
  # Dedicated per-section instrumental parameters (e.g. mixing CMS and
593
597
  # SMS): TI receives one value per section as lists. The full model and
@@ -605,13 +609,21 @@ def fit_model(app, inputs, spectrum_files, pool):
605
609
  Distri, Cor, Met=met_list, Norm=norm_list, pol=pol, Recon=recon,
606
610
  lengths=lengths)
607
611
 
612
+ def func_variants(x, p, recons, lengths=lengths):
613
+ return m5.TI_recon_variants(x, p, model, JN, pool, x0_list, mulco_list, ins_list,
614
+ Distri, Cor, met_list, norm_list, pol, recons, lengths)
615
+
608
616
  # The model at the fitted points (each spectrum keeps its own number of
609
617
  # them when exclusion regions are applied)
610
618
  if regions:
611
619
  def func_data(x, p, recon=Recon):
612
620
  return func(x, p, recon, lengths_data)
621
+
622
+ def func_variants_data(x, p, recons):
623
+ return func_variants(x, p, recons, lengths_data)
613
624
  else:
614
625
  func_data = func
626
+ func_variants_data = func_variants
615
627
 
616
628
  # Box bounds (from the table: read_fit_inputs), and the user's fixes
617
629
  # with the automatic ones: constraints, distribution expressions,
@@ -682,8 +694,30 @@ def fit_model(app, inputs, spectrum_files, pool):
682
694
  spec = np.asarray(func_data(A_data, pw[:base_len], _rebuild_recon(pw)), dtype=float)
683
695
  pen = _recon_penalty_rows(pw[base_len:], recon_infos, reg_scale)
684
696
  return np.concatenate([spec, pen])
697
+
698
+ def batch_eval(pw_list):
699
+ # The Jacobian's vectors that differ only in the Recon weights
700
+ # (the tail) share every copy of the distributed component:
701
+ # computed together (models.TI_recon_variants). The others, one
702
+ # by one as before.
703
+ out = [None] * len(pw_list)
704
+ groups = {}
705
+ for j, pw in enumerate(pw_list):
706
+ groups.setdefault(np.asarray(pw[:base_len], dtype=float).tobytes(), []).append(j)
707
+ for idx in groups.values():
708
+ if len(idx) == 1:
709
+ out[idx[0]] = func_fit(A_fit, pw_list[idx[0]])
710
+ continue
711
+ specs = func_variants_data(A_data, np.asarray(pw_list[idx[0]][:base_len], dtype=float),
712
+ [_rebuild_recon(pw_list[j]) for j in idx])
713
+ for j, spec in zip(idx, specs):
714
+ out[j] = np.concatenate([np.asarray(spec, dtype=float),
715
+ _recon_penalty_rows(pw_list[j][base_len:], recon_infos,
716
+ reg_scale)])
717
+ return out
685
718
  else:
686
719
  func_fit, A_fit, B_fit, p0_fit, bounds_fit, n_reg = func_data, A_data, B_data, p0, bounds, 0
720
+ batch_eval = None
687
721
 
688
722
  # Not more free values than points: the fit is not started
689
723
  n_free = len(p0_fit) - len(fix)
@@ -713,7 +747,8 @@ def fit_model(app, inputs, spectrum_files, pool):
713
747
  nu0=2.618,
714
748
  tau0=tau0,
715
749
  eps=eps,
716
- n_reg=n_reg
750
+ n_reg=n_reg,
751
+ batch_eval=batch_eval
717
752
  )
718
753
  if hi2 > 1.25:
719
754
  print('hi2 is too high let me try to continue')
@@ -730,7 +765,8 @@ def fit_model(app, inputs, spectrum_files, pool):
730
765
  nu0=2.618,
731
766
  tau0=tau0,
732
767
  eps=eps,
733
- n_reg=n_reg
768
+ n_reg=n_reg,
769
+ batch_eval=batch_eval
734
770
  )
735
771
  if np.array_equal(pfit, pO) == True:
736
772
  if len(er) == 1:
@@ -31,12 +31,10 @@ DEFAULT_INSINT_TEXT = "2.448293819453453 0.03380920627191801 "
31
31
  DAT_INS_EXP_PREFIX = '#@INSexp'
32
32
  DAT_INS_INT_PREFIX = '#@INSint'
33
33
  DAT_GCMS_PREFIX = '#@GCMS'
34
- # The THEORETICAL (simulated 57FeBO3) SMS instrumental function. It is written
35
- # IN ADDITION to #@INSexp/#@INSint, not instead of them: a converted .dat
36
- # therefore still carries the conventional Gaussian-sum description (the best
37
- # empirical stand-in for the same source, so any reader that does not know this
38
- # marker degrades gracefully), and #@INSint still carries the integration
39
- # constants.
34
+ # The THEORETICAL (simulated 57FeBO3) SMS instrumental function. A converted
35
+ # .dat carries it INSTEAD of #@INSexp when it is the one in use, with #@INSint
36
+ # for the integration constants (build_dat_metadata_lines). Files written before
37
+ # carry both; the setting then chooses (resolve_instrumental_for_file).
40
38
  DAT_INS_TH_PREFIX = '#@INSth'
41
39
  # Read-only legacy spelling. Files written before the rename carry #@INSacc and
42
40
  # must keep loading; nothing writes it any more.
@@ -88,11 +86,12 @@ def is_data_line(stripped):
88
86
 
89
87
 
90
88
  def parse_dat_instrumental_metadata(file_path):
91
- """Read #@INSexp / #@INSint / #@GCMS metadata from a .dat file header (every
92
- line above the first data line, see is_data_line).
89
+ """Read #@INSexp / #@INSth / #@INSint / #@GCMS metadata from a .dat file
90
+ header (every line above the first data line, see is_data_line).
93
91
 
94
- #@INSexp + #@INSint mark a spectrum converted in SMS mode, #@GCMS marks a
95
- spectrum converted in CMS mode (single G value of the single-line absorber).
92
+ #@INSexp or #@INSth, with #@INSint, mark a spectrum converted in SMS mode,
93
+ #@GCMS marks a spectrum converted in CMS mode (single G value of the
94
+ single-line absorber).
96
95
  """
97
96
  result = {
98
97
  'INS': None,
@@ -378,8 +377,8 @@ def resolve_instrumental_for_file(app, spectrum_file, use_dat_metadata=True, for
378
377
 
379
378
  The single source of truth for "what instrumental function does this spectrum
380
379
  use". When ``use_dat_metadata`` is enabled the spectrum's own .dat header
381
- decides the method: a #@GCMS line marks a CMS spectrum, #@INSexp + #@INSint
382
- mark an SMS spectrum (#@GCMS wins if a file carries both). Otherwise — or when
380
+ decides the method: a #@GCMS line marks a CMS spectrum, #@INSexp or #@INSth
381
+ with #@INSint an SMS spectrum (#@GCMS wins if a file carries both). Otherwise — or when
383
382
  the file has no usable metadata — the UI-selected method (CMS/SMS checkboxes)
384
383
  with the internal values is used: the G input field for CMS, the global
385
384
  INSexp/INSint files for SMS. This is what lets different spectra of one
@@ -410,7 +409,8 @@ def resolve_instrumental_for_file(app, spectrum_file, use_dat_metadata=True, for
410
409
 
411
410
  if use_dat_metadata and spectrum_file and str(spectrum_file).lower().endswith('.dat'):
412
411
  meta = parse_dat_instrumental_metadata(spectrum_file)
413
- has_sms = meta['INS'] is not None and meta['MulCo'] is not None and meta['x0'] is not None
412
+ has_sms = ((meta['INS'] is not None or meta['INSacc'] is not None)
413
+ and meta['MulCo'] is not None and meta['x0'] is not None)
414
414
  # File metadata may set the method, unless we are locked to the other one.
415
415
  if meta['has_gcms'] and force_method != 'SMS':
416
416
  g = float(meta['GCMS'])
@@ -420,20 +420,17 @@ def resolve_instrumental_for_file(app, spectrum_file, use_dat_metadata=True, for
420
420
  'note': f"{name}: CMS — G = {g:g} from .dat metadata (#@GCMS)",
421
421
  }
422
422
  if has_sms and force_method != 'CMS':
423
- # A .dat written by this program carries BOTH descriptions of the
424
- # same source -- #@INSth (simulated) and #@INSexp (Gaussian sum) --
425
- # and #@INSint supplies the integration constants for either. WHICH
426
- # one is used is the user's setting, exactly as for the global
427
- # files; that is what makes switching free, and switching back free.
423
+ # A .dat written by this program carries ONE description of its
424
+ # source -- #@INSth (simulated) or #@INSexp (Gaussian sum), the one
425
+ # in use when it was written (build_dat_metadata_lines) -- and
426
+ # #@INSint the integration constants. That one is used, whatever the
427
+ # setting is now, so spectra of either kind are fitted together each
428
+ # with its own.
428
429
  #
429
- # #@INSth used to win unconditionally here, so selecting "Set of
430
- # Gaussians" changed nothing for any spectrum whose file carried a
431
- # theoretical shape -- the fit went on using it.
432
- #
433
- # The spectrum's OWN instrumental function is still what is used:
434
- # the setting chooses between the two the file carries, it never
435
- # replaces them with the global ones.
436
- if meta['has_insacc'] and instrumental_method(app) == 'theory':
430
+ # Files written before carry BOTH; for them, and only for them, the
431
+ # setting chooses, as it did then.
432
+ if meta['has_insacc'] and (meta['INS'] is None
433
+ or instrumental_method(app) == 'theory'):
437
434
  return {
438
435
  'method': 'SMS', 'Met': 0, 'INS': meta['INSacc'],
439
436
  'x0': float(meta['x0']), 'MulCo': float(meta['MulCo']),
@@ -449,8 +446,8 @@ def resolve_instrumental_for_file(app, spectrum_file, use_dat_metadata=True, for
449
446
  # No usable metadata for the (possibly forced) method -> internal fallback.
450
447
  missing = []
451
448
  if force_method != 'CMS':
452
- if meta['INS'] is None:
453
- missing.append('#@INSexp')
449
+ if meta['INS'] is None and meta['INSacc'] is None:
450
+ missing.append('#@INSexp or #@INSth')
454
451
  if meta['MulCo'] is None or meta['x0'] is None:
455
452
  missing.append('#@INSint')
456
453
  if force_method != 'SMS':
@@ -514,7 +511,10 @@ def analyze_instrumental_methods(app, spectrum_files, use_dat_metadata):
514
511
 
515
512
 
516
513
  def compute_norm(pool, JN, method_params):
517
- """Normalization integral for a resolved method (CMS or SMS)."""
514
+ """Normalization integral for a resolved method (CMS or SMS): the part of the
515
+ unit-area source line that TI's grid samples. It must be computed with the
516
+ same JN and source as the TI call it is passed to; how CMS and SMS use it
517
+ is explained at "SOURCE NORMALISATION" in models.TI."""
518
518
  pNorm = np.array([float(0)] * number_of_baseline_parameters)
519
519
  pNorm[0] = 1
520
520
  return m5.TI(
@@ -524,6 +524,27 @@ def compute_norm(pool, JN, method_params):
524
524
  )[0]
525
525
 
526
526
 
527
+ def cms_norm_following_g(pool, MulCoCMS):
528
+ """``norm(JN, G)``: compute_norm of the CMS source of width G on JN points.
529
+
530
+ models.TI needs, for CMS, the Norm of the very G and JN it integrates with
531
+ (see "SOURCE NORMALISATION" there). The instrumental-function search FITS G,
532
+ so one Norm computed at the start would go stale. The last value is kept and
533
+ recomputed only when G or JN differs from the previous call: the numerical
534
+ derivatives of every other parameter reuse it.
535
+ """
536
+ last = {}
537
+
538
+ def norm(JN, G):
539
+ key = (int(JN), float(G))
540
+ if last.get('key') != key:
541
+ last['key'] = key
542
+ last['Norm'] = compute_norm(pool, int(JN), {'x0': 0, 'MulCo': MulCoCMS,
543
+ 'INS': G, 'Met': 1})
544
+ return last['Norm']
545
+ return norm
546
+
547
+
527
548
  # How many times more integration points the high-resolution convergence check
528
549
  # uses. Kept in sync with the "(re)find instrumental function" fit, which
529
550
  # recomputes its result at JN*4 to draw the cyan F2-F difference line.
@@ -556,11 +577,12 @@ def build_dat_metadata_lines(app):
556
577
  """Instrumental header lines to embed into .dat files converted from RAW.
557
578
 
558
579
  CMS mode (the CMS checkbox is checked): a single #@GCMS line with the
559
- current G value. SMS mode: #@INSexp / #@INSint lines from the global
560
- parameter files, exactly as before -- plus an #@INSth line carrying the
561
- theoretical instrumental function whenever one is current. The conventional
562
- lines are never dropped, so a .dat converted with the accurate shape in use
563
- still describes that same source to any reader that only knows #@INSexp.
580
+ current G value. SMS mode: the ONE instrumental function in use
581
+ (get_sms_instrumental_from_global_files) -- #@INSth for the theoretical
582
+ shape, #@INSexp for the Gaussian sum -- and the #@INSint line of its
583
+ integration grid. One description only, so the file alone says which shape
584
+ its fits use, whatever the setting is then; spectra converted with
585
+ different descriptions can be fitted together, each with its own.
564
586
 
565
587
  Returns:
566
588
  (lines, method): list of header strings (without newlines) and the
@@ -570,17 +592,12 @@ def build_dat_metadata_lines(app):
570
592
  g = get_internal_gcms(app)
571
593
  return [f'{DAT_GCMS_PREFIX} {float(g)}'], 'CMS'
572
594
 
573
- instrumental_int_path = os.path.join(app.params_dir, 'INSint.txt')
574
- MulCo, x0 = np.genfromtxt(instrumental_int_path, delimiter=' ', skip_footer=0)
575
- INS = np.atleast_1d(get_legacy_sms_instrumental(app))
595
+ INS, MulCo, x0 = get_sms_instrumental_from_global_files(app)
596
+ prefix = DAT_INS_EXP_PREFIX if smst.ins_kind(INS) == smst.KIND_GAUSS else DAT_INS_TH_PREFIX
576
597
  lines = [
577
- DAT_INS_EXP_PREFIX + ' ' + ' '.join(str(float(v)) for v in INS),
598
+ prefix + ' ' + ' '.join(str(float(v)) for v in np.atleast_1d(INS)),
578
599
  f'{DAT_INS_INT_PREFIX} {float(MulCo)} {float(x0)}',
579
600
  ]
580
- acc = read_accurate_instrumental(app)
581
- if acc is not None:
582
- lines.append(DAT_INS_ACC_PREFIX + ' '
583
- + ' '.join(str(float(v)) for v in np.atleast_1d(acc)))
584
601
  return lines, 'SMS'
585
602
 
586
603
 
@@ -625,8 +642,9 @@ def dat_metadata_key(file_path):
625
642
  meta = parse_dat_instrumental_metadata(file_path)
626
643
  if meta['has_gcms']:
627
644
  return ('CMS', round(float(meta['GCMS']), 9))
628
- if meta['has_insexp'] and meta['has_insint']:
629
- ins = tuple(round(float(v), 9) for v in np.atleast_1d(meta['INS']))
645
+ if (meta['has_insexp'] or meta['has_insacc']) and meta['has_insint']:
646
+ ins = (tuple(round(float(v), 9) for v in np.atleast_1d(meta['INS']))
647
+ if meta['has_insexp'] else None)
630
648
  acc = (tuple(round(float(v), 9) for v in np.atleast_1d(meta['INSacc']))
631
649
  if meta['has_insacc'] else None)
632
650
  return ('SMS', ins, round(float(meta['MulCo']), 9),
@@ -653,9 +671,10 @@ def shared_dat_metadata_lines(file_paths):
653
671
 
654
672
 
655
673
  # The instrumental-function lines build_dat_metadata_lines writes: what
656
- # "Overwrite instrumental function in selected .dat files" replaces.
674
+ # "Overwrite instrumental function in selected .dat files" replaces. The legacy
675
+ # #@INSacc too: left behind, it would be a second description next to the new one.
657
676
  DAT_INS_PREFIXES = (DAT_GCMS_PREFIX, DAT_INS_EXP_PREFIX, DAT_INS_INT_PREFIX,
658
- DAT_INS_TH_PREFIX)
677
+ DAT_INS_TH_PREFIX, DAT_INS_ACC_PREFIX_LEGACY)
659
678
 
660
679
 
661
680
  def write_dat_instrumental_lines(file_path, lines):
@@ -1244,6 +1263,11 @@ def instrumental(app, ref, mode=0, pool=None, request=None):
1244
1263
  # must not flip it to CMS (force_method='SMS').
1245
1264
  mp = resolve_instrumental_for_file(app, file, use_dat_metadata=use_dat_metadata, force_method='SMS')
1246
1265
  INS, MulCo, x0, note = mp['INS'], mp['MulCo'], mp['x0'], mp['note']
1266
+ if smst.ins_kind(INS) != smst.KIND_GAUSS:
1267
+ # a file carrying only #@INSth: nothing for a Gaussian sum to
1268
+ # continue from
1269
+ INS = get_legacy_sms_instrumental(app)
1270
+ note += f"; not a sum of Gaussians, refining the one in {INS_EXP_FILE}"
1247
1271
  print(f"[Instrumental function] {note}")
1248
1272
  p0 = np.copy(INS)
1249
1273
  n = int(len(INS)/3)
@@ -1284,14 +1308,16 @@ def instrumental(app, ref, mode=0, pool=None, request=None):
1284
1308
  print(fix)
1285
1309
  _refuse_too_few_points(len(B), len(p) - len(np.unique(fix)), data['regions'])
1286
1310
 
1287
- # ``lengths`` tells TI where each joined spectrum ends (None: one spectrum)
1311
+ # ``lengths`` tells TI where each joined spectrum ends (None: one spectrum).
1312
+ # CMS: TI needs the Norm of the G being fitted (p[-1]) and of the current JN.
1313
+ cms_norm = cms_norm_following_g(pool, MulCoCMS)
1288
1314
  if mode == 1:
1289
1315
  if CMS_ch == 0:
1290
1316
  def INSSS(x_exp, p, lengths=lengths):
1291
1317
  return m5.TI(x_exp, p[:mod_p_len], model, JN, pool, x0, MulCo, p[mod_p_len:], Distri, Cor, Recon=Recon, lengths=lengths)
1292
1318
  if CMS_ch == 1:
1293
1319
  def INSSS(x_exp, p, lengths=lengths):
1294
- return m5.TI(x_exp, p[:mod_p_len], model, JN, pool, 0, MulCoCMS, p[-1], Distri, Cor, Met=1, Recon=Recon, lengths=lengths)
1320
+ return m5.TI(x_exp, p[:mod_p_len], model, JN, pool, 0, MulCoCMS, p[-1], Distri, Cor, Met=1, Norm=cms_norm(JN, p[-1]), Recon=Recon, lengths=lengths)
1295
1321
 
1296
1322
  # CMS_ch could not be equal to 1 for mode 0
1297
1323
  # Not meaningful to use ESRF standard single line absorber for CMS
@@ -1308,7 +1334,7 @@ def instrumental(app, ref, mode=0, pool=None, request=None):
1308
1334
  return m5.TI(x_exp, p[:mod_p_len], model, JN, pool, x0, MulCo, p[mod_p_len:], lengths=lengths)
1309
1335
  if CMS_ch == 1:
1310
1336
  def INSSS(x_exp, p, lengths=lengths):
1311
- return m5.TI(x_exp, p[:mod_p_len], model, JN, pool, 0, MulCoCMS, p[-1], Met=1, lengths=lengths)
1337
+ return m5.TI(x_exp, p[:mod_p_len], model, JN, pool, 0, MulCoCMS, p[-1], Met=1, Norm=cms_norm(JN, p[-1]), lengths=lengths)
1312
1338
 
1313
1339
  # Normalization function
1314
1340
  # to insure sum of amplitudes squared = 1 in case of SMS
@@ -1847,11 +1873,10 @@ def instrumental_theory(app, ref=0, mode=0, pool=None, n_rational=2,
1847
1873
  (see search_data), by default the first spectrum shown; with the model,
1848
1874
  several spectra fitted together with one instrumental function.
1849
1875
 
1850
- On success INSth.txt holds the theoretical instrumental function, INSint.txt
1851
- the matching integration constants, and INSexp.txt the best conventional
1852
- Gaussian-sum stand-in for the same source -- so every later fit and every
1853
- RAW->DAT conversion uses the theoretical shape, while a .dat still carries a
1854
- usable #@INSexp for anything that does not know the #@INSth marker.
1876
+ On success INSth.txt holds the theoretical instrumental function and
1877
+ INSint.txt the matching integration constants; INSexp.txt is left alone.
1878
+ While "theory" is selected every later fit uses the theoretical shape, and
1879
+ every RAW->DAT conversion writes it as #@INSth (and no #@INSexp).
1855
1880
 
1856
1881
  ``temperature_C`` is the iron borate crystal temperature, when it was
1857
1882
  recorded. Temperature enters the physics only through B_s, so it is turned
@@ -2312,9 +2337,9 @@ def instrumental_theory(app, ref=0, mode=0, pool=None, n_rational=2,
2312
2337
  # switching between them costs nothing and neither can be lost by running
2313
2338
  # the other search.
2314
2339
  #
2315
- # The cost is that #@INSexp in a .dat converted afterwards may describe an
2316
- # older state of the source than #@INSth does. That is the lesser evil: a
2317
- # slightly stale second opinion, rather than silently destroying a fit.
2340
+ # A .dat converted afterwards carries only the description in use
2341
+ # (build_dat_metadata_lines), so neither store's state leaks into it as a
2342
+ # second opinion.
2318
2343
  if gauss is not None:
2319
2344
  print(f"[Instrumental function: theory] {len(gauss) // 3}-Gaussian "
2320
2345
  f"stand-in computed but NOT written: {insexp_path} holds the "
@@ -4,7 +4,7 @@ import multiprocessing as mp
4
4
  from PySide6.QtWidgets import QApplication
5
5
  import syncmoss.error_reporter as error_reporter
6
6
  from syncmoss.syncmoss_main import PhysicsApp
7
- __VERSION__ = "0.5.0"
7
+ __VERSION__ = "0.5.1"
8
8
 
9
9
 
10
10
  def _run_gui_smoke():