Mercurial > repos > muon-spectroscopy-computational-project > larch_artemis
changeset 4:39ab361e6d59 draft
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_artemis commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
author | muon-spectroscopy-computational-project |
---|---|
date | Mon, 17 Jun 2024 13:54:30 +0000 |
parents | 2ceaa943a2ad |
children | 7acb53ffb96f |
files | common.py larch_artemis.py larch_artemis.xml test-data/numeric_sort.zip test-data/numeric_sort_criteria_report.csv |
diffstat | 5 files changed, 32 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/common.py Thu Apr 11 09:01:48 2024 +0000 +++ b/common.py Mon Jun 17 13:54:30 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_artemis.py Thu Apr 11 09:01:48 2024 +0000 +++ b/larch_artemis.py Mon Jun 17 13:54:30 2024 +0000 @@ -5,7 +5,7 @@ import os import sys -from common import read_group +from common import read_group, sorting_key from larch.fitting import guess, param, param_group from larch.symboltable import Group @@ -351,7 +351,7 @@ filepaths = [ os.path.join(prj_file, p) for p in os.listdir(prj_file) ] - filepaths.sort() + filepaths.sort(key=sorting_key) else: # DO NOT sort if we have multiple Galaxy datasets - the filenames # are arbitrary but should be in order
--- a/larch_artemis.xml Thu Apr 11 09:01:48 2024 +0000 +++ b/larch_artemis.xml Mon Jun 17 13:54:30 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@">0</token> + <token name="@WRAPPER_VERSION@">1</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> @@ -315,6 +315,26 @@ </assert_contents> </output> </test> + <!-- 7: Zipped numerical sort --> + <test expect_num_outputs="2"> + <param name="execution" value="zipped"/> + <param name="prj_file" value="numeric_sort.zip"/> + <param name="variable" value="rfactor"/> + <param name="action" value="log"/> + <param name="feff_paths" value="[FEFF_paths_of_test.inp].zip"/> + <param name="gds_file" value="gds.csv"/> + <param name="sp_file" value="sp.csv"/> + <param name="fitspace" value="r"/> + <param name="kmin" value="3"/> + <param name="kmax" value="14"/> + <param name="kweight" value="2"/> + <param name="dk" value="1"/> + <param name="window" value="hanning"/> + <param name="rmin" value="1.4"/> + <param name="rmax" value="3.0"/> + <output_collection name="fit_report_collection" type="list" count="3"/> + <output name="criteria_report" file="numeric_sort_criteria_report.csv" compare="re_match"/> + </test> </tests> <help><![CDATA[ Using Larch, perform fitting on an Athena project file, originally from the input X-ray Absorption Fine Structure (XAFS) data file.