Skip to content

Commit

Permalink
API Provide XSData.energies; prefer over metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
drewejohnson committed May 4, 2020
1 parent b837758 commit fd1b21f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions serpentTools/objects/xsdata.py
Expand Up @@ -39,8 +39,11 @@ class XSData(NamedObject):
Array of xs data. Rows correspond to items in :attr:`MT`
hasNuData : bool
True if nu data is present
energies : numpy.ndarray
Energy grid [MeV]
metadata : dict
File-wide metadata from the reader.
File-wide metadata from the reader. Alias for accessing
:attr:`energies`. Will be removed in the future
"""

Expand Down Expand Up @@ -72,6 +75,7 @@ def __init__(self, name, metadata, isIso=False):
self.isIso = isIso

# metadata reference
self.energies = metadata["egrid"]
self.metadata = metadata

# Possible reactions on this material / nuclide
Expand Down Expand Up @@ -353,10 +357,9 @@ def plot(self, mts='all', ax=None, loglog=False, xlabel=None, ylabel=None,
ax = ax or pyplot.gca()

kwargs.setdefault("drawstyle", "steps")
x = self.metadata['egrid']
for mt, label in zip(mts, labels):
y = self[mt]
ax.plot(x, y, label=label, **kwargs)
ax.plot(self.energies, y, label=label, **kwargs)

title = title or '{} cross section{}'.format(
self.name, 's' if len(mts) > 1 else '')
Expand Down

0 comments on commit fd1b21f

Please sign in to comment.