Skip to content

Commit ae4c378

Browse files
authored
Merge pull request #34 from openmc-data-storage/develop
Development improvements
2 parents 965a0d6 + 448f4af commit ae4c378

File tree

6 files changed

+340
-302
lines changed

6 files changed

+340
-302
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ openmc_data_downloader -l ENDFB-7.1-NNDC -i Be9 -d my_h5_files
101101
```bash
102102
openmc_data_downloader -l TENDL-2019 -e Li Si Na -i Fe56 U235
103103
```
104+
### Downloading all the isotopes from the TENDL 2019 nuclear library
105+
106+
```bash
107+
openmc_data_downloader -l TENDL-2019 -i all
108+
```
109+
### Downloading all the stable isotopes from the TENDL 2019 nuclear library
110+
111+
```bash
112+
openmc_data_downloader -l TENDL-2019 -i stable
113+
```
104114

105115
### Downloading all the isotopes in a materials.xml file from the TENDL 2019 nuclear library
106116

openmc_data_downloader/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
LIB_OPTIONS,
1919
PARTICLE_OPTIONS,
2020
SAB_OPTIONS,
21-
ISOTOPE_OPTIONS,
21+
STABLE_ISOTOPE_OPTIONS,
22+
ALL_ISOTOPE_OPTIONS,
2223
xs_info,
2324
sab_info,
2425
)

openmc_data_downloader/cross_sections_directory.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@
128128
"Tc": [], # no stable isotopes
129129
}
130130

131+
132+
def zaid_to_isotope(zaid: str) -> str:
133+
"""converts an isotope into a zaid e.g. 003006 -> Li6"""
134+
a = str(zaid)[-3:]
135+
z = str(zaid)[:-3]
136+
symbol = ATOMIC_SYMBOL[int(z)]
137+
return symbol + str(int(a))
138+
139+
131140
tendl_2019_neutron_isotopes = [
132141
"Ac225",
133142
"Ac226",
@@ -2200,14 +2209,6 @@
22002209
}
22012210

22022211

2203-
def zaid_to_isotope(zaid: str) -> str:
2204-
"""converts an isotope into a zaid e.g. 003006 -> Li6"""
2205-
a = str(zaid)[-3:]
2206-
z = str(zaid)[:-3]
2207-
symbol = ATOMIC_SYMBOL[int(z)]
2208-
return symbol + str(int(a))
2209-
2210-
22112212
endf_71_wmp_base_url = (
22122213
"https://github.com/openmc-data-storage/ENDF-B-VII.1-WMP/raw/master/WMP_Library/"
22132214
)
@@ -2290,4 +2291,9 @@ def zaid_to_isotope(zaid: str) -> str:
22902291
"c_Zr_in_ZrH",
22912292
]
22922293
nested_list = list(NATURAL_ABUNDANCE.values())
2293-
ISOTOPE_OPTIONS = [item for sublist in nested_list for item in sublist]
2294+
STABLE_ISOTOPE_OPTIONS = [item for sublist in nested_list for item in sublist]
2295+
ALL_ISOTOPE_OPTIONS = (
2296+
tendl_2019_neutron_isotopes
2297+
+ fendl_31d_neutron_isotopes
2298+
+ endfb_71_nndc_neutron_isotopes
2299+
)

openmc_data_downloader/openmc_data_downloader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if __name__ == '__main__':
3131
'-i', '--isotopes',
3232
nargs='*',
3333
default=[],
34-
help="The isotope or isotopes to download"
34+
help="The isotope or isotopes to download, name of isotope e.g. 'Al27' or keyword 'all' or 'stable'"
3535
)
3636
parser.add_argument(
3737
'-s',
@@ -44,7 +44,7 @@ if __name__ == '__main__':
4444
parser.add_argument(
4545
'-e', '--elements', nargs='*',
4646
default=[],
47-
help="The element or elements to download"
47+
help="The element or elements to download, name of element e.g. 'Al' or keyword 'all' or 'stable'"
4848
)
4949
parser.add_argument(
5050
'-p', '--particles', nargs='*',

openmc_data_downloader/utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from retry import retry
1111

1212
from openmc_data_downloader import (
13-
ISOTOPE_OPTIONS,
13+
ALL_ISOTOPE_OPTIONS,
14+
STABLE_ISOTOPE_OPTIONS,
1415
LIB_OPTIONS,
1516
NATURAL_ABUNDANCE,
1617
PARTICLE_OPTIONS,
@@ -383,7 +384,9 @@ def identify_isotopes_to_download(
383384
if isotopes == []:
384385
return pd.DataFrame()
385386
elif isotopes == "all" or isotopes == ["all"]:
386-
isotopes = ISOTOPE_OPTIONS
387+
isotopes = ALL_ISOTOPE_OPTIONS
388+
elif isotopes == "stable" or isotopes == ["stable"]:
389+
isotopes = STABLE_ISOTOPE_OPTIONS
387390

388391
print("isotopes", isotopes)
389392

@@ -454,8 +457,11 @@ def identify_isotopes_to_download(
454457

455458
def expand_elements_to_isotopes(elements: Union[str, List[str]]):
456459

460+
if elements == "stable" or elements == ["stable"]:
461+
return STABLE_ISOTOPE_OPTIONS
462+
457463
if elements == "all" or elements == ["all"]:
458-
return ISOTOPE_OPTIONS
464+
return ALL_ISOTOPE_OPTIONS
459465

460466
if isinstance(elements, str):
461467
return NATURAL_ABUNDANCE[elements]

0 commit comments

Comments
 (0)