diff larch_athena.py @ 6:30cdfd70f28d draft

planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
author muon-spectroscopy-computational-project
date Mon, 17 Jun 2024 13:54:39 +0000
parents 27015eaf9a78
children
line wrap: on
line diff
--- 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: