Extracting KZAs directly from ENDF files, independently from filename#281
Conversation
gonuke
left a comment
There was a problem hiding this comment.
I think this looks pretty good with just a few suggestions.
| kza = str(kza) | ||
| A = kza[-4:-1] | ||
| Z = kza[:kza.find(A)].zfill(2) | ||
| element = list(elements.keys())[int(Z) - 1] | ||
| M = int(kza[-1]) |
There was a problem hiding this comment.
Why not convert to strings after doing integer math?
| kza = str(kza) | |
| A = kza[-4:-1] | |
| Z = kza[:kza.find(A)].zfill(2) | |
| element = list(elements.keys())[int(Z) - 1] | |
| M = int(kza[-1]) | |
| M = kza % 10 | |
| ZA = kza // 10 | |
| A = kza % 1000 | |
| Z = kza // 1000 | |
| element = list(elements.keys())[Z - 1] |
There was a problem hiding this comment.
Related - could we just use the integer value of Z everywhere that we currently use element?
There was a problem hiding this comment.
Good point on the integer math. Much more intuitive. Certainly, we could use Z everywhere instead of element, although, I think I like using element, especially for printouts and warnings because it is easier for the user to see something like "Fe-56" rather than "26-56" as an identifier and then having to map the Z to the chemical symbol themselves.
gonuke
left a comment
There was a problem hiding this comment.
LGTM - thanks @eitan-weinstein
This PR follows conversations from #271 and #279 to identify nuclides directly from the data contained within their ENDF files, rather than relying on them being named correctly. As it stood, relying on files to be named correctly was a rather fragile system, so this PR should provide a more stable basis by which to establish nuclide identity in the form of KZA, and then subsequently extract all other identifying characteristics (chemical symbol, mass number, isomeric state) from the KZA itself.