# HG changeset patch # User muon-spectroscopy-computational-project # Date 1725364287 0 # Node ID e0407f36fcea972701855b1135ca5fe8a43c1dea # Parent d17c5d62802f23912afc6c911e9be1198a844568 planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_artemis commit 7f52c8654581d23a2acffc818e0c197cf8e04504 diff -r d17c5d62802f -r e0407f36fcea common.py --- a/common.py Fri Aug 23 16:44:13 2024 +0000 +++ b/common.py Tue Sep 03 11:51:27 2024 +0000 @@ -75,22 +75,22 @@ bkg_parameters = None keys = ( - ("e0", "e0", None), - ("pre1", "pre1", None), - ("pre2", "pre2", None), - ("norm1", "nor1", None), - ("norm2", "nor2", None), - ("nnorm", "nnorm", None), - ("make_flat", "flatten", None), - ("step", "step", None), - ("nvict", "nvict", None), + ("e0", ("e0"), None), + ("pre1", ("pre1"), None), + ("pre2", ("pre2"), None), + ("norm1", ("nor1"), None), + ("norm2", ("nor2"), None), + ("nnorm", ("nnorm"), None), + ("make_flat", ("flatten"), None), + ("step", ("step"), None), + ("nvict", ("nvict"), None), ) - for key, parameters_key, default in keys: + for key, parameter_keys, default in keys: extract_attribute( merged_settings=merged_settings, key=key, parameters_group=bkg_parameters, - parameters_key=parameters_key, + parameter_keys=parameter_keys, default=default, ) @@ -125,19 +125,18 @@ fft_parameters = None keys = ( - ("kmin", "kmin", 0), - ("kmax", "kmax", 20), - ("dk", "dk", 1), - ("kweight", "kw", 2), - ("kweight", "kweight", 2), - ("window", "kwindow", "kaiser"), + ("kmin", ("kmin",), 0), + ("kmax", ("kmax",), 20), + ("dk", ("dk",), 1), + ("kweight", ("kw", "kweight"), 2), + ("window", ("kwindow",), "kaiser"), ) - for key, parameters_key, default in keys: + for key, parameter_keys, default in keys: extract_attribute( merged_settings=merged_settings, key=key, parameters_group=fft_parameters, - parameters_key=parameters_key, + parameter_keys=parameter_keys, default=default, ) @@ -156,15 +155,26 @@ merged_settings: dict, key: str, parameters_group: Group, - parameters_key: str, + parameter_keys: "tuple[str]", default: "str|int" = None, ): if parameters_group is not None: - try: - merged_settings[key] = getattr(parameters_group, parameters_key) + values = [] + for parameter_key in parameter_keys: + try: + values.append(getattr(parameters_group, parameter_key)) + except AttributeError: + pass + + if len(values) > 1: + print( + f"WARNING: values {values} for for keys {parameter_keys}, " + "using first entry" + ) + + if len(values) > 0: + merged_settings[key] = values[0] return - except AttributeError: - pass if default is not None: merged_settings[key] = default diff -r d17c5d62802f -r e0407f36fcea larch_artemis.xml --- a/larch_artemis.xml Fri Aug 23 16:44:13 2024 +0000 +++ b/larch_artemis.xml Tue Sep 03 11:51:27 2024 +0000 @@ -4,7 +4,7 @@ 0.9.80 - 1 + 2 10.1088/1742-6596/430/1/012007 diff -r d17c5d62802f -r e0407f36fcea test-data/fit_report.txt --- a/test-data/fit_report.txt Fri Aug 23 16:44:13 2024 +0000 +++ b/test-data/fit_report.txt Tue Sep 03 11:51:27 2024 +0000 @@ -1,6 +1,6 @@ =================== FEFFIT RESULTS ==================== \[\[Statistics\]\] - n_function_calls = 4\d\d + n_function_calls = \d{3} n_variables = 6 n_data_points = 104 n_independent = 12\.2045080 @@ -37,14 +37,14 @@ \[\[Dataset\]\] - unique_id = 'dm7xe57x' + unique_id = '\w{8}' fit space = 'r' r-range = 1\.400, 3\.000 k-range = 3\.000, 14\.000 k window, dk = 'hanning', 1\.000 paths used in fit = \['feff/feff0001\.dat', 'feff/feff0002\.dat', 'feff/feff0003\.dat', 'feff/feff0004\.dat'\] k-weight = 2 - epsilon_k = Array\(mean=5\.1913e-4, std=4\.5676e-4\) + epsilon_k = Array\(mean=5\.\d{4}e-4, std=4\.5\d{3}e-4\) epsilon_r = [\d\.]{9} n_independent = 12\.205 diff -r d17c5d62802f -r e0407f36fcea test-data/fit_report_simultaneous.txt --- a/test-data/fit_report_simultaneous.txt Fri Aug 23 16:44:13 2024 +0000 +++ b/test-data/fit_report_simultaneous.txt Tue Sep 03 11:51:27 2024 +0000 @@ -1,6 +1,6 @@ =================== FEFFIT RESULTS ==================== \[\[Statistics\]\] - n_function_calls = 4\d\d + n_function_calls = \d{3} n_variables = 6 n_data_points = 208 n_independent = 24\.4090160 @@ -37,14 +37,14 @@ \[\[Dataset 1 of 2\]\] - unique_id = 'dm7xe57x' + unique_id = '\w{8}' fit space = 'r' r-range = 1\.400, 3\.000 k-range = 3\.000, 14\.000 k window, dk = 'hanning', 1\.000 paths used in fit = \['feff/feff0001\.dat', 'feff/feff0002\.dat', 'feff/feff0003\.dat', 'feff/feff0004\.dat'\] k-weight = 2 - epsilon_k = Array\(mean=5\.1913e-4, std=4\.5676e-4\) + epsilon_k = Array\(mean=5\.\d{4}e-4, std=4\.5\d{3}e-4\) epsilon_r = [\d\.]{9} n_independent = 12\.205 @@ -109,7 +109,7 @@ k window, dk = 'hanning', 1\.000 paths used in fit = \['feff/feff0001\.dat', 'feff/feff0002\.dat', 'feff/feff0003\.dat', 'feff/feff0004\.dat'\] k-weight = 2 - epsilon_k = Array\(mean=5\.1913e-4, std=4\.5676e-4\) + epsilon_k = Array\(mean=5\.\d{4}e-4, std=4\.5\d{3}e-4\) epsilon_r = [\d\.]{9} n_independent = 12\.205