From 05b600819aee5e3be8dd77bc6bf059acf562c63c Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Thu, 7 Jan 2016 20:20:55 -0500 Subject: [PATCH] Updates to MGXS pyapi --- openmc/material.py | 3 +-- openmc/mgxs_library.py | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/openmc/material.py b/openmc/material.py index 4da4e0ae35..ca78bd61f2 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -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) ' \ diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py index d1c1f4e05f..5820c0ee52 100644 --- a/openmc/mgxs_library.py +++ b/openmc/mgxs_library.py @@ -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):