Mercurial > repos > muon-spectroscopy-computational-project > larch_lcf
changeset 5:90a69f15ab92 draft default tip
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_lcf commit 7f52c8654581d23a2acffc818e0c197cf8e04504
author | muon-spectroscopy-computational-project |
---|---|
date | Tue, 03 Sep 2024 11:51:40 +0000 |
parents | c2d5bfef5b63 |
children | |
files | common.py larch_lcf.xml |
diffstat | 2 files changed, 39 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/common.py Fri Aug 23 14:10:44 2024 +0000 +++ b/common.py Tue Sep 03 11:51:40 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
--- a/larch_lcf.xml Fri Aug 23 14:10:44 2024 +0000 +++ b/larch_lcf.xml Tue Sep 03 11:51:40 2024 +0000 @@ -4,7 +4,7 @@ <!-- version of underlying tool (PEP 440) --> <token name="@TOOL_VERSION@">0.9.80</token> <!-- version of this tool wrapper (integer) --> - <token name="@WRAPPER_VERSION@">0</token> + <token name="@WRAPPER_VERSION@">1</token> <!-- citation should be updated with every underlying tool version --> <!-- typical fields to update are version, month, year, and doi --> <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token> @@ -82,11 +82,11 @@ <param name="x_limit_max" value="29230"/> <output name="plot"> <assert_contents> - <has_size value="59500" delta="100"/> + <has_size value="61000" delta="1000"/> </assert_contents> </output> <assert_stdout> - <has_text text="Goodness of fit (rfactor): 0.532130%"/> + <has_text text="Goodness of fit (rfactor): 0.658596%"/> </assert_stdout> </test> <!-- 2: series --> @@ -101,7 +101,7 @@ <param name="x_limit_max" value="29230"/> <output_collection name="plot_collection" type="list" count="1"/> <assert_stdout> - <has_text text="Goodness of fit (rfactor): 0.532130%"/> + <has_text text="Goodness of fit (rfactor): 0.658596%"/> </assert_stdout> </test> <!-- 3: zipped --> @@ -116,7 +116,7 @@ <param name="x_limit_max" value="29230"/> <output_collection name="plot_collection" type="list" count="2"/> <assert_stdout> - <has_text text="Goodness of fit (rfactor): 0.532130%"/> + <has_text text="Goodness of fit (rfactor): 0.658596%"/> </assert_stdout> </test> </tests>