Mercurial > repos > muon-spectroscopy-computational-project > larch_athena
annotate common.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 | a0d3b0fe0fa3 |
children | 351f2cce19d1 |
rev | line source |
---|---|
6
30cdfd70f28d
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
muon-spectroscopy-computational-project
parents:
4
diff
changeset
|
1 import re |
0
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
2 from typing import Iterable |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
3 |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
4 from larch.io import extract_athenagroup, read_athena |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
5 from larch.io.athena_project import AthenaGroup |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
6 from larch.symboltable import Group |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
7 from larch.xafs import autobk, pre_edge, xftf |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
8 |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
9 |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
10 def get_group(athena_group: AthenaGroup, key: str = None) -> Group: |
4
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
11 group_keys = list(athena_group.keys()) |
0
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
12 if key is None: |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
13 key = group_keys[0] |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
14 else: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
15 key = key.replace("-", "_") |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
16 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
17 try: |
4
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
18 return extract_athenagroup(athena_group.groups[key]) |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
19 except KeyError as e: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
20 raise KeyError(f"{key} not in {group_keys}") from e |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
21 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
22 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
23 def read_all_groups(dat_file: str, key: str = None) -> "dict[str, Group]": |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
24 # Cannot rely on do_ABC as _larch is None |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
25 athena_group = read_athena( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
26 dat_file, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
27 do_preedge=False, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
28 do_bkg=False, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
29 do_fft=False, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
30 ) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
31 all_groups = {} |
4
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
32 for key in athena_group.keys(): |
2
a1e26990131c
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 0f66842e802430e887d1c6cb7be1cc5436408fd2
muon-spectroscopy-computational-project
parents:
1
diff
changeset
|
33 print(f"\nExtracting group {key}") |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
34 group = get_group(athena_group, key) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
35 pre_edge_with_defaults(group=group) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
36 xftf_with_defaults(group=group) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
37 all_groups[key] = group |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
38 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
39 return all_groups |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
40 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
41 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
42 def read_group(dat_file: str, key: str = None): |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
43 # Cannot rely on do_ABC as _larch is None |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
44 athena_group = read_athena( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
45 dat_file, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
46 do_preedge=False, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
47 do_bkg=False, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
48 do_fft=False, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
49 ) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
50 group = get_group(athena_group, key) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
51 pre_edge_with_defaults(group=group) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
52 xftf_with_defaults(group=group) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
53 return group |
0
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
54 |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
55 |
4
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
56 def pre_edge_with_defaults( |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
57 group: Group, settings: dict = None, ref_channel: str = None |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
58 ): |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
59 merged_settings = {} |
4
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
60 if ref_channel is not None: |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
61 print(f"Performing pre-edge with reference channel {ref_channel}") |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
62 ref = getattr(group, ref_channel.lower()) |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
63 group.e0 = None |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
64 pre_edge(energy=group.energy, mu=ref, group=group) |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
65 bkg_parameters = group.pre_edge_details |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
66 else: |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
67 try: |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
68 bkg_parameters = group.athena_params.bkg |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
69 except AttributeError as e: |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
70 print(f"Cannot load group.athena_params.bkg from group:\n{e}") |
a0d3b0fe0fa3
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 3fe6078868efd0fcea0fb5eea8dcd4b152d9c0a8
muon-spectroscopy-computational-project
parents:
3
diff
changeset
|
71 bkg_parameters = None |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
72 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
73 keys = ( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
74 ("e0", "e0", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
75 ("pre1", "pre1", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
76 ("pre2", "pre2", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
77 ("norm1", "nor1", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
78 ("norm2", "nor2", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
79 ("nnorm", "nnorm", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
80 ("make_flat", "flatten", None), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
81 ("step", "step", None), |
2
a1e26990131c
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 0f66842e802430e887d1c6cb7be1cc5436408fd2
muon-spectroscopy-computational-project
parents:
1
diff
changeset
|
82 ("nvict", "nvict", None), |
0
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
83 ) |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
84 for key, parameters_key, default in keys: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
85 extract_attribute( |
3
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
86 merged_settings=merged_settings, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
87 key=key, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
88 parameters_group=bkg_parameters, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
89 parameters_key=parameters_key, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
90 default=default, |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
91 ) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
92 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
93 if settings: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
94 for k, v in settings.items(): |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
95 if k == "nvict": |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
96 print( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
97 "WARNING: `nvict` can be used for pre-edge but is not " |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
98 "saved to file, so value used will not be accessible in " |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
99 "future operations using this Athena .prj" |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
100 ) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
101 merged_settings[k] = v |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
102 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
103 print(f"Pre-edge normalization with {merged_settings}") |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
104 try: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
105 pre_edge(group, **merged_settings) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
106 except Warning as e: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
107 raise Warning( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
108 "Unable to perform pre-edge fitting with:\n\n" |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
109 f"energy:\n{group.energy}\n\nmu:{group.mu}\n\n" |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
110 "Consider checking the correct columns have been extracted" |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
111 ) from e |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
112 autobk(group, pre_edge_kws=merged_settings) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
113 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
114 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
115 def xftf_with_defaults(group: Group, settings: dict = None): |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
116 merged_settings = {} |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
117 try: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
118 fft_parameters = group.athena_params.fft |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
119 except AttributeError as e: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
120 print(f"Cannot load group.athena_params.fft from group:\n{e}") |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
121 fft_parameters = None |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
122 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
123 keys = ( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
124 ("kmin", "kmin", 0), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
125 ("kmax", "kmax", 20), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
126 ("dk", "dk", 1), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
127 ("kweight", "kw", 2), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
128 ("kweight", "kweight", 2), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
129 ("window", "kwindow", "kaiser"), |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
130 ) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
131 for key, parameters_key, default in keys: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
132 extract_attribute( |
3
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
133 merged_settings=merged_settings, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
134 key=key, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
135 parameters_group=fft_parameters, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
136 parameters_key=parameters_key, |
82e9dd980916
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit d4c7e090dc5c94395d7e1574845ac2c76f2e4f5f
muon-spectroscopy-computational-project
parents:
2
diff
changeset
|
137 default=default, |
1
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
138 ) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
139 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
140 if settings: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
141 for k, v in settings.items(): |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
142 merged_settings[k] = v |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
143 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
144 print(f"XFTF with {merged_settings}") |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
145 xftf(group, **merged_settings) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
146 xftf_details = Group() |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
147 setattr(xftf_details, "call_args", merged_settings) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
148 group.xftf_details = xftf_details |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
149 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
150 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
151 def extract_attribute( |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
152 merged_settings: dict, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
153 key: str, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
154 parameters_group: Group, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
155 parameters_key: str, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
156 default: "str|int" = None, |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
157 ): |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
158 if parameters_group is not None: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
159 try: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
160 merged_settings[key] = getattr(parameters_group, parameters_key) |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
161 return |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
162 except AttributeError: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
163 pass |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
164 |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
165 if default is not None: |
2b3115342fef
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
muon-spectroscopy-computational-project
parents:
0
diff
changeset
|
166 merged_settings[key] = default |
0
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
167 |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
168 |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
169 def read_groups(dat_files: "list[str]", key: str = None) -> Iterable[Group]: |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
170 for dat_file in dat_files: |
ae2f265ecf8e
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 5be486890442dedfb327289d597e1c8110240735
muon-spectroscopy-computational-project
parents:
diff
changeset
|
171 yield read_group(dat_file=dat_file, key=key) |
6
30cdfd70f28d
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
muon-spectroscopy-computational-project
parents:
4
diff
changeset
|
172 |
30cdfd70f28d
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
muon-spectroscopy-computational-project
parents:
4
diff
changeset
|
173 |
30cdfd70f28d
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
muon-spectroscopy-computational-project
parents:
4
diff
changeset
|
174 def sorting_key(filename: str) -> str: |
30cdfd70f28d
planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_athena commit 71cee2ed96b69a2e78a1eb3dadbd2e81bf332798
muon-spectroscopy-computational-project
parents:
4
diff
changeset
|
175 return re.findall(r"\d+", filename)[-1] |