Skip to content

Comparison Tool for Single Initial Nuclide Response#135

Draft
eitan-weinstein wants to merge 26 commits intosvalinn:mainfrom
eitan-weinstein:comp_tool
Draft

Comparison Tool for Single Initial Nuclide Response#135
eitan-weinstein wants to merge 26 commits intosvalinn:mainfrom
eitan-weinstein:comp_tool

Conversation

@eitan-weinstein
Copy link
Copy Markdown
Contributor

Closes #84 .

I've included a Jupyter notebook and an accompanying Python module for the comparison of ALARA output data from an ALARA run based on the input scripts and data from examples/singleElement.ala. This Jupyter notebook allows for the comparison between the standard fendl2 data in fendl2bin, as well as ALARAJOY-processed data from fendl3. I converted the data from both output files to CSV files, following the meshless table extraction method in #114.

I'm still working on expanding and building all of my comparison tools, so I'm only uploading this as a draft for now, but I wanted to put up my work that I have thus far ahead of tomorrow's fusion-activation meeting.

The major first impression from the plots that I am seeing is that ALARAJOY is not allowing for proper tritium tracking, as we know both from fendl2 and FISPACT that tritium is highly significant on the century timescale for specific activity and decay heat in particular, but the ALARAJOY-processed fendl3 data is not showing any tritium.

748053bc-3475-4aa1-861d-0924eac1aa71

More analysis and plots to come, but I wanted to get this up so that we can start discussing initial results and next steps in debugging ALARAJOY's tritium issue.

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.

A bunch of comments on all the code to read certain CSV files, perhaps superseded by the suggestion to simply use the parse_tables function from the script in #113

Comment thread tools/single_nuc.py Outdated
Comment on lines +38 to +42
variables = [
'Number_Density', 'Specific_Activity',
'Total_Decay_Heat', 'Contact_Dose'
]
units = ['atoms_kg', 'Bq_kg', 'W_kg', 'Sv_hr_._data_ANS6_4_3']
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.

These should probably be bound together in some kind of dictionary. However, you might want to note that ALARA is flexible and allows different units for these same quantities. We may need to handle this differently....

Comment thread tools/single_nuc.py Outdated
val for i, val in enumerate(x, start=1)
if val in y or i in (y if isinstance(y, list) else [y])
]
indices = [i for i, val in enumerate(x) if val in sublist]
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.

Comment thread tools/single_nuc.py Outdated
Comment on lines +23 to +26
sublist = [
val for i, val in enumerate(x, start=1)
if val in y or i in (y if isinstance(y, list) else [y])
]
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.

What if you convert them both to sets and use set operations?

sublist =  list(set(x).intersection(set(y)))

Comment thread tools/single_nuc.py Outdated
units = ['atoms_kg', 'Bq_kg', 'W_kg', 'Sv_hr_._data_ANS6_4_3']

if inp_datalibs:
datalibs, _ = select_sublist(datalibs, inp_datalibs)
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.

You might not need the select_sublist() method if these are replaced by a single line if using set intersection (see above)

Comment thread tools/single_nuc.py Outdated
if inp_units:
units, _ = select_sublist(units, inp_units)
else:
units = [units[idx] for idx in var_indices]
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.

Definitely don't want to rely on two lists being indexed the same way - better to make them into a dictionary.

Comment thread tools/single_nuc.py Outdated
inp_variables=[],
inp_units=[]):

datalibs = ['fendl2', 'fendl3']
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.

I'm not sure I'd make these fixed in the code - you could just let users pick any set of names on the command line

Comment thread tools/single_nuc.py Outdated
return sublist, indices

def process_metadata(
gen_csv='',
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.

Instead of reading CSV files, why not import your script from #113 and call parse_tables() to get the data straight into dataframes?

@eitan-weinstein eitan-weinstein marked this pull request as ready for review October 30, 2025 15:06
@eitan-weinstein
Copy link
Copy Markdown
Contributor Author

I've just added a few functions to single_nuc.py to be able to write ALARA input files and run ALARA internally, in a similar style to how I do so for NJOY in ALARAJOYWrapper/njoy_tools.py. Now to go through the Jupyter Notebook, all the user needs to input is the single element to run the simple irradiation simulation on (following the format from examples) and then click through the cells to produce the desired tables/plots.

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.

These tools seemed to be aimed at the QA of the library processing, so I wonder if they should live in a subdirectory of ALARAJOYWrapper?

Also, I'd love to review this in pieces. You appear to have a progression of capabilities here:

  1. setup and run a new simulation
  2. load the results of one or more simulations into a data structure
  3. a variety of independent post-processing and plotting steps - each of which can be added/reviewed separately

Could you break this PR up into some of these steps, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a tool to compare the results of a single response for a single initial nuclide

3 participants