Skip to content

Extracting KZAs directly from ENDF files, independently from filename#281

Merged
gonuke merged 5 commits into
svalinn:mainfrom
eitan-weinstein:extracting_nuc_data_directly
May 29, 2026
Merged

Extracting KZAs directly from ENDF files, independently from filename#281
gonuke merged 5 commits into
svalinn:mainfrom
eitan-weinstein:extracting_nuc_data_directly

Conversation

@eitan-weinstein
Copy link
Copy Markdown
Contributor

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.

@eitan-weinstein eitan-weinstein changed the title Extracting KZAs directly from ENDF files -- independent of filename Extracting KZAs directly from ENDF files, independently from filename May 28, 2026
Copy link
Copy Markdown
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks pretty good with just a few suggestions.

Comment on lines +92 to +96
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])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not convert to strings after doing integer math?

Suggested change
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]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related - could we just use the integer value of Z everywhere that we currently use element?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tools/ALARAJOYWrapper/tendl_processing.py
Comment thread tools/ALARAJOYWrapper/tendl_processing.py
Copy link
Copy Markdown
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @eitan-weinstein

@gonuke gonuke merged commit 8c2219e into svalinn:main May 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants