Skip to content

Commit db6a746

Browse files
authored
Merge pull request #41 from fispact/add_nuc_helper_props
Add nuc helper props
2 parents 7e76fb4 + 320e232 commit db6a746

File tree

3 files changed

+248
-188
lines changed

3 files changed

+248
-188
lines changed

Diff for: docs/index.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ nuclides at the first timestep.
5757
import pypact as pp
5858

5959
# the standard output file from FISPACT-II
60+
# test files exist in 'references' directory
6061
filename = 'myfispactrun.out'
6162

6263
with pp.Reader(filename) as output:
6364
nuclides = output[0].nuclides
6465
for nuc in nuclides:
65-
print(f"{nuc.element}{nuc.isotope}{nuc.state} = {nuc.atoms:.3e} atoms")
66+
print(f"{nuc.name} = {nuc.atoms:.3e} atoms")

Diff for: pypact/output/nuclide.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pypact.util.decorators import freeze_it
22
from pypact.util.numerical import is_float, get_float
33
from pypact.util.jsonserializable import JSONSerializable
4+
from pypact.library.nuclidelib import get_zai
45

56
NUCLIDE_IGNORES = ['\n', '|', '>', '&', '?', '#']
67

@@ -26,6 +27,14 @@ def __init__(self):
2627
self.ingestion = 0.0
2728
self.inhalation = 0.0
2829

30+
@property
31+
def name(self):
32+
return f"{self.element}{self.isotope}{self.state}"
33+
34+
@property
35+
def zai(self):
36+
return get_zai(self.name)
37+
2938
def fispact_deserialize(self, linedump, column_headers):
3039

3140
self.__init__()

0 commit comments

Comments
 (0)