Updates to MGXS pyapi

This commit is contained in:
Adam Nelson 2016-01-07 20:20:55 -05:00
parent ff27852c51
commit 05b600819a
2 changed files with 19 additions and 9 deletions

View file

@ -339,8 +339,7 @@ class Material(object):
# Ensure no nuclides, elements, or sab are added since these would be
# incompatible with macroscopics
if ((len(self._nuclides.keys()) != 0) and
(len(self._elements.keys()) != 0) and (len(self._sab) != 0)):
if self._nuclides or self._elements or self._sab:
msg = 'Unable to add a Macroscopic data set to Material ID="{0}" ' \
'with a macroscopic value "{1}" as an incompatible data ' \
'member (i.e., nuclide, element, or S(a,b) table) ' \

View file

@ -20,6 +20,17 @@ REPRESENTATIONS = ['isotropic', 'angle']
def ndarray_to_string(arr):
"""Converts a numpy ndarray in to a join with spaces between entries
similar to ' '.join(map(str,arr)) but applied to all sub-dimensions.
Parameters
----------
arr : ndarray
Array to combine in to a string
Returns
-------
text : str
String representation of array in arr
"""
shape = arr.shape
@ -67,8 +78,8 @@ def ndarray_to_string(arr):
return text
class Xsdata(object):
"""A multi-group cross section data set (xsdata) providing all the
class XSdata(object):
"""A multi-group cross section data set providing all the
multi-group data necessary for a multi-group OpenMC calculation.
Parameters
@ -76,7 +87,6 @@ class Xsdata(object):
name : str, optional
Name of the mgxs data set.
representation : str
Method used in generating the MGXS (isotropic or angle-dependent flux
weighting). Defaults to 'isotropic'
@ -141,7 +151,6 @@ class Xsdata(object):
def representation(self):
return self._representation
@property
def alias(self):
return self._alias
@ -221,8 +230,8 @@ class Xsdata(object):
check_type("energy_groups", energy_groups, EnergyGroups)
# Check that there is one or more groups
if ((energy_groups.num_energy_groups.num_group is None) or
(energy_groups.num_energy_groups.num_group < 1)):
if ((energy_groups.num_groups is None) or
(energy_groups.num_groups < 1)):
msg = 'energy_groups object incorrectly initialized.'
raise ValueError(msg)
@ -429,7 +438,7 @@ class Xsdata(object):
@nu_fission.setter
def nu_fission(self, nu_fission):
# nu_fission ca nbe given as a vector or a matrix
# nu_fission can be given as a vector or a matrix
# Vector is used when chi also exists.
# Matrix is used when chi does not exist.
# We have to check that the correct form is given, but only if
@ -563,6 +572,8 @@ class MGXSLibraryFile(object):
Inverse of velocities, units of sec/cm
filename : str
XML file to write to.
xsdatas : Iterable of XSdata
Iterable of multi-Group cross section data objects
"""
def __init__(self, energy_groups):