From caab2c1c2dd627231a29bfd9c04ca6f6dd294bae Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Wed, 30 Nov 2016 19:55:59 -0500 Subject: [PATCH] Replaced some numerical constants with named constants --- openmc/plotter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openmc/plotter.py b/openmc/plotter.py index 76f8c93f4..ac11e4073 100644 --- a/openmc/plotter.py +++ b/openmc/plotter.py @@ -58,6 +58,10 @@ PLOT_TYPES_OP = {'total': (np.add,), PLOT_TYPES_LINEAR = {'nu-fission / fission', 'nu-scatter / scatter', 'nu-fission / absorption', 'fission / absorption'} +# Minimum and maximum energies for plotting (units of eV) +_MIN_E = 1.E-5 +_MAX_E = 20.E6 + def plot_xs(this, types, divisor_types=None, temperature=294., axis=None, sab_name=None, ce_cross_sections=None, mg_cross_sections=None, @@ -199,7 +203,7 @@ def plot_xs(this, types, divisor_types=None, temperature=294., axis=None, ax.set_xlabel('Energy [eV]') if plot_CE: - ax.set_xlim(1.E-5, 20.E6) + ax.set_xlim(_MIN_E, _MAX_E) else: ax.set_xlim(E[-1], E[0]) if divisor_types: @@ -672,7 +676,7 @@ def calculate_mgxs(this, types, orders=None, temperature=294., # Ensure the energy will show on a log-axis by replacing 0s with a # sufficiently small number if energy_grid[0] <= 0.: - energy_grid[0] = 1.E-5 + energy_grid[0] = _MIN_E for line in range(len(types)): i = 0