Skip to content

Including ratio plotting functionality to xs_plotting - #307

Open
eitan-weinstein wants to merge 3 commits into
svalinn:mainfrom
eitan-weinstein:xs_relative_plots
Open

Including ratio plotting functionality to xs_plotting#307
eitan-weinstein wants to merge 3 commits into
svalinn:mainfrom
eitan-weinstein:xs_relative_plots

Conversation

@eitan-weinstein

@eitan-weinstein eitan-weinstein commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Functionally follows #314, but only in DSV output formatting, not any direct code dependency.

Similar to the ratio plotting capabilities in alara_output_processing.alara_output_plotting.py, this PR introduces new functionality to xs_plotting.py to allow for the production of plots showing the ratios of groupwise cross-sections across different group structures. Given the inherent differences in energy group bounds/number of groups between different group structures, this PR includes a function compute_groupwise_xs_ratios() that constructs a union grid of the energies between both group structures and pulls the appropriate cross-sections at those energies from the existing groupwise values. Unlike the interpolation approach in #305, this is merely pulling existing cross-section values that fall within re-adjusted energy bins so that like-sized and matching-index arrays between two group structures of different sizes can be appropriately compared. These are then divided using np.divide().

This functionality will be useful in diagnosing more precisely the effects of choice of group structure has on any given activation cross-sections.

cross-sections were processed.
emitted (str): Particle(s) emitted from the nuclear reaction
corresponding to the MT number provided.
reference_group (str): Group name of the reference group against which

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.

Separation of concerns: can't we just have a method that only does this and we can avoid encoding "(reference)" into the string?

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.

We could even simplify this further by not including any explicit reference tag, but rather just relying on ordering in the DSV section of the YAML. in compute_groupwise_xs_ratios(), the default option for the case when no reference is explicitly provided is to just take the first key in groupwise_dict with the command:

reference_group = reference_group or next(iter(groupwise_dict))

If we just specify in the documentation that the way to set the reference group is by placing its DSV path first amongst the DSVs in the YAML, then this can be accomplished much simpler and with cleaner inputs.

Comment on lines +226 to +227
if ratio_plotting:
nuc_dir /= 'ratio_plots'

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.

If you do this, you can make the path creation below simpler

Suggested change
if ratio_plotting:
nuc_dir /= 'ratio_plots'
ratio_suffix = ""
if ratio_plotting:
nuc_dir /= 'ratio_plots'
ratio_suffix = "_ratios"

`groupwise_dict`.
"""

def _re_bin_xs(bin_edges, xs, midpoints):

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.

We should discuss this approach. I wonder if you can put some diagrams together with all of the different cases you expect to see. Rebinning group x-sections is a fraught topic...

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.

Given our discussion last week and my introduction of the proposed changes in #314 that would allow us to compare directly against FISPACT-II's nuclear data, I'm going to abandon the re-binning approach. Instead, I'm going to necessitate that all ratio-plotted comparisons must have the same group bounds/nGroups so that cross-section division is unambiguously non-problematic.

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