Skip to content

Commit 24a003f

Browse files
committed
Add kurucz test
1 parent ad7f382 commit 24a003f

File tree

13 files changed

+101
-17
lines changed

13 files changed

+101
-17
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
runs-on: ubuntu-24.04
7575
env:
7676
UV_FROZEN: 1
77+
ARTISATOMIC_TESTMODE: 1
7778
steps:
7879
- name: Checkout Code
7980
uses: actions/checkout@v4
@@ -108,11 +109,12 @@ jobs:
108109
tests:
109110
strategy:
110111
matrix:
111-
testname: [cmfgen, floers25, jplt, qub]
112+
testname: [cmfgen, floers25, jplt, kurucz, qub]
112113
fail-fast: false
113114
runs-on: ubuntu-24.04
114115
env:
115116
UV_FROZEN: 1
117+
ARTISATOMIC_TESTMODE: 1
116118
timeout-minutes: 45
117119
name: test ${{ matrix.testname }}
118120

artisatomic/readkuruczdata.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from collections import defaultdict
23
from collections import namedtuple
34
from pathlib import Path
@@ -7,21 +8,28 @@
78
hc_in_ev_cm = 0.0001239841984332003
89

910
kuruczdatapath = Path(__file__).parent.absolute() / ".." / "atomic-data-kurucz"
11+
if os.environ.get("ARTISATOMIC_TESTMODE") == "1":
12+
kuruczdatapath = kuruczdatapath / "test_sample"
1013

1114

1215
def find_gfall(atomic_number: int, ion_charge: int) -> Path:
13-
path_gfall = (kuruczdatapath / "extendedatoms" / f"gf{atomic_number:02d}{ion_charge:02d}.lines").resolve()
14-
15-
if not path_gfall.is_file():
16-
path_gfall = (kuruczdatapath / "extendedatoms" / f"gf{atomic_number:02d}{ion_charge:02d}z.lines").resolve()
17-
18-
if not path_gfall.is_file():
19-
path_gfall = (kuruczdatapath / "zztar" / f"gf{atomic_number:02d}{ion_charge:02d}.all").resolve()
20-
21-
if not path_gfall.is_file():
22-
raise FileNotFoundError(f"No Kurucz file for Z={atomic_number} ion_charge {ion_charge}")
23-
24-
return path_gfall
16+
extended_atoms_filenames = [
17+
f"gf{atomic_number:02d}{ion_charge:02d}.lines.zst",
18+
f"gf{atomic_number:02d}{ion_charge:02d}.lines",
19+
f"gf{atomic_number:02d}{ion_charge:02d}z.lines.zst",
20+
f"gf{atomic_number:02d}{ion_charge:02d}z.lines",
21+
]
22+
for filename in extended_atoms_filenames:
23+
path_gfall = (kuruczdatapath / "extendedatoms" / filename).resolve()
24+
if path_gfall.is_file():
25+
return path_gfall
26+
zztar_filenames = [f"gf{atomic_number:02d}{ion_charge:02d}.all", f"gf{atomic_number:02d}{ion_charge:02d}.all.zst"]
27+
for filename in zztar_filenames:
28+
path_gfall = (kuruczdatapath / "zztar" / filename).resolve()
29+
if path_gfall.is_file():
30+
return path_gfall
31+
32+
raise FileNotFoundError(f"No Kurucz file for Z={atomic_number} ion_charge {ion_charge}.")
2533

2634

2735
def get_levelname(row) -> str:

atomic-data-kurucz/.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
gfall*
2-
*.lines
3-
*.all
4-
creationdates.dat
1+
extendedatoms/*.lines
2+
zztar/*.all
73.7 KB
Binary file not shown.
1.11 KB
Binary file not shown.
1.65 KB
Binary file not shown.
4.38 KB
Binary file not shown.
2.36 KB
Binary file not shown.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dynamic = ["version"]
2727
readme = { file = "README.md", content-type = 'text/markdown' }
2828
dependencies = [
2929
"argcomplete>=3.5.1",
30+
"carsus",
3031
"chiantipy>=0.15.1",
3132
"h5py>=3.10.0",
3233
"numpy>=2.2.6",
@@ -201,3 +202,6 @@ local_scheme = "no-local-version"
201202

202203
[tool.ty.rules]
203204
unused-ignore-comment = "ignore"
205+
206+
[tool.uv.sources]
207+
carsus = { git = "https://github.com/tardis-sn/carsus.git" }

0 commit comments

Comments
 (0)