Repository navigation
Including ratio plotting functionality to xs_plotting - #307
Conversation
| 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 |
There was a problem hiding this comment.
Separation of concerns: can't we just have a method that only does this and we can avoid encoding "(reference)" into the string?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
So, I think we can delete this entry in the comments now, right?
| `groupwise_dict`. | ||
| """ | ||
|
|
||
| def _re_bin_xs(bin_edges, xs, midpoints): |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
|
|
||
| for dsv in dsv_list: | ||
| with open(dsv, 'r') as f: | ||
| dsv_lines = f.readlines() |
There was a problem hiding this comment.
Not critical, but something to think about: this could be written in a way that reads one line at a time...
There was a problem hiding this comment.
Sure, I may as well change that over. Shouldn't be too big of a task, saves some memory.
| `groupwise_dict`. | ||
| """ | ||
|
|
||
| reference_group = next(iter(groupwise_dict)) |
There was a problem hiding this comment.
Why not make this an input to the method, requiring the user to name their reference, rather than inferring it?
The user could infer it in the same way from outside the method before calling this method, if they like.
|
Putting on pause until after #333 so that metadata parsed from DSV header can be used for series/plot identification. |
2436369 to
a7dd904
Compare
|
This was on hold for #333 that is now merged - maybe a rebase (if necessary) and I can review... |
7d6befb to
2cc853a
Compare
gonuke
left a comment
There was a problem hiding this comment.
A few comments about reading the DSV and then I'll review again.
| break | ||
|
|
||
| # Process metadata from first line | ||
| if i == 0: |
There was a problem hiding this comment.
Do this before the for loop instead of testing each time through the loop
| } | ||
| break | ||
| # Reaction data parsing, search for matching (KZA, MT) pair | ||
| else: |
There was a problem hiding this comment.
as discussed, look at switching to a CSV reader after processing the first line
gonuke
left a comment
There was a problem hiding this comment.
LGTM - thanks @eitan-weinstein
Functionally follows #314 and #317, 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 toxs_plotting.pyto 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 functioncompute_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 usingnp.divide().This functionality will be useful in diagnosing more precisely the effects of choice of group structure has on any given activation cross-sections.