mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-21 14:35:27 -04:00
Fixing plot xs for when plotting element string reaction (#3029)
This commit is contained in:
parent
2a53aba1c1
commit
e6c5f56ee2
2 changed files with 10 additions and 5 deletions
|
|
@ -59,10 +59,15 @@ def _get_legend_label(this, type):
|
|||
"""Gets a label for the element or nuclide or material and reaction plotted"""
|
||||
if isinstance(this, str):
|
||||
if type in openmc.data.DADZ:
|
||||
z, a, m = openmc.data.zam(this)
|
||||
da, dz = openmc.data.DADZ[type]
|
||||
gnds_name = openmc.data.gnds_name(z + dz, a + da, m)
|
||||
return f'{this} {type} {gnds_name}'
|
||||
if this in ELEMENT_NAMES:
|
||||
return f'{this} {type}'
|
||||
else: # this is a nuclide so the legend can contain more information
|
||||
z, a, m = openmc.data.zam(this)
|
||||
da, dz = openmc.data.DADZ[type]
|
||||
gnds_name = openmc.data.gnds_name(z + dz, a + da, m)
|
||||
# makes a string with nuclide reaction and new nuclide
|
||||
# For example "Be9 (n,2n) Be8"
|
||||
return f'{this} {type} {gnds_name}'
|
||||
return f'{this} {type}'
|
||||
elif this.name == '':
|
||||
return f'Material {this.id} {type}'
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ def test_calculate_cexs_with_materials(test_mat):
|
|||
@pytest.mark.parametrize("this", ["Be", "Be9"])
|
||||
def test_plot_xs(this):
|
||||
from matplotlib.figure import Figure
|
||||
assert isinstance(openmc.plot_xs({this: ['total', 'elastic']}), Figure)
|
||||
assert isinstance(openmc.plot_xs({this: ['total', 'elastic', 16, '(n,2n)']}), Figure)
|
||||
|
||||
|
||||
def test_plot_xs_mat(test_mat):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue