Skip to content

More small updates to alaraplot#248

Open
eitan-weinstein wants to merge 11 commits intosvalinn:mainfrom
eitan-weinstein:alaraplot_updates
Open

More small updates to alaraplot#248
eitan-weinstein wants to merge 11 commits intosvalinn:mainfrom
eitan-weinstein:alaraplot_updates

Conversation

@eitan-weinstein
Copy link
Contributor

@eitan-weinstein eitan-weinstein commented Feb 25, 2026

This PR includes a couple more small changes to tools/alara_output_processing/alara_output_plotting.py to improve versatility:

  1. Allowing plotting of the ratios of runs against each other, by creating a new optional parameter control_run, wherein the user can select one of the runs contained in the ADF against which to divide to calculate a time-series of ratios.
  2. Allowing for the legend to be created as a separate matplotlib.legend.Legend object, which can be helpful for plotting with legends with many series.
  3. Allowing plotting of vertical lines at the half-life times for each nuclide plotted (can be useful because it seems that it is at the first half life where ALARA and FISPACT-II decay behaviors diverge).

Copy link
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.

Looks pretty good... just few little cleanup items - thanks for the quick turnaround

cmap_name='Dark2',
plot_type='plot',
separate_legend=False,
control_run=''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
control_run=''
control_run=None

)
data_list.append((run_lbl, filtered, piv, style))

if run_lbl == control_run and ratio_plotting:
Copy link
Member

Choose a reason for hiding this comment

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

These seems redundant... the first condition can only match if 'control_runis not empty which is the same condition used to determineratio_plotting`

if separate_legend argument is False.
'''

ratio_plotting = True if control_run else False
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ratio_plotting = True if control_run else False
ratio_plotting = (control_run is not None)

Copy link
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.

Just a couple of places to unwind some of the clever use of the comprehension

prev_isotope = isotope

ax.legend(
target_ax = legend_ax if legend_ax else ax
Copy link
Member

Choose a reason for hiding this comment

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

It might be clearer to combine all the conditionals in one block here:

Suggested change
target_ax = legend_ax if legend_ax else ax
if legend_ax:
target_ax = legend_ax
loc = 'center'
bbox_to_anchor = None
else:
target_ax = ax
loc = 'center left'
bbox_to_anchor = (1.025, 0.5)

And then use these variables below

Comment on lines 669 to 673
ax.set_ylabel(
f'Proportion of Total {variable}' if relative
else f'{variable} [{filtered['var_unit'].unique()[0]}]'
f'Ratio of {variable} against {control_run}' if ratio_plotting
else (f'Proportion of Total {variable}' if relative
else f'{variable} [{filtered['var_unit'].unique()[0]}]')
)
Copy link
Member

Choose a reason for hiding this comment

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

Might be clearer in simple if block to set a variable ylabel and then use that...

Or ax.set_ylabel in each of the if block sections

Copy link
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.

Deleting left over commented line

prev_isotope = isotope

ax.legend(
#target_ax = legend_ax if legend_ax else ax
Copy link
Member

Choose a reason for hiding this comment

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

Can we delete this line now?

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.

2 participants