From 975fb850d653d4536f65fe6db416468e411d4806 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 19 Oct 2020 13:33:02 +0100 Subject: [PATCH] rename varible as suggested in review Co-authored-by: Paul Romano --- openmc/data/reaction.py | 3 ++- openmc/deplete/helpers.py | 5 ++--- openmc/plotter.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openmc/data/reaction.py b/openmc/data/reaction.py index 6da151e040..276218df06 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -64,7 +64,8 @@ REACTION_NAME.update({i: '(n,3He{})'.format(i - 750) for i in range(750, 799)}) REACTION_NAME.update({i: '(n,a{})'.format(i - 800) for i in range(800, 849)}) REACTION_NAME.update({i: '(n,2n{})'.format(i - 875) for i in range(875, 891)}) -REACTION_NUMBER = dict(zip(REACTION_NAME.values(), REACTION_NAME.keys())) +REACTION_MT = {name: mt for mt, name in REACTION_NAME.items()} +REACTION_MT['fission'] = 18 FISSION_MTS = (18, 19, 20, 21, 38) diff --git a/openmc/deplete/helpers.py b/openmc/deplete/helpers.py index 4ffcdb245a..0f55bb910e 100644 --- a/openmc/deplete/helpers.py +++ b/openmc/deplete/helpers.py @@ -11,7 +11,7 @@ from numpy import dot, zeros, newaxis, asarray from . import comm from openmc.checkvalue import check_type, check_greater_than -from openmc.data import JOULE_PER_EV, REACTION_NUMBER +from openmc.data import JOULE_PER_EV, REACTION_MT from openmc.lib import ( Tally, MaterialFilter, EnergyFilter, EnergyFunctionFilter) import openmc.lib @@ -169,8 +169,7 @@ class FluxCollapseHelper(ReactionRateHelper): self._materials = materials # adds an entry for fisson to the dictionary of reactions - REACTION_NUMBER['fission'] = 18 - self._mts = [REACTION_NUMBER[x] for x in scores] + self._mts = [REACTION_MT[x] for x in scores] self._scores = scores # Create flux tally with material and energy filters diff --git a/openmc/plotter.py b/openmc/plotter.py index ae4b87add3..c6f069aa62 100644 --- a/openmc/plotter.py +++ b/openmc/plotter.py @@ -309,7 +309,7 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None, Nuclide object to source data from types : Iterable of str or Integral The type of cross sections to calculate; values can either be those - in openmc.PLOT_TYPES or keys from openmc.data.REACTION_NUMBER which + in openmc.PLOT_TYPES or keys from openmc.data.REACTION_MT which correspond to a reaction description e.g '(n,2n)' or integers which correspond to reaction channel (MT) numbers. temperature : float, optional @@ -405,8 +405,8 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None, ops.append((np.add,) * (len(tmp_mts) - 2) + (np.multiply,)) else: ops.append((np.add,) * (len(tmp_mts) - 1)) - elif line in openmc.data.REACTION_NUMBER.keys(): - mt_number = openmc.data.REACTION_NUMBER[line] + elif line in openmc.data.REACTION_MT: + mt_number = openmc.data.REACTION_MT[line] cv.check_type('MT in types', mt_number, Integral) cv.check_greater_than('MT in types', mt_number, 0) tmp_mts = nuc.get_reaction_components(mt_number)