# HG changeset patch
# User muon-spectroscopy-computational-project
# Date 1709552599 0
# Node ID a1e26990131cd4742d87f66ac99507dbe6df5e95
# Parent 2b3115342fefa3380809dfb6eaae2510894b7b76
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 0f66842e802430e887d1c6cb7be1cc5436408fd2
diff -r 2b3115342fef -r a1e26990131c common.py
--- a/common.py Wed Dec 06 13:03:55 2023 +0000
+++ b/common.py Mon Mar 04 11:43:19 2024 +0000
@@ -29,6 +29,7 @@
)
all_groups = {}
for key in athena_group._athena_groups.keys():
+ print(f"\nExtracting group {key}")
group = get_group(athena_group, key)
pre_edge_with_defaults(group=group)
xftf_with_defaults(group=group)
@@ -68,8 +69,7 @@
("nnorm", "nnorm", None),
("make_flat", "flatten", None),
("step", "step", None),
- # This cannot be read from file as it is not stored by Larch (0.9.71)
- # ("nvict", "nvict", None),
+ ("nvict", "nvict", None),
)
for key, parameters_key, default in keys:
extract_attribute(
diff -r 2b3115342fef -r a1e26990131c larch_athena.py
--- a/larch_athena.py Wed Dec 06 13:03:55 2023 +0000
+++ b/larch_athena.py Mon Mar 04 11:43:19 2024 +0000
@@ -63,16 +63,18 @@
else:
all_groups = []
for filepath in dat_files.split(","):
- group = self.load_single_file(filepath)["out"]
- all_groups.append(group)
+ for group in self.load_single_file(filepath).values():
+ all_groups.append(group)
- return merge_groups(all_groups, xarray="energy", yarray="mu")
+ merged_group = merge_groups(all_groups, xarray="energy", yarray="mu")
+ pre_edge_with_defaults(merged_group)
+ return merged_group
def load_single_file(
self,
filepath: str,
is_zipped: bool = False,
- ) -> "tuple[dict, bool]":
+ ) -> dict:
if is_zipped:
return self.load_zipped_files()
@@ -85,6 +87,7 @@
groups = {}
for repeat in self.extract_group["multiple"]:
name = repeat["group_name"]
+ print(f"\nExtracting group {name}")
groups[name] = read_group(filepath, name)
return groups
else:
@@ -141,8 +144,6 @@
all_paths.sort(key=lambda x: x[0])
file_total = sum([len(f) for _, _, f in all_paths])
print(f"{file_total} files found")
- key_length = len(str(file_total))
- i = 0
keyed_data = {}
for dirpath, _, filenames in all_paths:
try:
@@ -155,11 +156,13 @@
filenames.sort()
for filename in filenames:
- key = str(i).zfill(key_length)
+ if len(all_paths) > 1:
+ key = f"{dirpath}_{filename}"
+ else:
+ key = filename
filepath = os.path.join(dirpath, filename)
xas_data = self.load_single_file(filepath)
keyed_data[key] = xas_data["out"]
- i += 1
return keyed_data
diff -r 2b3115342fef -r a1e26990131c larch_athena.xml
--- a/larch_athena.xml Wed Dec 06 13:03:55 2023 +0000
+++ b/larch_athena.xml Mon Mar 04 11:43:19 2024 +0000
@@ -2,9 +2,9 @@
generate Athena projects from XAFS data
- 0.9.71
+ 0.9.74
- 1
+ 0
10.1088/1742-6596/430/1/012007
@@ -120,7 +120,7 @@
-
+
@@ -151,6 +151,10 @@
+
+
+
+
@@ -187,46 +191,46 @@
not zip_outputs
- not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
+ not (merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")))
plot_graph
not zip_outputs
- not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
+ not (merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")))
plot_graph
not zip_outputs
- not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
+ not (merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")))
plot_graph
not zip_outputs
- not (merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
+ not (merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")))
not zip_outputs
- merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")
+ merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
plot_graph
not zip_outputs
- merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")
+ merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
plot_graph
not zip_outputs
- merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")
+ merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
plot_graph
not zip_outputs
- merge_inputs["merge_inputs"] == "" and (merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single")
+ merge_inputs["merge_inputs"] == "" and ((merge_inputs["format"]["format"] == "plaintext" and merge_inputs["format"]["is_zipped"]["is_zipped"]) or (merge_inputs["format"]["format"] == "athena" and merge_inputs["format"]["extract_group"]["extract_group"] != "single"))
@@ -235,7 +239,7 @@
@@ -387,7 +391,34 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -397,22 +428,34 @@
-
+
-
+
-
+
+
+
+
+
+
+
+
+