Mercurial > repos > muon-spectroscopy-computational-project > larch_athena
changeset 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 | 351f2cce19d1 |
files | common.py larch_athena.py larch_athena.xml test-data/macosx.zip |
diffstat | 4 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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]
--- 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:
--- 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 @@ <!-- version of underlying tool (PEP 440) --> <token name="@TOOL_VERSION@">0.9.75</token> <!-- version of this tool wrapper (integer) --> - <token name="@WRAPPER_VERSION@">1</token> + <token name="@WRAPPER_VERSION@">2</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> @@ -457,6 +457,14 @@ <output_collection name="athena_project_file_collection" type="list" count="2"/> <output_collection name="plot_collection" type="list" count="2"/> </test> + <!-- 19: MACOSX zip --> + <test expect_num_outputs="2"> + <param name="is_zipped" value="true"/> + <param name="dat_file" value="macosx.zip"/> + <param name="plot_graph" value="edge,flat,dmude"/> + <output_collection name="athena_project_file_collection" type="list" count="10"/> + <output_collection name="plot_collection" type="list" count="10"/> + </test> </tests> <help><![CDATA[ Using Larch, create an Athena project file from the input X-ray Absorption Fine Structure (XAFS) data file.