# HG changeset patch # User muon-spectroscopy-computational-project # Date 1718632479 0 # Node ID 30cdfd70f28d1d29caf8016f4707aff73bff1047 # Parent 27015eaf9a78dd0d97c9e6f1cb0541d46c4f1b47 planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798 diff -r 27015eaf9a78 -r 30cdfd70f28d common.py --- a/common.py Mon May 20 15:34:58 2024 +0000 +++ b/common.py Mon Jun 17 13:54:39 2024 +0000 @@ -1,3 +1,4 @@ +import re from typing import Iterable from larch.io import extract_athenagroup, read_athena @@ -168,3 +169,7 @@ def read_groups(dat_files: "list[str]", key: str = None) -> Iterable[Group]: for dat_file in dat_files: yield read_group(dat_file=dat_file, key=key) + + +def sorting_key(filename: str) -> str: + return re.findall(r"\d+", filename)[-1] diff -r 27015eaf9a78 -r 30cdfd70f28d larch_athena.py --- a/larch_athena.py Mon May 20 15:34:58 2024 +0000 +++ b/larch_athena.py Mon Jun 17 13:54:39 2024 +0000 @@ -1,13 +1,13 @@ import gc import json import os -import re import sys from common import ( pre_edge_with_defaults, read_all_groups, read_group, + sorting_key, xftf_with_defaults, ) @@ -142,15 +142,16 @@ return xafs_group def load_zipped_files(self) -> "dict[str, Group]": - def sorting_key(filename: str) -> str: - return re.findall(r"\d+", filename)[-1] - all_paths = list(os.walk("dat_files")) all_paths.sort(key=lambda x: x[0]) file_total = sum([len(f) for _, _, f in all_paths]) print(f"{file_total} files found") keyed_data = {} for dirpath, _, filenames in all_paths: + if dirpath.endswith("__MACOSX"): + print(f"Skipping {dirpath}") + continue + try: filenames.sort(key=sorting_key) except IndexError as e: diff -r 27015eaf9a78 -r 30cdfd70f28d larch_athena.xml --- a/larch_athena.xml Mon May 20 15:34:58 2024 +0000 +++ b/larch_athena.xml Mon Jun 17 13:54:39 2024 +0000 @@ -4,7 +4,7 @@ 0.9.75 - 1 + 2 10.1088/1742-6596/430/1/012007 @@ -457,6 +457,14 @@ + + + + + + + +