syncmoss 0.8.2__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 (311) hide show
  1. {syncmoss-0.8.2 → syncmoss-0.8.4}/.gitignore +4 -1
  2. {syncmoss-0.8.2/syncmoss.egg-info → syncmoss-0.8.4}/PKG-INFO +1 -1
  3. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Calibration.py +49 -35
  4. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library_io.py +10 -3
  5. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/compile_functions.py +2 -1
  6. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/constants.py +9 -0
  7. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/dual_numbers.py +23 -4
  8. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/exclusion_bar.py +2 -1
  9. syncmoss-0.8.4/syncmoss/expression_eval.py +66 -0
  10. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/fitting_io.py +38 -31
  11. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/hamiltonian_dual.py +25 -3
  12. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/legacy.py +57 -28
  13. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/main.py +38 -1
  14. syncmoss-0.8.4/syncmoss/model_calibration.py +409 -0
  15. syncmoss-0.8.4/syncmoss/model_calibration_window.py +292 -0
  16. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/model_io.py +23 -12
  17. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/models.py +112 -55
  18. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/models_dual.py +9 -5
  19. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/models_positions.py +5 -4
  20. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/one_model.py +13 -5
  21. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/help.md +18 -0
  22. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/help_extended.md +134 -34
  23. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/models_description.md +25 -10
  24. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters_table.py +28 -21
  25. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/spectrum_io.py +14 -13
  26. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/spectrum_plotter.py +26 -36
  27. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/syncmoss_main.py +54 -21
  28. {syncmoss-0.8.2 → syncmoss-0.8.4/syncmoss.egg-info}/PKG-INFO +1 -1
  29. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss.egg-info/SOURCES.txt +3 -0
  30. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss.egg-info/scm_file_list.json +3 -0
  31. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/golden_models.json +8 -0
  32. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/resource_profile.json +706 -162
  33. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_calibrate_menu.py +29 -7
  34. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_calibration.py +34 -0
  35. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_console_io.py +35 -0
  36. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_dual_numbers.py +15 -2
  37. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_exclusion_gui.py +47 -1
  38. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_expression_validation.py +2 -2
  39. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_faddeeva.py +15 -3
  40. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_hamiltonian_dual.py +15 -12
  41. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_hamiltonian_texture.py +202 -45
  42. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_legacy.py +40 -22
  43. syncmoss-0.8.4/tests/test_model_calibration.py +317 -0
  44. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_model_io.py +5 -5
  45. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_models_dual.py +7 -5
  46. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_polarization.py +11 -10
  47. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_save_result_model.py +14 -2
  48. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_sms_theory.py +3 -2
  49. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_thick_gui.py +40 -25
  50. syncmoss-0.8.2/syncmoss/expression_eval.py +0 -43
  51. {syncmoss-0.8.2 → syncmoss-0.8.4}/.gitattributes +0 -0
  52. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/Tests.yml +0 -0
  53. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_MacOS.yml +0 -0
  54. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_PyPI.yml +0 -0
  55. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_TagRelease.yml +0 -0
  56. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_Tests.yml +0 -0
  57. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_UploadRelease.yml +0 -0
  58. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_Version.yml +0 -0
  59. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_Wheels.yml +0 -0
  60. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/_WindowsExe.yml +0 -0
  61. {syncmoss-0.8.2 → syncmoss-0.8.4}/.github/workflows/release.yml +0 -0
  62. {syncmoss-0.8.2 → syncmoss-0.8.4}/.vscode/settings.json +0 -0
  63. {syncmoss-0.8.2 → syncmoss-0.8.4}/COPYING.txt +0 -0
  64. {syncmoss-0.8.2 → syncmoss-0.8.4}/LICENSE +0 -0
  65. {syncmoss-0.8.2 → syncmoss-0.8.4}/Lib_test/test.mdl +0 -0
  66. {syncmoss-0.8.2 → syncmoss-0.8.4}/NOTICE.txt +0 -0
  67. {syncmoss-0.8.2 → syncmoss-0.8.4}/README.md +0 -0
  68. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/MacOS.spec +0 -0
  69. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/SYNCmoss.png +0 -0
  70. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/Windows.spec +0 -0
  71. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/bundle.py +0 -0
  72. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/dmg_background.pdf +0 -0
  73. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/licenses/GPL-3.0.txt +0 -0
  74. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/licenses/LGPL-3.0.txt +0 -0
  75. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/macos_bundle.py +0 -0
  76. {syncmoss-0.8.2 → syncmoss-0.8.4}/bundle/third_party_licenses.py +0 -0
  77. {syncmoss-0.8.2 → syncmoss-0.8.4}/docs/thick_models.md +0 -0
  78. {syncmoss-0.8.2 → syncmoss-0.8.4}/docs/thick_vs_thin.md +0 -0
  79. {syncmoss-0.8.2 → syncmoss-0.8.4}/pyproject.toml +0 -0
  80. {syncmoss-0.8.2 → syncmoss-0.8.4}/requirements.txt +0 -0
  81. {syncmoss-0.8.2 → syncmoss-0.8.4}/setup.cfg +0 -0
  82. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/CMS_source_geometry_calibration.py +0 -0
  83. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/ASM P(m) from m.mdl +0 -0
  84. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/ASM m from P(m).mdl +0 -0
  85. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Central shift vs temperature.mdl +0 -0
  86. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field in applied field, Langevin.mdl +0 -0
  87. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field vs temperature, Bloch.mdl +0 -0
  88. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field vs temperature, critical.mdl +0 -0
  89. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Hyperfine field vs temperature, empirical.mdl +0 -0
  90. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Lamb-Mossbauer factor vs temperature.mdl +0 -0
  91. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Lifetime from line width.mdl +0 -0
  92. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Neel relaxation time vs temperature.mdl +0 -0
  93. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Paramagnetic quadrupole shift from Hamiltonian.mdl +0 -0
  94. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Quadrupole splitting, doublet.mdl +0 -0
  95. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Quadrupole splitting, sextet.mdl +0 -0
  96. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Thickness PDF, Gamma.mdl +0 -0
  97. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Thickness PDF, pressed window (clamped plate).mdl +0 -0
  98. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Expressions/Thickness PDF, pressed window (membrane).mdl +0 -0
  99. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Hamiltonian_helper.py +0 -0
  100. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Aegirine.mdl +0 -0
  101. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Akaganeite.mdl +0 -0
  102. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Almandine.mdl +0 -0
  103. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Antitaenite.mdl +0 -0
  104. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Arsenopyrite.mdl +0 -0
  105. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Bornite.mdl +0 -0
  106. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Bridgmanite (Fe,Al-bearing) @100 GPa.mdl +0 -0
  107. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Bridgmanite (Fe,Al-bearing).mdl +0 -0
  108. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Celadonite.mdl +0 -0
  109. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Cementite.mdl +0 -0
  110. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Chalcopyrite.mdl +0 -0
  111. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Clinopyroxene (augite).mdl +0 -0
  112. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Copiapite.mdl +0 -0
  113. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Cubanite.mdl +0 -0
  114. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Epidote.mdl +0 -0
  115. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Fayalite (Fe-olivine).mdl +0 -0
  116. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Ferrihydrite (2-line).mdl +0 -0
  117. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Ferropericlase.mdl +0 -0
  118. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Goethite.mdl +0 -0
  119. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Green rust (fougerite, carbonate).mdl +0 -0
  120. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Haegg carbide.mdl +0 -0
  121. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Hedenbergite.mdl +0 -0
  122. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Hematite.mdl +0 -0
  123. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Heterosite (FePO4).mdl +0 -0
  124. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Ilmenite.mdl +0 -0
  125. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Iron phosphide.mdl +0 -0
  126. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Isocubanite.mdl +0 -0
  127. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Jarosite.mdl +0 -0
  128. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Kamacite.mdl +0 -0
  129. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Lepidocrocite.mdl +0 -0
  130. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Maghemite.mdl +0 -0
  131. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Magnetite.mdl +0 -0
  132. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Marcasite.mdl +0 -0
  133. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Melanterite.mdl +0 -0
  134. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Orthopyroxene (enstatite-ferrosilite).mdl +0 -0
  135. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Prussian blue (ferric ferrocyanide).mdl +0 -0
  136. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Pyrite.mdl +0 -0
  137. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Pyrrhotite.mdl +0 -0
  138. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Rhomboclase.mdl +0 -0
  139. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Roemerite.mdl +0 -0
  140. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Siderite.mdl +0 -0
  141. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Szomolnokite.mdl +0 -0
  142. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Taenite.mdl +0 -0
  143. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Talnakhite.mdl +0 -0
  144. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Tetrataenite.mdl +0 -0
  145. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Triphylite (LiFePO4).mdl +0 -0
  146. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Troilite.mdl +0 -0
  147. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Vivianite.mdl +0 -0
  148. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/Voltaite.mdl +0 -0
  149. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library/alpha-Fe (metallic iron, bcc).mdl +0 -0
  150. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/Library_window.py +0 -0
  151. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/app_paths.py +0 -0
  152. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/bliss_channel.py +0 -0
  153. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/compile_window.py +0 -0
  154. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/components_results.py +0 -0
  155. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/components_search.py +0 -0
  156. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/components_window.py +0 -0
  157. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/console_io.py +0 -0
  158. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/dual_kernels.py +0 -0
  159. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/error_reporter.py +0 -0
  160. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/exclusion_regions.py +0 -0
  161. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/experimental_features.py +0 -0
  162. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/expressions_io.py +0 -0
  163. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/expressions_window.py +0 -0
  164. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/faddeeva.py +0 -0
  165. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/fit_quality.py +0 -0
  166. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/frozen_cache_locator.py +0 -0
  167. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/CheckBox.png +0 -0
  168. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/CheckBox_.png +0 -0
  169. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/CheckBox_L.png +0 -0
  170. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/CheckBox_L2.png +0 -0
  171. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/DU.png +0 -0
  172. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/Switch.png +0 -0
  173. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/UD.png +0 -0
  174. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/icons/icon_r.ico +0 -0
  175. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/instrumental_dialogs.py +0 -0
  176. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/instrumental_io.py +0 -0
  177. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/instrumental_window.py +0 -0
  178. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/jit_cache.py +0 -0
  179. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/license_window.py +0 -0
  180. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/minimi_lib.py +0 -0
  181. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/models_description_window.py +0 -0
  182. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/models_removed.py +0 -0
  183. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/one_spectrum.py +0 -0
  184. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/ABSorber3.txt +0 -0
  185. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/Be.txt +0 -0
  186. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/Calibration.dat +0 -0
  187. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/GCMS.txt +0 -0
  188. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/INS_APS.txt +0 -0
  189. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/INSexp.txt +0 -0
  190. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/INSint.txt +0 -0
  191. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/INSth.txt +0 -0
  192. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/KB.txt +0 -0
  193. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/NFS.txt +0 -0
  194. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/Standard_CMS.dat +0 -0
  195. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/Standard_SMS.dat +0 -0
  196. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/parameters/calibr.png +0 -0
  197. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/result_window.py +0 -0
  198. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/results_table.py +0 -0
  199. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/sms_theory.py +0 -0
  200. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/spectrum_model.py +0 -0
  201. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/spectrum_parameters.py +0 -0
  202. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/spectrum_reference.py +0 -0
  203. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/spectrum_reference_window.py +0 -0
  204. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/supp_menu.py +0 -0
  205. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/support_math.py +0 -0
  206. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/test_graf.txt +0 -0
  207. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/test_param.txt +0 -0
  208. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/theme_dark.json +0 -0
  209. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/theme_light.json +0 -0
  210. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss/thickness_distribution.py +0 -0
  211. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss.egg-info/dependency_links.txt +0 -0
  212. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss.egg-info/entry_points.txt +0 -0
  213. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss.egg-info/requires.txt +0 -0
  214. {syncmoss-0.8.2 → syncmoss-0.8.4}/syncmoss.egg-info/top_level.txt +0 -0
  215. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/README.md +0 -0
  216. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/compile_stand_ins.py +0 -0
  217. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/conftest.py +0 -0
  218. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/Distr_corr.mdl +0 -0
  219. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/Distr_distr.mdl +0 -0
  220. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/alpha_fe_sms_000.mca +0 -0
  221. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/calibration_000_golden.json +0 -0
  222. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/generate_cal_fixtures.py +0 -0
  223. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/parameters/Calibration.dat +0 -0
  224. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/parameters/GCMS.txt +0 -0
  225. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/parameters/INSexp.txt +0 -0
  226. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/parameters/INSint.txt +0 -0
  227. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/parameters/INSth.txt +0 -0
  228. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/synthetic_alpha_fe_cms_linear.mca +0 -0
  229. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/data/synthetic_alpha_fe_cms_sinus.mca +0 -0
  230. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/profile_resources.py +0 -0
  231. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/syncmoss_test.py +0 -0
  232. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_asm_p.py +0 -0
  233. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_baseline_polynomial.py +0 -0
  234. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_bliss_channel.py +0 -0
  235. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_calculation_time.py +0 -0
  236. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_calibration_helpers.py +0 -0
  237. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_calibration_path.py +0 -0
  238. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_channel_average.py +0 -0
  239. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_chi2_spread.py +0 -0
  240. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_cms_source_geometry_calibration.py +0 -0
  241. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_components_search.py +0 -0
  242. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_contact_author.py +0 -0
  243. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_cosine_smearing.py +0 -0
  244. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_create_spectrum_from_model.py +0 -0
  245. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_default_settings.py +0 -0
  246. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_distr_composition.py +0 -0
  247. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_distr_expansion.py +0 -0
  248. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_distr_mdl.py +0 -0
  249. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_distr_t.py +0 -0
  250. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_distr_targets.py +0 -0
  251. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_distr_text_references.py +0 -0
  252. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_dual_kernels.py +0 -0
  253. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_error_reporter.py +0 -0
  254. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_exclusion_fit.py +0 -0
  255. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_exclusion_regions.py +0 -0
  256. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_expression_fit_start.py +0 -0
  257. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_expressions.py +0 -0
  258. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_find_bar.py +0 -0
  259. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_fit_core.py +0 -0
  260. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_fit_one_spectrum.py +0 -0
  261. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_fit_quality.py +0 -0
  262. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_golden_models.py +0 -0
  263. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_gui_smoke.py +0 -0
  264. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_impurity_presets.py +0 -0
  265. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_instrumental_joint.py +0 -0
  266. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_instrumental_metadata.py +0 -0
  267. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_instrumental_method_choice.py +0 -0
  268. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_instrumental_recentre.py +0 -0
  269. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_instrumental_window.py +0 -0
  270. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_integral_points.py +0 -0
  271. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_interrupt.py +0 -0
  272. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_jacobi_elliptic.py +0 -0
  273. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_jit_cache.py +0 -0
  274. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_library_dir.py +0 -0
  275. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_library_io.py +0 -0
  276. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_license_window.py +0 -0
  277. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_link_chains.py +0 -0
  278. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_minimi_batch_eval.py +0 -0
  279. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_minimi_bounds.py +0 -0
  280. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_minimi_covariance.py +0 -0
  281. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_model_append.py +0 -0
  282. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_model_only_mode.py +0 -0
  283. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_model_pointwise.py +0 -0
  284. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_nbaseline_multidistr.py +0 -0
  285. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_nbaseline_results.py +0 -0
  286. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_node_sum_reuse.py +0 -0
  287. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_one_model_expand.py +0 -0
  288. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_one_model_gui.py +0 -0
  289. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_overwrite_dat_instrumental.py +0 -0
  290. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_parameter_links.py +0 -0
  291. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_recon_composition.py +0 -0
  292. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_recon_mdl.py +0 -0
  293. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_recon_results.py +0 -0
  294. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_recon_variants.py +0 -0
  295. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_reference_shift.py +0 -0
  296. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_replaced_component_skip.py +0 -0
  297. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_result_window.py +0 -0
  298. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_results_table_image.py +0 -0
  299. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_results_table_rows.py +0 -0
  300. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_sdw_grid.py +0 -0
  301. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_search_guards.py +0 -0
  302. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_source_norm.py +0 -0
  303. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_spectrum_model.py +0 -0
  304. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_spectrum_parameters.py +0 -0
  305. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_support_math.py +0 -0
  306. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_table_marks.py +0 -0
  307. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_take_result.py +0 -0
  308. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_texture_s1.py +0 -0
  309. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_theory_search.py +0 -0
  310. {syncmoss-0.8.2 → syncmoss-0.8.4}/tests/test_voigt_complex.py +0 -0
  311. {syncmoss-0.8.2 → 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.2
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'
@@ -31,9 +31,10 @@ Where a derivative does not exist:
31
31
  * abs at 0: along each parameter the one-sided derivative |d|, what its
32
32
  forward difference gives -- the column of a parameter that starts at 0 is
33
33
  not zero, so it can leave 0;
34
- * sqrt and a fractional power at 0: 0, not inf. So sqrt(a**2 + b**2) has no
35
- derivative left at a = b = 0; np.hypot(a, b) is the form that keeps it
36
- (one-sided along each parameter, as abs);
34
+ * sqrt, cbrt and a fractional power at 0: 0, not inf. So sqrt(a**2 + b**2)
35
+ has no derivative left at a = b = 0; np.hypot(a, b) is the form that keeps
36
+ it (one-sided along each parameter, as abs);
37
+ * arctan2 at (0, 0): 0;
37
38
  * floor, ceil, round, sign: plain numbers (their derivative is 0).
38
39
  The values may be complex; the parameters are real.
39
40
 
@@ -395,6 +396,18 @@ def _sqrt_derivative(v, f):
395
396
  return np.where(f == 0, 0, 0.5 / f)
396
397
 
397
398
 
399
+ def _cbrt_derivative(v, f):
400
+ with np.errstate(divide='ignore', invalid='ignore'):
401
+ return np.where(f == 0, 0, 1 / (3 * f * f))
402
+
403
+
404
+ def _arctan2(a, b):
405
+ va, vb = value(a), value(b)
406
+ r2 = va * va + vb * vb
407
+ with np.errstate(divide='ignore', invalid='ignore'):
408
+ return chain(np.arctan2(va, vb), (np.where(r2 == 0, 0, vb / r2), np.where(r2 == 0, 0, -va / r2)), (a, b))
409
+
410
+
398
411
  # =============================================================================
399
412
  # The array functions
400
413
  # =============================================================================
@@ -429,16 +442,22 @@ def _linspace(start, stop, num=50):
429
442
  _UFUNCS = {
430
443
  np.add: _add, np.subtract: _subtract, np.multiply: _multiply, np.true_divide: _divide,
431
444
  np.power: _power, np.float_power: _power, np.matmul: _matmul, np.hypot: _hypot,
432
- np.maximum: _maximum, np.minimum: _minimum,
445
+ np.maximum: _maximum, np.minimum: _minimum, np.arctan2: _arctan2,
433
446
  np.negative: lambda a: -a,
434
447
  np.positive: lambda a: a,
435
448
  np.absolute: _abs,
436
449
  np.conjugate: lambda a: a.conj(),
437
450
  np.square: lambda a: _multiply(a, a),
438
451
  np.sqrt: _function(np.sqrt, _sqrt_derivative),
452
+ np.cbrt: _function(np.cbrt, _cbrt_derivative),
439
453
  np.exp: _function(np.exp, lambda v, f: f),
454
+ np.expm1: _function(np.expm1, lambda v, f: np.exp(v)),
440
455
  np.log: _function(np.log, lambda v, f: 1 / v),
456
+ np.log1p: _function(np.log1p, lambda v, f: 1 / (1 + v)),
457
+ np.log2: _function(np.log2, lambda v, f: 1 / (v * np.log(2))),
441
458
  np.log10: _function(np.log10, lambda v, f: 1 / (v * np.log(10))),
459
+ np.deg2rad: _function(np.deg2rad, lambda v, f: np.pi / 180),
460
+ np.rad2deg: _function(np.rad2deg, lambda v, f: 180 / np.pi),
442
461
  np.sin: _function(np.sin, lambda v, f: np.cos(v)),
443
462
  np.cos: _function(np.cos, lambda v, f: -np.sin(v)),
444
463
  np.tan: _function(np.tan, lambda v, f: 1 + f * f),
@@ -216,7 +216,8 @@ class ExclusionBar(QWidget):
216
216
  base = self.main_window._result_base_path()
217
217
  default = (base + er.FILE_SUFFIX if base
218
218
  else os.path.join(self.main_window.workfolder or "", "regions" + er.FILE_SUFFIX))
219
- path, _ = QFileDialog.getSaveFileName(self, "Save exclusion regions", default, _FILE_FILTER)
219
+ path, _ = QFileDialog.getSaveFileName(self, "Save exclusion regions",
220
+ self.main_window._save_dialog_start(default), _FILE_FILTER)
220
221
  if not path:
221
222
  self.main_window.set_status("Saving canceled", "orange")
222
223
  return
@@ -0,0 +1,66 @@
1
+ """The user-typed texts: Expression, Distr (probability density) and Corr
2
+ (dependency) rows, and the one function that evaluates them.
3
+
4
+ The ``from numpy import (...)`` block below and ``erf`` ARE the set of bare
5
+ names those texts may use, e.g. "sqrt(p[3])" or "exp(-X**2/2)"; any other
6
+ numpy function is written ``np.<name>``. Every place that evaluates such a text calls
7
+ ``eval_expr`` -- the fit, Show model, the check before them, the distribution
8
+ plot, the results table -- so they all accept the same texts. Nothing else
9
+ belongs in this module: its namespace is what the texts see.
10
+
11
+ Every function below takes dual numbers (dual_numbers' tables), so a fit's
12
+ exact Jacobian and the results table's errors cover it; a function added here
13
+ gets its derivative there. No name may be one a text reads otherwise (p, X,
14
+ N, N1, ...) nor hide a Python builtin other than abs and round: sum, max, min
15
+ keep Python's meaning (maximum, minimum are the element-wise ones).
16
+ """
17
+ import numpy as np
18
+ from numpy import (
19
+ # constants
20
+ pi, e,
21
+
22
+ # math basics
23
+ exp, log, log10, sqrt, abs, power,
24
+ log2, expm1, log1p, cbrt, square, hypot,
25
+
26
+ # trig functions (core)
27
+ sin, cos, tan,
28
+ arcsin, arccos, arctan, arctan2,
29
+ sinh, cosh, tanh,
30
+ arcsinh, arccosh, arctanh,
31
+ deg2rad, rad2deg,
32
+
33
+ # utility math
34
+ floor, ceil, round, sign,
35
+ maximum, minimum, where,
36
+
37
+ # aggregation
38
+ mean, std, var,
39
+ )
40
+
41
+ from syncmoss.dual_numbers import chain as _chain, value as _value
42
+ from syncmoss.faddeeva import faddeeva as _faddeeva
43
+
44
+
45
+ def erf(x):
46
+ """The error function, from the Faddeeva function of the line shapes:
47
+ erf(x) = 1 - exp(-x^2) w(i|x|), odd. Within 1e-15 of the exact one
48
+ (absolute: below |x| ~ 1e-3, where erf is that small, not to all its
49
+ digits). Takes dual numbers: its derivative is 2 exp(-x^2) / sqrt(pi)."""
50
+ v = np.asarray(_value(x), dtype=float)
51
+ a = np.abs(v)
52
+ y = np.sign(v) * (1.0 - np.exp(-a * a) * _faddeeva(1j * a).real)
53
+ return _chain(y, (2.0 / np.sqrt(pi) * np.exp(-v * v),), (x,))
54
+
55
+
56
+ def eval_expr(expr, p, X=None):
57
+ """Evaluate a user-typed text.
58
+
59
+ ``p`` is the model's parameter array, so the text may reference ``p[i]``;
60
+ bare numpy functions (``sqrt``, ``exp``, ...) resolve through this module's
61
+ globals (the imports above). ``X`` is optional: the distribution axis,
62
+ given for the Distr/Corr texts."""
63
+ locals_dict = {"p": p}
64
+ if X is not None:
65
+ locals_dict["X"] = X
66
+ return eval(expr, globals(), locals_dict)
@@ -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