diff --git a/openmc/material.py b/openmc/material.py index 1e0ff56610..a1281fef16 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -6,8 +6,6 @@ from xml.etree import ElementTree as ET from six import string_types import numpy as np -import scipy.constants as sc -from matplotlib import pyplot as plt import openmc import openmc.data @@ -732,7 +730,8 @@ class Material(object): def plot_xs(self, library, types, divisor_types=None, temperature=294., Erange=(1.E-5, 20.E6)): - """Creates a figure of macroscopic cross sections for this material + """Creates a figure of continuous-energy macroscopic cross sections + for this material Parameters ---------- @@ -759,6 +758,8 @@ class Material(object): """ + from matplotlib import pyplot as plt + E, data = self.calculate_xs(library, types, temperature) if divisor_types: @@ -805,7 +806,8 @@ class Material(object): return fig def calculate_xs(self, library, types, temperature=294.): - """Calculates macroscopic cross sections of a requested type + """Calculates continuous-energy macroscopic cross sections of a + requested type Parameters ---------- @@ -829,6 +831,8 @@ class Material(object): """ + import scipy.constants as sc + # Check types cv.check_type('library', library, openmc.data.DataLibrary) cv.check_iterable_type('types', types, str)