syncmoss 0.8.1__tar.gz → 0.8.3__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.
- {syncmoss-0.8.1/syncmoss.egg-info → syncmoss-0.8.3}/PKG-INFO +1 -1
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/components_search.py +13 -7
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/dual_kernels.py +167 -9
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/dual_numbers.py +23 -4
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/exclusion_bar.py +2 -1
- syncmoss-0.8.3/syncmoss/expression_eval.py +66 -0
- syncmoss-0.8.3/syncmoss/faddeeva.py +159 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/main.py +1 -1
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/model_io.py +5 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/models.py +89 -36
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/models_dual.py +12 -6
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/help_extended.md +10 -5
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/spectrum_io.py +14 -13
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/spectrum_reference.py +11 -10
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/syncmoss_main.py +17 -1
- {syncmoss-0.8.1 → syncmoss-0.8.3/syncmoss.egg-info}/PKG-INFO +1 -1
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss.egg-info/SOURCES.txt +2 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss.egg-info/scm_file_list.json +2 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/conftest.py +11 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/resource_profile.json +506 -74
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_dual_kernels.py +78 -3
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_dual_numbers.py +15 -2
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_exclusion_gui.py +47 -1
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_expression_validation.py +2 -2
- syncmoss-0.8.3/tests/test_faddeeva.py +235 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_golden_models.py +6 -4
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_jit_cache.py +7 -5
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_models_dual.py +13 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_save_result_model.py +14 -2
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_texture_s1.py +3 -2
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_voigt_complex.py +2 -1
- syncmoss-0.8.1/syncmoss/expression_eval.py +0 -43
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.gitattributes +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/Tests.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_MacOS.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_PyPI.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_TagRelease.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_Tests.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_UploadRelease.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_Version.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_Wheels.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/_WindowsExe.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.github/workflows/release.yml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.gitignore +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/.vscode/settings.json +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/COPYING.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/LICENSE +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/Lib_test/test.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/NOTICE.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/README.md +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/MacOS.spec +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/SYNCmoss.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/Windows.spec +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/bundle.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/dmg_background.pdf +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/licenses/GPL-3.0.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/licenses/LGPL-3.0.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/macos_bundle.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/bundle/third_party_licenses.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/docs/thick_models.md +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/docs/thick_vs_thin.md +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/pyproject.toml +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/requirements.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/setup.cfg +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/CMS_source_geometry_calibration.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Calibration.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/ASM P(m) from m.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/ASM m from P(m).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Central shift vs temperature.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Hyperfine field in applied field, Langevin.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Hyperfine field vs temperature, Bloch.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Hyperfine field vs temperature, critical.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Hyperfine field vs temperature, empirical.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Lamb-Mossbauer factor vs temperature.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Lifetime from line width.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Neel relaxation time vs temperature.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Paramagnetic quadrupole shift from Hamiltonian.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Quadrupole splitting, doublet.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Quadrupole splitting, sextet.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Thickness PDF, Gamma.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Thickness PDF, pressed window (clamped plate).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Expressions/Thickness PDF, pressed window (membrane).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Hamiltonian_helper.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Aegirine.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Akaganeite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Almandine.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Antitaenite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Arsenopyrite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Bornite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Bridgmanite (Fe,Al-bearing) @100 GPa.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Bridgmanite (Fe,Al-bearing).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Celadonite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Cementite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Chalcopyrite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Clinopyroxene (augite).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Copiapite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Cubanite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Epidote.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Fayalite (Fe-olivine).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Ferrihydrite (2-line).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Ferropericlase.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Goethite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Green rust (fougerite, carbonate).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Haegg carbide.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Hedenbergite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Hematite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Heterosite (FePO4).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Ilmenite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Iron phosphide.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Isocubanite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Jarosite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Kamacite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Lepidocrocite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Maghemite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Magnetite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Marcasite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Melanterite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Orthopyroxene (enstatite-ferrosilite).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Prussian blue (ferric ferrocyanide).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Pyrite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Pyrrhotite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Rhomboclase.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Roemerite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Siderite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Szomolnokite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Taenite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Talnakhite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Tetrataenite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Triphylite (LiFePO4).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Troilite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Vivianite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/Voltaite.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library/alpha-Fe (metallic iron, bcc).mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/Library_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/app_paths.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/bliss_channel.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/compile_functions.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/compile_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/components_results.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/components_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/console_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/constants.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/error_reporter.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/exclusion_regions.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/experimental_features.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/expressions_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/expressions_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/fit_quality.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/fitting_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/frozen_cache_locator.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/hamiltonian_dual.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/CheckBox.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/CheckBox_.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/CheckBox_L.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/CheckBox_L2.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/DU.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/Switch.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/UD.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/icons/icon_r.ico +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/instrumental_dialogs.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/instrumental_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/instrumental_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/jit_cache.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/legacy.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/license_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/minimi_lib.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/models_description_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/models_positions.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/models_removed.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/one_model.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/one_spectrum.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/ABSorber3.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/Be.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/Calibration.dat +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/GCMS.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/INS_APS.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/INSexp.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/INSint.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/INSth.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/KB.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/NFS.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/Standard_CMS.dat +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/Standard_SMS.dat +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/calibr.png +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/help.md +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters/models_description.md +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/parameters_table.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/result_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/results_table.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/sms_theory.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/spectrum_model.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/spectrum_parameters.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/spectrum_plotter.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/spectrum_reference_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/supp_menu.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/support_math.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/test_graf.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/test_param.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/theme_dark.json +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/theme_light.json +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss/thickness_distribution.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss.egg-info/dependency_links.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss.egg-info/entry_points.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss.egg-info/requires.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/syncmoss.egg-info/top_level.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/README.md +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/compile_stand_ins.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/Distr_corr.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/Distr_distr.mdl +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/alpha_fe_sms_000.mca +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/calibration_000_golden.json +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/generate_cal_fixtures.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/parameters/Calibration.dat +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/parameters/GCMS.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/parameters/INSexp.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/parameters/INSint.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/parameters/INSth.txt +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/synthetic_alpha_fe_cms_linear.mca +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/data/synthetic_alpha_fe_cms_sinus.mca +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/golden_models.json +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/profile_resources.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/syncmoss_test.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_asm_p.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_baseline_polynomial.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_bliss_channel.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_calculation_time.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_calibrate_menu.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_calibration.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_calibration_helpers.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_calibration_path.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_channel_average.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_chi2_spread.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_cms_source_geometry_calibration.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_components_search.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_console_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_contact_author.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_cosine_smearing.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_create_spectrum_from_model.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_default_settings.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_distr_composition.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_distr_expansion.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_distr_mdl.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_distr_t.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_distr_targets.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_distr_text_references.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_error_reporter.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_exclusion_fit.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_exclusion_regions.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_expression_fit_start.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_expressions.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_find_bar.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_fit_core.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_fit_one_spectrum.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_fit_quality.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_gui_smoke.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_hamiltonian_dual.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_hamiltonian_texture.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_impurity_presets.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_instrumental_joint.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_instrumental_metadata.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_instrumental_method_choice.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_instrumental_recentre.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_instrumental_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_integral_points.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_interrupt.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_jacobi_elliptic.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_legacy.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_library_dir.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_library_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_license_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_link_chains.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_minimi_batch_eval.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_minimi_bounds.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_minimi_covariance.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_model_append.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_model_io.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_model_only_mode.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_model_pointwise.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_nbaseline_multidistr.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_nbaseline_results.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_node_sum_reuse.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_one_model_expand.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_one_model_gui.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_overwrite_dat_instrumental.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_parameter_links.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_polarization.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_recon_composition.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_recon_mdl.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_recon_results.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_recon_variants.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_reference_shift.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_replaced_component_skip.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_result_window.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_results_table_image.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_results_table_rows.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_sdw_grid.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_search_guards.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_sms_theory.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_source_norm.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_spectrum_model.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_spectrum_parameters.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_support_math.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_table_marks.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_take_result.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_theory_search.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/test_thick_gui.py +0 -0
- {syncmoss-0.8.1 → syncmoss-0.8.3}/tests/worker_plan.py +0 -0
|
@@ -55,7 +55,8 @@ import numpy as np
|
|
|
55
55
|
import syncmoss.minimi_lib as mi
|
|
56
56
|
import syncmoss.models as m5
|
|
57
57
|
from syncmoss.constants import NAT_WIDTH, number_of_baseline_parameters as NB
|
|
58
|
-
|
|
58
|
+
import syncmoss.faddeeva as faddeeva
|
|
59
|
+
from syncmoss.dual_kernels import _faddeeva_parts, _voigt_parts, voigt_value
|
|
59
60
|
from syncmoss.fit_quality import deviance_moments
|
|
60
61
|
from syncmoss.instrumental_io import source_for
|
|
61
62
|
from syncmoss.spectrum_io import estimate_edge_background, ns_for_background
|
|
@@ -119,9 +120,14 @@ def _check_interrupt():
|
|
|
119
120
|
def _ready():
|
|
120
121
|
"""Whether numba has the search's compiled kernels in this process
|
|
121
122
|
already: a line's depth and its depth with the derivatives (dual_kernels'
|
|
122
|
-
twins of the
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
twins of the program's line shape, models.Voigt_r -- the exact Voigt's or
|
|
124
|
+
the pseudo-Voigt's, models.exact_voigt), the line shape itself
|
|
125
|
+
(line_fwhm), minimi_hi's linear solve."""
|
|
126
|
+
if m5.exact_voigt():
|
|
127
|
+
kernels = (faddeeva.voigt_line, _faddeeva_parts)
|
|
128
|
+
else:
|
|
129
|
+
kernels = (voigt_value, _voigt_parts, m5.Voigt)
|
|
130
|
+
return all(kernel.signatures for kernel in kernels + (mi.solution,))
|
|
125
131
|
|
|
126
132
|
|
|
127
133
|
def _warm_up():
|
|
@@ -133,7 +139,7 @@ def _warm_up():
|
|
|
133
139
|
E = np.linspace(-1.0, 1.0, 8)
|
|
134
140
|
singlet_depth(E.reshape(2, 4), 1.0, 1.0, 0.0, 0.1)
|
|
135
141
|
singlet_parts(E.reshape(2, 4), 1.0, 0.0, 0.1)
|
|
136
|
-
m5.
|
|
142
|
+
m5.Voigt_r(NAT_WIDTH, 0.1, E)
|
|
137
143
|
mi.warmup()
|
|
138
144
|
return True
|
|
139
145
|
|
|
@@ -1124,10 +1130,10 @@ def merge_duplicates(lines, beta, mask, cols):
|
|
|
1124
1130
|
|
|
1125
1131
|
def line_fwhm(G):
|
|
1126
1132
|
"""The full width at half maximum (mm/s) of a line of the natural width
|
|
1127
|
-
and the Gaussian G, measured on the program's
|
|
1133
|
+
and the Gaussian G, measured on the program's line shape (models.Voigt_r)."""
|
|
1128
1134
|
half = 4 * (NAT_WIDTH + G) + 0.5
|
|
1129
1135
|
E = np.linspace(-half, half, 40001)
|
|
1130
|
-
v = m5.
|
|
1136
|
+
v = m5.Voigt_r(NAT_WIDTH, float(G), E)
|
|
1131
1137
|
above = E[v >= v.max() / 2]
|
|
1132
1138
|
return float(above[-1] - above[0])
|
|
1133
1139
|
|
|
@@ -8,6 +8,10 @@ here does that work in one compiled pass over plain arrays:
|
|
|
8
8
|
returns the value and its derivatives in the kernel's OWN arguments, and
|
|
9
9
|
dual_numbers.chain makes the Dual of them, whatever fit parameters the
|
|
10
10
|
arguments depend on; voigt_value is the value alone, in one pass;
|
|
11
|
+
* _faddeeva_parts -- the exact Voigt of faddeeva.voigt_line (models.Voigt_c
|
|
12
|
+
and Voigt_r under COMPLEX_VOIGT_METHOD 'faddeeva' / 'wofz') with its
|
|
13
|
+
derivatives, as _voigt_parts has them; voigt_parts and line_value choose
|
|
14
|
+
between the two by models.exact_voigt();
|
|
11
15
|
* expm_neg, readout -- models._expm_neg and the readout of
|
|
12
16
|
models._polarised_readout: the value and its derivatives along the
|
|
13
17
|
derivatives of the matrix handed in.
|
|
@@ -27,9 +31,12 @@ parameter i, written by hand -- with a code after SLOPE, its number of
|
|
|
27
31
|
parameters in _COUNT, its branch in _transmission, and its test against
|
|
28
32
|
central differences in tests/test_dual_kernels.py.
|
|
29
33
|
"""
|
|
34
|
+
import math
|
|
35
|
+
|
|
30
36
|
import numpy as np
|
|
31
37
|
from numba import njit
|
|
32
38
|
|
|
39
|
+
import syncmoss.faddeeva as faddeeva
|
|
33
40
|
from syncmoss.constants import LINE_RATIO_25, LINE_RATIO_34
|
|
34
41
|
from syncmoss.dual_numbers import Dual, chain, value
|
|
35
42
|
|
|
@@ -207,6 +214,150 @@ def voigt_value(gL, gG, S):
|
|
|
207
214
|
return out
|
|
208
215
|
|
|
209
216
|
|
|
217
|
+
# =============================================================================
|
|
218
|
+
# The exact Voigt of faddeeva.voigt_line (COMPLEX_VOIGT_METHOD 'faddeeva')
|
|
219
|
+
# =============================================================================
|
|
220
|
+
# faddeeva.py's constants, written out here: a kernel keeps the values of the
|
|
221
|
+
# globals it read from another file (see faddeeva.py) -- the coefficients come
|
|
222
|
+
# in as arguments for that reason
|
|
223
|
+
_F_S2L2 = math.sqrt(8.0 * math.log(2.0))
|
|
224
|
+
_F_SQRT_2 = math.sqrt(2.0)
|
|
225
|
+
_F_SQRT_PI = math.sqrt(math.pi)
|
|
226
|
+
_F_SQRT_2PI = math.sqrt(2.0 * math.pi)
|
|
227
|
+
_F_CHUNK = 64
|
|
228
|
+
#: |z| from which the slopes of w are taken from its asymptotic series: below
|
|
229
|
+
#: it w' = -2 z w + 2i/sqrt(pi) and z w' + w lose |z|^2 of w's digits to
|
|
230
|
+
#: cancellation; above it the series' terms fall as |z|^-2 (12 terms: 2e-18 at
|
|
231
|
+
#: |z| = 15). Against w' in high-precision arithmetic: 1e-13 below, 5e-16
|
|
232
|
+
#: above (the time domain's derivatives, measured 2026-11-17).
|
|
233
|
+
Z_ASYMPTOTIC = 15.0
|
|
234
|
+
_ASYMPTOTIC_TERMS = 12
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@njit(cache=True)
|
|
238
|
+
def _w_slopes(z, w):
|
|
239
|
+
"""(w'(z), z w'(z) + w(z)) for w = w(z)."""
|
|
240
|
+
if abs(z) < Z_ASYMPTOTIC:
|
|
241
|
+
wp = -2.0 * z * w + 2j / _F_SQRT_PI
|
|
242
|
+
return wp, z * wp + w
|
|
243
|
+
# w ~ (i/sqrt(pi)) sum_n c_n z^-(2n+1), c_n = (2n-1)!!/2^n
|
|
244
|
+
u = 1.0 / (z * z)
|
|
245
|
+
c = 1.0
|
|
246
|
+
un = 1.0 + 0j
|
|
247
|
+
s1 = 0j # sum (2n+1) c_n u^n
|
|
248
|
+
s2 = 0j # sum 2n c_n u^n
|
|
249
|
+
for n in range(_ASYMPTOTIC_TERMS):
|
|
250
|
+
s1 += (2 * n + 1) * c * un
|
|
251
|
+
s2 += 2 * n * c * un
|
|
252
|
+
c *= (2 * n + 1) / 2.0
|
|
253
|
+
un *= u
|
|
254
|
+
pref = 1j / _F_SQRT_PI
|
|
255
|
+
return -pref * s1 * u, -pref * s2 / z
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
@njit(cache=True)
|
|
259
|
+
def _faddeeva_parts(gL, gG, S, A, L, dispersion):
|
|
260
|
+
"""_voigt_parts of the exact Voigt of faddeeva.voigt_line, by its steps
|
|
261
|
+
(the value is voigt_line's bit for bit): the absorptive part V and the
|
|
262
|
+
dispersive D, each with its derivatives, rows (value, d/dgL, d/dgG, d/dS)
|
|
263
|
+
over the points of S; D left zero unless *dispersion*. A, L: the
|
|
264
|
+
expansion's coefficients and scale (faddeeva.FADDEEVA_A, FADDEEVA_L).
|
|
265
|
+
|
|
266
|
+
F = V + iD = w(z) / (sigma sqrt(2 pi)) with z = (S + i gL/2) / (sigma sqrt 2)
|
|
267
|
+
and sigma = gG / sqrt(8 ln 2) depends on S + i gL/2 alone, so
|
|
268
|
+
dF/dS = w'(z) / (sigma sqrt 2 sigma sqrt(2 pi)), dF/dgL = (i/2) dF/dS,
|
|
269
|
+
dF/dsigma = -(w + z w') / (sigma^2 sqrt(2 pi)), dF/dgG = dF/dsigma / sqrt(8 ln 2).
|
|
270
|
+
Without a Gaussian (gG <= 0) the Lorentzian (1/pi)/(gL/2 - iS); its
|
|
271
|
+
derivative in gG is 0, the Voigt being even in sigma."""
|
|
272
|
+
n = len(S)
|
|
273
|
+
Ar = np.zeros((4, n))
|
|
274
|
+
Dr = np.zeros((4, n))
|
|
275
|
+
gamma = 0.5 * gL
|
|
276
|
+
if gG <= 0.0:
|
|
277
|
+
for k in range(n):
|
|
278
|
+
den = np.pi * (gamma * gamma + S[k] * S[k]) # the value as voigt_line takes it
|
|
279
|
+
u = gamma - 1j * S[k]
|
|
280
|
+
F_S = 1j / (np.pi * u * u)
|
|
281
|
+
F_L = 0.5j * F_S
|
|
282
|
+
Ar[0, k] = gamma / den
|
|
283
|
+
Ar[1, k] = F_L.real
|
|
284
|
+
Ar[3, k] = F_S.real
|
|
285
|
+
if dispersion:
|
|
286
|
+
Dr[0, k] = S[k] / den
|
|
287
|
+
Dr[1, k] = F_L.imag
|
|
288
|
+
Dr[3, k] = F_S.imag
|
|
289
|
+
return Ar, Dr
|
|
290
|
+
# w at every point, as faddeeva.voigt_line takes it
|
|
291
|
+
na = A.shape[0]
|
|
292
|
+
sigma = gG / _F_S2L2
|
|
293
|
+
s2 = gG / _F_S2L2 * _F_SQRT_2
|
|
294
|
+
norm = 1.0 / (gG / _F_S2L2 * _F_SQRT_2PI)
|
|
295
|
+
zi = gamma / s2
|
|
296
|
+
a = L + zi
|
|
297
|
+
b = L - zi
|
|
298
|
+
wr = np.empty(n)
|
|
299
|
+
wi = np.empty(n)
|
|
300
|
+
ir = np.empty(_F_CHUNK)
|
|
301
|
+
ii = np.empty(_F_CHUNK)
|
|
302
|
+
Zr = np.empty(_F_CHUNK)
|
|
303
|
+
Zi = np.empty(_F_CHUNK)
|
|
304
|
+
pr = np.empty(_F_CHUNK)
|
|
305
|
+
pi_ = np.empty(_F_CHUNK)
|
|
306
|
+
for lo in range(0, n, _F_CHUNK):
|
|
307
|
+
m = min(n, lo + _F_CHUNK) - lo
|
|
308
|
+
for k in range(m):
|
|
309
|
+
zr = S[lo + k] / s2
|
|
310
|
+
q = 1.0 / (a * a + zr * zr)
|
|
311
|
+
ir[k] = a * q
|
|
312
|
+
ii[k] = zr * q
|
|
313
|
+
Zr[k] = b * ir[k] - zr * ii[k]
|
|
314
|
+
Zi[k] = b * ii[k] + zr * ir[k]
|
|
315
|
+
pr[k] = A[0]
|
|
316
|
+
pi_[k] = 0.0
|
|
317
|
+
for t in range(1, na):
|
|
318
|
+
c = A[t]
|
|
319
|
+
for k in range(m):
|
|
320
|
+
r = pr[k] * Zr[k] - pi_[k] * Zi[k] + c
|
|
321
|
+
pi_[k] = pr[k] * Zi[k] + pi_[k] * Zr[k]
|
|
322
|
+
pr[k] = r
|
|
323
|
+
for k in range(m):
|
|
324
|
+
i2r = ir[k] * ir[k] - ii[k] * ii[k]
|
|
325
|
+
i2i = 2.0 * ir[k] * ii[k]
|
|
326
|
+
wr[lo + k] = 2.0 * (pr[k] * i2r - pi_[k] * i2i) + ir[k] / _F_SQRT_PI
|
|
327
|
+
wi[lo + k] = 2.0 * (pr[k] * i2i + pi_[k] * i2r) + ii[k] / _F_SQRT_PI
|
|
328
|
+
# the line and its derivatives
|
|
329
|
+
for k in range(n):
|
|
330
|
+
w = wr[k] + 1j * wi[k]
|
|
331
|
+
wp, zwpw = _w_slopes(S[k] / s2 + 1j * zi, w)
|
|
332
|
+
F_S = wp * (norm / s2)
|
|
333
|
+
F_L = 0.5j * F_S
|
|
334
|
+
F_G = zwpw * (-norm / (sigma * _F_S2L2))
|
|
335
|
+
Ar[0, k] = wr[k] * norm
|
|
336
|
+
Ar[1, k] = F_L.real
|
|
337
|
+
Ar[2, k] = F_G.real
|
|
338
|
+
Ar[3, k] = F_S.real
|
|
339
|
+
if dispersion:
|
|
340
|
+
Dr[0, k] = wi[k] * norm
|
|
341
|
+
Dr[1, k] = F_L.imag
|
|
342
|
+
Dr[2, k] = F_G.imag
|
|
343
|
+
Dr[3, k] = F_S.imag
|
|
344
|
+
return Ar, Dr
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def voigt_parts(gL, gG, S, dispersion, exact):
|
|
348
|
+
"""_voigt_parts (the pseudo-Voigt), or for *exact* (models.exact_voigt())
|
|
349
|
+
_faddeeva_parts (the exact Voigt), with the expansion's coefficients."""
|
|
350
|
+
if exact:
|
|
351
|
+
return _faddeeva_parts(gL, gG, S, faddeeva.FADDEEVA_A, faddeeva.FADDEEVA_L, dispersion)
|
|
352
|
+
return _voigt_parts(gL, gG, S, dispersion)
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def line_value(gL, gG, S, exact):
|
|
356
|
+
"""voigt_value (the pseudo-Voigt) at the points S (1-D), or for *exact*
|
|
357
|
+
the exact Voigt's (faddeeva.voigt)."""
|
|
358
|
+
return faddeeva.voigt(gL, gG, S) if exact else voigt_value(gL, gG, S)
|
|
359
|
+
|
|
360
|
+
|
|
210
361
|
def Voigt_complex(gL, gG, S, C1, C2):
|
|
211
362
|
"""models.Voigt_complex for widths gL, gG (numbers) and positions S (an
|
|
212
363
|
array of any shape) that may be Duals; C1 and C2 are plain numbers. A Dual
|
|
@@ -319,9 +470,14 @@ _COUNT = np.array([3, 5, 6, 6, 6, 0]) # those a shape is differentiated in
|
|
|
319
470
|
|
|
320
471
|
|
|
321
472
|
@njit(cache=True)
|
|
322
|
-
def _shape_voigt(E, par, sign, dispersion):
|
|
323
|
-
"""models.
|
|
324
|
-
|
|
473
|
+
def _shape_voigt(E, par, sign, dispersion, exact, fA, fL):
|
|
474
|
+
"""models.Voigt_r / Voigt_c at E - pos: par = (pos, gL, gG). *exact*: the
|
|
475
|
+
exact Voigt (_faddeeva_parts, the expansion's coefficients fA and scale
|
|
476
|
+
fL), else the pseudo-Voigt (_voigt_parts)."""
|
|
477
|
+
if exact:
|
|
478
|
+
A, D = _faddeeva_parts(par[1], par[2], E - par[0], fA, fL, dispersion)
|
|
479
|
+
else:
|
|
480
|
+
A, D = _voigt_parts(par[1], par[2], E - par[0], dispersion)
|
|
325
481
|
F = np.zeros((1 + PARAMETERS, len(E)), dtype=np.complex128)
|
|
326
482
|
for e in range(len(E)):
|
|
327
483
|
F[0, e] = A[0, e] + 1j * sign * D[0, e]
|
|
@@ -332,14 +488,14 @@ def _shape_voigt(E, par, sign, dispersion):
|
|
|
332
488
|
|
|
333
489
|
|
|
334
490
|
@njit(cache=True)
|
|
335
|
-
def _shape_slope(E, par, sign, dispersion):
|
|
491
|
+
def _shape_slope(E, par, sign, dispersion, exact, fA, fL):
|
|
336
492
|
"""_shape_voigt's derivative in its position, as a shape: par = (pos, gL, gG).
|
|
337
493
|
It is what the FIRST MOMENT of lines that stand at one position multiplies:
|
|
338
494
|
sum_k I_k V(E - pos_k) = (sum_k I_k) V(E - pos) + (sum_k I_k (pos_k - pos)) dV/dpos + ...
|
|
339
495
|
Such a moment is 0 where the lines coincide and only its derivatives count
|
|
340
496
|
(hamiltonian_dual), so this shape has no derivatives of its own: a line of
|
|
341
497
|
it must have the amplitude, or the matrix, 0."""
|
|
342
|
-
F = _shape_voigt(E, par, sign, dispersion)
|
|
498
|
+
F = _shape_voigt(E, par, sign, dispersion, exact, fA, fL)
|
|
343
499
|
for e in range(len(E)):
|
|
344
500
|
F[0, e] = F[1, e]
|
|
345
501
|
F[1, e] = 0.0
|
|
@@ -534,7 +690,7 @@ def _seen(T, dT, rho11, rho22):
|
|
|
534
690
|
|
|
535
691
|
@njit(cache=True)
|
|
536
692
|
def _transmission(E, l_shape, l_par, l_amp, l_group, l_scaled, l_dpar, l_damp,
|
|
537
|
-
g_M, g_dM, g_layer, g_scaled, t_s, t_w, t_ds, t_dw, sign, rho11, rho22):
|
|
693
|
+
g_M, g_dM, g_layer, g_scaled, t_s, t_w, t_ds, t_dw, sign, exact, fA, fL, rho11, rho22):
|
|
538
694
|
"""The detected transmission r (n,) of an absorber at the energies E and
|
|
539
695
|
dr (n, k), its derivatives in k parameters. The absorber is a list of lines,
|
|
540
696
|
each a shape (l_shape, with its parameters l_par) times an amplitude l_amp:
|
|
@@ -553,7 +709,9 @@ def _transmission(E, l_shape, l_par, l_amp, l_group, l_scaled, l_dpar, l_damp,
|
|
|
553
709
|
|
|
554
710
|
The "d" arguments are the derivatives in the k parameters, with one last
|
|
555
711
|
axis; a line is differentiated only in the parameters in which one of its
|
|
556
|
-
own values is not zero.
|
|
712
|
+
own values is not zero. A Voigt line is the exact Voigt where *exact*
|
|
713
|
+
(_faddeeva_parts: fA, fL the expansion's coefficients and scale), else the
|
|
714
|
+
pseudo-Voigt (models.exact_voigt).
|
|
557
715
|
"""
|
|
558
716
|
n, k, G = len(E), l_damp.shape[1], len(g_M)
|
|
559
717
|
act = np.empty(k, dtype=np.int64) # the parameters the line in hand depends on
|
|
@@ -565,11 +723,11 @@ def _transmission(E, l_shape, l_par, l_amp, l_group, l_scaled, l_dpar, l_damp,
|
|
|
565
723
|
g = l_group[l]
|
|
566
724
|
shape = l_shape[l]
|
|
567
725
|
if shape == VOIGT:
|
|
568
|
-
F = _shape_voigt(E, l_par[l], sign, g >= 0 and sign != 0)
|
|
726
|
+
F = _shape_voigt(E, l_par[l], sign, g >= 0 and sign != 0, exact, fA, fL)
|
|
569
727
|
elif shape == BLUME:
|
|
570
728
|
F = _shape_blume(E, l_par[l], sign)
|
|
571
729
|
elif shape == SLOPE:
|
|
572
|
-
F = _shape_slope(E, l_par[l], sign, g >= 0 and sign != 0)
|
|
730
|
+
F = _shape_slope(E, l_par[l], sign, g >= 0 and sign != 0, exact, fA, fL)
|
|
573
731
|
else:
|
|
574
732
|
F = _shape_relax(E, l_par[l], sign, shape - RELAX)
|
|
575
733
|
count = _COUNT[shape]
|
|
@@ -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)
|
|
35
|
-
derivative left at a = b = 0; np.hypot(a, b) is the form that keeps
|
|
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",
|
|
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)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""The Faddeeva function w(z) = exp(-z^2) erfc(-iz), Im z >= 0, by Weideman's
|
|
2
|
+
expansion, and the exact Voigt line built on it -- the line shape of
|
|
3
|
+
models.Voigt_c / Voigt_r under COMPLEX_VOIGT_METHOD = 'faddeeva'.
|
|
4
|
+
|
|
5
|
+
w(z) = 2 p(Z) / (L - iz)^2 + 1 / (sqrt(pi) (L - iz)), Z = (L + iz)/(L - iz),
|
|
6
|
+
|
|
7
|
+
p a polynomial of degree FADDEEVA_TERMS - 1 (J. A. C. Weideman, SIAM J. Numer.
|
|
8
|
+
Anal. 31 (1994) 1497). Its coefficients are a Fourier transform, made once
|
|
9
|
+
(coefficients); a point then costs one complex division and FADDEEVA_TERMS - 1
|
|
10
|
+
complex multiply-adds -- plain arithmetic, which voigt_line runs over chunks of
|
|
11
|
+
points, so the compiler makes vector instructions of it.
|
|
12
|
+
|
|
13
|
+
The Voigt line of Lorentzian FWHM gL and Gaussian FWHM gG, unit area, is
|
|
14
|
+
|
|
15
|
+
V + iD = w(z) / (sigma sqrt(2 pi)), z = (S + i gL/2) / (sigma sqrt 2),
|
|
16
|
+
sigma = gG / sqrt(8 ln 2),
|
|
17
|
+
|
|
18
|
+
V its absorptive part and D the dispersive one (Kramers-Kronig partner of V),
|
|
19
|
+
D > 0 for S > 0; without a Gaussian (gG <= 0) the Lorentzian
|
|
20
|
+
(1/pi) / (gL/2 - iS). Im z = gL/(2 sigma sqrt 2) > 0 for every line with a
|
|
21
|
+
width, the half-plane the expansion is made for.
|
|
22
|
+
|
|
23
|
+
Its dual twin, the line with its derivatives in its parameters, is
|
|
24
|
+
dual_kernels._faddeeva_parts: the same steps, which tests/test_faddeeva.py
|
|
25
|
+
holds to this module. The coefficients reach the compiled code as ARGUMENTS
|
|
26
|
+
(voigt_line's A and L): numba stores a compiled function with the values of
|
|
27
|
+
the globals it read, checking only its own file, so a global of this module
|
|
28
|
+
read by a kernel of another one would keep its old value after a change here.
|
|
29
|
+
"""
|
|
30
|
+
import math
|
|
31
|
+
|
|
32
|
+
import numpy as np
|
|
33
|
+
from numba import njit
|
|
34
|
+
|
|
35
|
+
#: Terms of the expansion. The error against w computed in 50-440 digit decimal
|
|
36
|
+
#: arithmetic (an independent reference, 297 points with Im z from 1e-10 to
|
|
37
|
+
#: 1000 and |Re z| to 1e5), relative to |w|: 3e-4 at 8 terms, 4e-7 at 16, 4e-10
|
|
38
|
+
#: at 24, 3e-13 at 32, 7e-15 at 36, 8.6e-16 at 40 -- and 8-15e-16 for every
|
|
39
|
+
#: count from there to 128: 40 is where it reaches the rounding of the double
|
|
40
|
+
#: arithmetic. (scipy.special.wofz is right to 9e-15 there.)
|
|
41
|
+
FADDEEVA_TERMS = 40
|
|
42
|
+
|
|
43
|
+
_S2L2 = math.sqrt(8.0 * math.log(2.0)) # FWHM / sigma of a Gaussian
|
|
44
|
+
_SQRT_2 = math.sqrt(2.0)
|
|
45
|
+
_SQRT_PI = math.sqrt(math.pi)
|
|
46
|
+
_SQRT_2PI = math.sqrt(2.0 * math.pi)
|
|
47
|
+
|
|
48
|
+
#: Points of a chunk of voigt_line: the arrays of one chunk stay in the
|
|
49
|
+
#: first-level cache
|
|
50
|
+
CHUNK = 64
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def coefficients(n):
|
|
54
|
+
"""The coefficients of the expansion with *n* terms, the highest power
|
|
55
|
+
first, and its scale L: a discrete Fourier transform of
|
|
56
|
+
(L^2 + t^2) exp(-t^2) at t = L tan(theta/2), no table."""
|
|
57
|
+
L = np.sqrt(n / np.sqrt(2.0))
|
|
58
|
+
k = np.arange(-2 * n + 1, 2 * n)
|
|
59
|
+
t = L * np.tan(k * np.pi / (4 * n))
|
|
60
|
+
f = np.concatenate(([0.0], np.exp(-t ** 2) * (L ** 2 + t ** 2)))
|
|
61
|
+
a = np.real(np.fft.fft(np.fft.fftshift(f))) / (4 * n)
|
|
62
|
+
return a[n:0:-1].copy(), float(L)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
FADDEEVA_A, FADDEEVA_L = coefficients(FADDEEVA_TERMS)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def faddeeva(z):
|
|
69
|
+
"""w(z) for Im z >= 0, any shape: the expansion in numpy, by Horner's
|
|
70
|
+
rule (voigt_line's arithmetic, one array operation at a time)."""
|
|
71
|
+
z = np.asarray(z, dtype=complex)
|
|
72
|
+
lz = FADDEEVA_L - 1j * z
|
|
73
|
+
Z = (FADDEEVA_L + 1j * z) / lz
|
|
74
|
+
p = np.full(Z.shape, FADDEEVA_A[0], dtype=complex)
|
|
75
|
+
for coefficient in FADDEEVA_A[1:]:
|
|
76
|
+
p = p * Z + coefficient
|
|
77
|
+
return 2.0 * p / lz ** 2 + (1.0 / _SQRT_PI) / lz
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@njit(cache=True)
|
|
81
|
+
def voigt_line(gL, gG, S, A, L, out):
|
|
82
|
+
"""The exact Voigt line of Lorentzian FWHM gL and Gaussian FWHM gG (unit
|
|
83
|
+
area) at the points S (1-D): out[k, 0] = V(S[k]) and, when out has a
|
|
84
|
+
second column, out[k, 1] = D(S[k]), its dispersion. A, L: the expansion's
|
|
85
|
+
coefficients and scale (FADDEEVA_A, FADDEEVA_L). gG <= 0: the Lorentzian.
|
|
86
|
+
|
|
87
|
+
The divisions are products with the reciprocal of |.|^2, and the steps of
|
|
88
|
+
the polynomial run over a chunk of points as real arrays: a loop without
|
|
89
|
+
calls, which the compiler turns into vector instructions."""
|
|
90
|
+
n = S.shape[0]
|
|
91
|
+
with_d = out.shape[1] > 1
|
|
92
|
+
gamma = 0.5 * gL
|
|
93
|
+
if gG <= 0.0:
|
|
94
|
+
# (1/pi) / (gamma - iS)
|
|
95
|
+
for k in range(n):
|
|
96
|
+
den = math.pi * (gamma * gamma + S[k] * S[k])
|
|
97
|
+
out[k, 0] = gamma / den
|
|
98
|
+
if with_d:
|
|
99
|
+
out[k, 1] = S[k] / den
|
|
100
|
+
return
|
|
101
|
+
na = A.shape[0]
|
|
102
|
+
s2 = gG / _S2L2 * _SQRT_2 # sigma sqrt 2
|
|
103
|
+
norm = 1.0 / (gG / _S2L2 * _SQRT_2PI) # 1 / (sigma sqrt(2 pi))
|
|
104
|
+
zi = gamma / s2 # Im z
|
|
105
|
+
a = L + zi # L - iz = a - i Re z
|
|
106
|
+
b = L - zi # L + iz = b + i Re z
|
|
107
|
+
ir = np.empty(CHUNK) # 1/(L - iz)
|
|
108
|
+
ii = np.empty(CHUNK)
|
|
109
|
+
Zr = np.empty(CHUNK) # Z = (L + iz)/(L - iz)
|
|
110
|
+
Zi = np.empty(CHUNK)
|
|
111
|
+
pr = np.empty(CHUNK) # the polynomial in Z
|
|
112
|
+
pi_ = np.empty(CHUNK)
|
|
113
|
+
for lo in range(0, n, CHUNK):
|
|
114
|
+
m = min(n, lo + CHUNK) - lo
|
|
115
|
+
for k in range(m):
|
|
116
|
+
zr = S[lo + k] / s2
|
|
117
|
+
q = 1.0 / (a * a + zr * zr)
|
|
118
|
+
ir[k] = a * q
|
|
119
|
+
ii[k] = zr * q
|
|
120
|
+
Zr[k] = b * ir[k] - zr * ii[k]
|
|
121
|
+
Zi[k] = b * ii[k] + zr * ir[k]
|
|
122
|
+
pr[k] = A[0]
|
|
123
|
+
pi_[k] = 0.0
|
|
124
|
+
for t in range(1, na):
|
|
125
|
+
c = A[t]
|
|
126
|
+
for k in range(m):
|
|
127
|
+
r = pr[k] * Zr[k] - pi_[k] * Zi[k] + c
|
|
128
|
+
pi_[k] = pr[k] * Zi[k] + pi_[k] * Zr[k]
|
|
129
|
+
pr[k] = r
|
|
130
|
+
# w = 2 p / (L - iz)^2 + (1/sqrt(pi)) / (L - iz)
|
|
131
|
+
if with_d:
|
|
132
|
+
for k in range(m):
|
|
133
|
+
i2r = ir[k] * ir[k] - ii[k] * ii[k]
|
|
134
|
+
i2i = 2.0 * ir[k] * ii[k]
|
|
135
|
+
out[lo + k, 0] = (2.0 * (pr[k] * i2r - pi_[k] * i2i) + ir[k] / _SQRT_PI) * norm
|
|
136
|
+
out[lo + k, 1] = (2.0 * (pr[k] * i2i + pi_[k] * i2r) + ii[k] / _SQRT_PI) * norm
|
|
137
|
+
else:
|
|
138
|
+
for k in range(m):
|
|
139
|
+
i2r = ir[k] * ir[k] - ii[k] * ii[k]
|
|
140
|
+
i2i = 2.0 * ir[k] * ii[k]
|
|
141
|
+
out[lo + k, 0] = (2.0 * (pr[k] * i2r - pi_[k] * i2i) + ir[k] / _SQRT_PI) * norm
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def voigt(gL, gG, S):
|
|
145
|
+
"""V, the absorptive part of the exact Voigt line, at S (any shape)."""
|
|
146
|
+
S = np.asarray(S, dtype=np.float64)
|
|
147
|
+
out = np.empty(S.shape, dtype=np.float64)
|
|
148
|
+
voigt_line(float(gL), float(gG), np.ascontiguousarray(S.reshape(-1)), FADDEEVA_A, FADDEEVA_L,
|
|
149
|
+
out.reshape(-1, 1))
|
|
150
|
+
return out
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def voigt_complex(gL, gG, S):
|
|
154
|
+
"""V + iD, the exact Voigt line with its dispersion, at S (any shape)."""
|
|
155
|
+
S = np.asarray(S, dtype=np.float64)
|
|
156
|
+
out = np.empty(S.shape, dtype=np.complex128)
|
|
157
|
+
voigt_line(float(gL), float(gG), np.ascontiguousarray(S.reshape(-1)), FADDEEVA_A, FADDEEVA_L,
|
|
158
|
+
out.reshape(-1).view(np.float64).reshape(-1, 2))
|
|
159
|
+
return out
|
|
@@ -17,7 +17,7 @@ from syncmoss.syncmoss_main import PhysicsApp, new_pool
|
|
|
17
17
|
from syncmoss.supp_menu import apply_saved_settings
|
|
18
18
|
from syncmoss.compile_functions import compile_functions
|
|
19
19
|
from syncmoss.compile_window import compile_if_needed, current_stamp
|
|
20
|
-
__VERSION__ = "0.8.
|
|
20
|
+
__VERSION__ = "0.8.3"
|
|
21
21
|
|
|
22
22
|
# What --test leaves in the cache folder for --test-again: the seconds of its
|
|
23
23
|
# plain fit before anything was compiled
|
|
@@ -559,10 +559,15 @@ def fitted_model_rows(model_rows, parameters, recon_weights=(), keep_independent
|
|
|
559
559
|
def _write_model_file(main_window, file_path, model_rows, comment=None, metadata=None, exclusion=()):
|
|
560
560
|
"""Write *model_rows* (see :func:`model_file_rows`) as the .mdl *file_path*;
|
|
561
561
|
*exclusion*, a fit result's exclusion regions (:func:`_write_model_lines`).
|
|
562
|
+
Its folder is created when it does not exist yet (the save path of several
|
|
563
|
+
spectra is a new ``result`` folder).
|
|
562
564
|
|
|
563
565
|
Returns True when the file was written, False when that failed.
|
|
564
566
|
"""
|
|
565
567
|
try:
|
|
568
|
+
folder = os.path.dirname(file_path)
|
|
569
|
+
if folder:
|
|
570
|
+
os.makedirs(folder, exist_ok=True)
|
|
566
571
|
with open(file_path, 'w', encoding='utf-8') as f:
|
|
567
572
|
if isinstance(metadata, dict):
|
|
568
573
|
metadata_to_write = dict(LIBRARY_METADATA_DEFAULTS)
|