# HG changeset patch
# User muon-spectroscopy-computational-project
# Date 1725364305 0
# Node ID 0339eb694129741d101ebbc379edba4403dcc3e1
# Parent 3584db5902b553d1ca37dffa683e3ea680746e33
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_plot commit 7f52c8654581d23a2acffc818e0c197cf8e04504
diff -r 3584db5902b5 -r 0339eb694129 common.py
--- a/common.py Fri Aug 23 14:10:50 2024 +0000
+++ b/common.py Tue Sep 03 11:51:45 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 3584db5902b5 -r 0339eb694129 larch_plot.xml
--- a/larch_plot.xml Fri Aug 23 14:10:50 2024 +0000
+++ b/larch_plot.xml Tue Sep 03 11:51:45 2024 +0000
@@ -4,7 +4,7 @@
0.9.80
- 0
+ 1
10.1088/1742-6596/430/1/012007