mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Fixed merge conflicts with develop
This commit is contained in:
commit
ae39ef8ce8
12 changed files with 133 additions and 132 deletions
|
|
@ -17,15 +17,15 @@ def check_type(name, value, expected_type, expected_iter_type=None):
|
|||
"""
|
||||
|
||||
if not isinstance(value, expected_type):
|
||||
msg = 'Unable to set {0} to {1} which is not of type {2}'.format(
|
||||
msg = 'Unable to set "{0}" to "{1}" which is not of type "{2}"'.format(
|
||||
name, value, expected_type.__name__)
|
||||
raise ValueError(msg)
|
||||
|
||||
if expected_iter_type:
|
||||
for item in value:
|
||||
if not isinstance(item, expected_iter_type):
|
||||
msg = 'Unable to set {0} to {1} since each item must be ' \
|
||||
'of type {2}'.format(name, value,
|
||||
msg = 'Unable to set "{0}" to "{1}" since each item must be ' \
|
||||
'of type "{2}"'.format(name, value,
|
||||
expected_iter_type.__name__)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -49,16 +49,16 @@ def check_length(name, value, length_min, length_max=None):
|
|||
|
||||
if length_max is None:
|
||||
if len(value) != length_min:
|
||||
msg = 'Unable to set {0} to {1} since it must be of ' \
|
||||
'length {2}'.format(name, value, length_min)
|
||||
msg = 'Unable to set "{0}" to "{1}" since it must be of ' \
|
||||
'length "{2}"'.format(name, value, length_min)
|
||||
raise ValueError(msg)
|
||||
elif not length_min <= len(value) <= length_max:
|
||||
if length_min == length_max:
|
||||
msg = 'Unable to set {0} to {1} since it must be of ' \
|
||||
'length {2}'.format(name, value, length_min)
|
||||
msg = 'Unable to set "{0}" to "{1}" since it must be of ' \
|
||||
'length "{2}"'.format(name, value, length_min)
|
||||
else:
|
||||
msg = 'Unable to set {0} to {1} since it must have length ' \
|
||||
'between {2} and {3}'.format(name, value, length_min,
|
||||
msg = 'Unable to set "{0}" to "{1}" since it must have length ' \
|
||||
'between "{2}" and "{3}"'.format(name, value, length_min,
|
||||
length_max)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ def check_value(name, value, accepted_values):
|
|||
"""
|
||||
|
||||
if value not in accepted_values:
|
||||
msg = 'Unable to set {0} to {1} since it is not in {2}'.format(
|
||||
msg = 'Unable to set "{0}" to "{1}" since it is not in "{2}"'.format(
|
||||
name, value, accepted_values)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -100,13 +100,13 @@ def check_less_than(name, value, maximum, equality=False):
|
|||
|
||||
if equality:
|
||||
if value > maximum:
|
||||
msg = 'Unable to set {0} to {1} since it is greater than ' \
|
||||
'{2}'.format(name, value, maximum)
|
||||
msg = 'Unable to set "{0}" to "{1}" since it is greater than ' \
|
||||
'"{2}"'.format(name, value, maximum)
|
||||
raise ValueError(msg)
|
||||
else:
|
||||
if value >= maximum:
|
||||
msg = 'Unable to set {0} to {1} since it is greater than ' \
|
||||
'or equal to {2}'.format(name, value, maximum)
|
||||
msg = 'Unable to set "{0}" to "{1}" since it is greater than ' \
|
||||
'or equal to "{2}"'.format(name, value, maximum)
|
||||
raise ValueError(msg)
|
||||
|
||||
def check_greater_than(name, value, minimum, equality=False):
|
||||
|
|
@ -127,11 +127,11 @@ def check_greater_than(name, value, minimum, equality=False):
|
|||
|
||||
if equality:
|
||||
if value < minimum:
|
||||
msg = 'Unable to set {0} to {1} since it is less than ' \
|
||||
'{2}'.format(name, value, minimum)
|
||||
msg = 'Unable to set "{0}" to "{1}" since it is less than ' \
|
||||
'"{2}"'.format(name, value, minimum)
|
||||
raise ValueError(msg)
|
||||
else:
|
||||
if value <= minimum:
|
||||
msg = 'Unable to set {0} to {1} since it is less than ' \
|
||||
'or equal to {2}'.format(name, value, minimum)
|
||||
msg = 'Unable to set "{0}" to "{1}" since it is less than ' \
|
||||
'or equal to "{2}"'.format(name, value, minimum)
|
||||
raise ValueError(msg)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Executor(object):
|
|||
check_type("Executor's working directory", working_directory,
|
||||
basestring)
|
||||
if not os.path.isdir(working_directory):
|
||||
msg = 'Unable to set Executor\'s working directory to {0} ' \
|
||||
msg = 'Unable to set Executor\'s working directory to "{0}" ' \
|
||||
'which does not exist'.format(working_directory)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -136,30 +136,30 @@ class Filter(object):
|
|||
'universe', 'distribcell']:
|
||||
for edge in bins:
|
||||
if not isinstance(edge, Integral):
|
||||
msg = 'Unable to add bin "{0}" to a {1} Filter since ' \
|
||||
msg = 'Unable to add bin "{0}" to a "{1}" Filter since ' \
|
||||
'it is not an integer'.format(edge, self._type)
|
||||
raise ValueError(msg)
|
||||
elif edge < 0:
|
||||
msg = 'Unable to add bin "{0}" to a {1} Filter since ' \
|
||||
msg = 'Unable to add bin "{0}" to a "{1}" Filter since ' \
|
||||
'it is negative'.format(edge, self._type)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif self._type in ['energy', 'energyout']:
|
||||
for edge in bins:
|
||||
if not isinstance(edge, Real):
|
||||
msg = 'Unable to add bin edge "{0}" to a {1} Filter ' \
|
||||
msg = 'Unable to add bin edge "{0}" to a "{1}" Filter ' \
|
||||
'since it is a non-integer or floating point ' \
|
||||
'value'.format(edge, self.type)
|
||||
raise ValueError(msg)
|
||||
elif edge < 0.:
|
||||
msg = 'Unable to add bin edge "{0}" to a {1} Filter ' \
|
||||
msg = 'Unable to add bin edge "{0}" to a "{1}" Filter ' \
|
||||
'since it is a negative value'.format(edge, self.type)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check that bin edges are monotonically increasing
|
||||
for index in range(len(bins)):
|
||||
if index > 0 and bins[index] < bins[index-1]:
|
||||
msg = 'Unable to add bin edges "{0}" to a {1} Filter ' \
|
||||
msg = 'Unable to add bin edges "{0}" to a "{1}" Filter ' \
|
||||
'since they are not monotonically ' \
|
||||
'increasing'.format(bins, self.type)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -186,7 +186,7 @@ class Filter(object):
|
|||
@num_bins.setter
|
||||
def num_bins(self, num_bins):
|
||||
if not isinstance(num_bins, Integral) or num_bins < 0:
|
||||
msg = 'Unable to set the number of bins "{0}" for a {1} Filter ' \
|
||||
msg = 'Unable to set the number of bins "{0}" for a "{1}" Filter ' \
|
||||
'since it is not a positive ' \
|
||||
'integer'.format(num_bins, self.type)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -210,8 +210,8 @@ class Filter(object):
|
|||
def stride(self, stride):
|
||||
check_type('filter stride', stride, Integral)
|
||||
if stride < 0:
|
||||
msg = 'Unable to set stride "{0}" for a {1} Filter since it is a ' \
|
||||
'negative value'.format(stride, self.type)
|
||||
msg = 'Unable to set stride "{0}" for a "{1}" Filter since it ' \
|
||||
'is a negative value'.format(stride, self.type)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._stride = stride
|
||||
|
|
@ -269,7 +269,8 @@ class Filter(object):
|
|||
"""
|
||||
|
||||
if not self.can_merge(filter):
|
||||
msg = 'Unable to merge {0} with {1} filters'.format(self.type, filter.type)
|
||||
msg = 'Unable to merge "{0}" with "{1}" ' \
|
||||
'filters'.format(self.type, filter.type)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Create deep copy of filter to return as merged filter
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class Geometry(object):
|
|||
def root_universe(self, root_universe):
|
||||
check_type('root universe', root_universe, openmc.Universe)
|
||||
if root_universe._id != 0:
|
||||
msg = 'Unable to add root Universe {0} to Geometry since ' \
|
||||
'it has ID={1} instead of ' \
|
||||
msg = 'Unable to add root Universe "{0}" to Geometry since ' \
|
||||
'it has ID="{1}" instead of ' \
|
||||
'ID=0'.format(root_universe, root_universe._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class Material(object):
|
|||
else:
|
||||
check_type('material ID', material_id, Integral)
|
||||
if material_id in MATERIAL_IDS:
|
||||
msg = 'Unable to set Material ID to {0} since a Material with ' \
|
||||
msg = 'Unable to set Material ID to "{0}" since a Material with ' \
|
||||
'this ID was already initialized'.format(material_id)
|
||||
raise ValueError(msg)
|
||||
check_greater_than('material ID', material_id, 0)
|
||||
|
|
@ -132,7 +132,7 @@ class Material(object):
|
|||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
check_type('name for Material ID={0}'.format(self._id),
|
||||
check_type('name for Material ID="{0}"'.format(self._id),
|
||||
name, basestring)
|
||||
self._name = name
|
||||
|
||||
|
|
@ -149,12 +149,12 @@ class Material(object):
|
|||
|
||||
"""
|
||||
|
||||
check_type('the density for Material ID={0}'.format(self._id),
|
||||
check_type('the density for Material ID="{0}"'.format(self._id),
|
||||
density, Real)
|
||||
check_value('density units', units, DENSITY_UNITS)
|
||||
|
||||
if density == NO_DENSITY and units is not 'sum':
|
||||
msg = 'Unable to set the density Material ID={0} ' \
|
||||
msg = 'Unable to set the density Material ID="{0}" ' \
|
||||
'because a density must be set when not using ' \
|
||||
'sum unit'.format(self._id)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -169,8 +169,8 @@ class Material(object):
|
|||
'version of openmc')
|
||||
|
||||
if not isinstance(filename, basestring) and filename is not None:
|
||||
msg = 'Unable to add OTF material file to Material ID={0} with a ' \
|
||||
'non-string name {1}'.format(self._id, filename)
|
||||
msg = 'Unable to add OTF material file to Material ID="{0}" with a ' \
|
||||
'non-string name "{1}"'.format(self._id, filename)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._distrib_otf_file = filename
|
||||
|
|
@ -198,18 +198,18 @@ class Material(object):
|
|||
"""
|
||||
|
||||
if not isinstance(nuclide, (openmc.Nuclide, str)):
|
||||
msg = 'Unable to add a Nuclide to Material ID={0} with a ' \
|
||||
'non-Nuclide value {1}'.format(self._id, nuclide)
|
||||
msg = 'Unable to add a Nuclide to Material ID="{0}" with a ' \
|
||||
'non-Nuclide value "{1}"'.format(self._id, nuclide)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(percent, Real):
|
||||
msg = 'Unable to add a Nuclide to Material ID={0} with a ' \
|
||||
'non-floating point value {1}'.format(self._id, percent)
|
||||
msg = 'Unable to add a Nuclide to Material ID="{0}" with a ' \
|
||||
'non-floating point value "{1}"'.format(self._id, percent)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif percent_type not in ['ao', 'wo', 'at/g-cm']:
|
||||
msg = 'Unable to add a Nuclide to Material ID={0} with a ' \
|
||||
'percent type {1}'.format(self._id, percent_type)
|
||||
msg = 'Unable to add a Nuclide to Material ID="{0}" with a ' \
|
||||
'percent type "{1}"'.format(self._id, percent_type)
|
||||
raise ValueError(msg)
|
||||
|
||||
if isinstance(nuclide, openmc.Nuclide):
|
||||
|
|
@ -232,7 +232,7 @@ class Material(object):
|
|||
"""
|
||||
|
||||
if not isinstance(nuclide, openmc.Nuclide):
|
||||
msg = 'Unable to remove a Nuclide {0} in Material ID={1} ' \
|
||||
msg = 'Unable to remove a Nuclide "{0}" in Material ID="{1}" ' \
|
||||
'since it is not a Nuclide'.format(self._id, nuclide)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -255,18 +255,18 @@ class Material(object):
|
|||
"""
|
||||
|
||||
if not isinstance(element, openmc.Element):
|
||||
msg = 'Unable to add an Element to Material ID={0} with a ' \
|
||||
'non-Element value {1}'.format(self._id, element)
|
||||
msg = 'Unable to add an Element to Material ID="{0}" with a ' \
|
||||
'non-Element value "{1}"'.format(self._id, element)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(percent, Real):
|
||||
msg = 'Unable to add an Element to Material ID={0} with a ' \
|
||||
'non-floating point value {1}'.format(self._id, percent)
|
||||
msg = 'Unable to add an Element to Material ID="{0}" with a ' \
|
||||
'non-floating point value "{1}"'.format(self._id, percent)
|
||||
raise ValueError(msg)
|
||||
|
||||
if percent_type not in ['ao', 'wo']:
|
||||
msg = 'Unable to add an Element to Material ID={0} with a ' \
|
||||
'percent type {1}'.format(self._id, percent_type)
|
||||
msg = 'Unable to add an Element to Material ID="{0}" with a ' \
|
||||
'percent type "{1}"'.format(self._id, percent_type)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Copy this Element to separate it from same Element in other Materials
|
||||
|
|
@ -301,13 +301,13 @@ class Material(object):
|
|||
"""
|
||||
|
||||
if not isinstance(name, basestring):
|
||||
msg = 'Unable to add an S(a,b) table to Material ID={0} with a ' \
|
||||
'non-string table name {1}'.format(self._id, name)
|
||||
msg = 'Unable to add an S(a,b) table to Material ID="{0}" with a ' \
|
||||
'non-string table name "{1}"'.format(self._id, name)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(xs, basestring):
|
||||
msg = 'Unable to add an S(a,b) table to Material ID={0} with a ' \
|
||||
'non-string cross-section identifier {1}'.format(self._id, xs)
|
||||
msg = 'Unable to add an S(a,b) table to Material ID="{0}" with a ' \
|
||||
'non-string cross-section identifier "{1}"'.format(self._id, xs)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._sab.append((name, xs))
|
||||
|
|
@ -332,7 +332,7 @@ class Material(object):
|
|||
|
||||
return nuclides
|
||||
|
||||
def _repr__(self):
|
||||
def __repr__(self):
|
||||
string = 'Material\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
|
||||
|
|
@ -522,7 +522,7 @@ class MaterialsFile(object):
|
|||
"""
|
||||
|
||||
if not isinstance(material, Material):
|
||||
msg = 'Unable to add a non-Material {0} to the ' \
|
||||
msg = 'Unable to add a non-Material "{0}" to the ' \
|
||||
'MaterialsFile'.format(material)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -539,7 +539,7 @@ class MaterialsFile(object):
|
|||
"""
|
||||
|
||||
if not isinstance(materials, Iterable):
|
||||
msg = 'Unable to create OpenMC materials.xml file from {0} which ' \
|
||||
msg = 'Unable to create OpenMC materials.xml file from "{0}" which ' \
|
||||
'is not iterable'.format(materials)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ class MaterialsFile(object):
|
|||
"""
|
||||
|
||||
if not isinstance(material, Material):
|
||||
msg = 'Unable to remove a non-Material {0} from the ' \
|
||||
msg = 'Unable to remove a non-Material "{0}" from the ' \
|
||||
'MaterialsFile'.format(material)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -148,14 +148,14 @@ class Mesh(object):
|
|||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
check_type('name for mesh ID={0}'.format(self._id), name, basestring)
|
||||
check_type('name for mesh ID="{0}"'.format(self._id), name, basestring)
|
||||
self._name = name
|
||||
|
||||
@type.setter
|
||||
def type(self, meshtype):
|
||||
check_type('type for mesh ID={0}'.format(self._id),
|
||||
check_type('type for mesh ID="{0}"'.format(self._id),
|
||||
meshtype, basestring)
|
||||
check_value('type for mesh ID={0}'.format(self._id),
|
||||
check_value('type for mesh ID="{0}"'.format(self._id),
|
||||
meshtype, ['rectangular', 'hexagonal'])
|
||||
self._type = meshtype
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ def get_opencg_material(openmc_material):
|
|||
"""
|
||||
|
||||
if not isinstance(openmc_material, openmc.Material):
|
||||
msg = 'Unable to create an OpenCG Material from {0} ' \
|
||||
msg = 'Unable to create an OpenCG Material from "{0}" ' \
|
||||
'which is not an OpenMC Material'.format(openmc_material)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ def get_openmc_material(opencg_material):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_material, opencg.Material):
|
||||
msg = 'Unable to create an OpenMC Material from {0} ' \
|
||||
msg = 'Unable to create an OpenMC Material from "{0}" ' \
|
||||
'which is not an OpenCG Material'.format(opencg_material)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ def is_opencg_surface_compatible(opencg_surface):
|
|||
|
||||
if not isinstance(opencg_surface, opencg.Surface):
|
||||
msg = 'Unable to check if OpenCG Surface is compatible' \
|
||||
'since {0} is not a Surface'.format(opencg_surface)
|
||||
'since "{0}" is not a Surface'.format(opencg_surface)
|
||||
raise ValueError(msg)
|
||||
|
||||
if opencg_surface._type in ['x-squareprism',
|
||||
|
|
@ -191,7 +191,7 @@ def get_opencg_surface(openmc_surface):
|
|||
"""
|
||||
|
||||
if not isinstance(openmc_surface, openmc.Surface):
|
||||
msg = 'Unable to create an OpenCG Surface from {0} ' \
|
||||
msg = 'Unable to create an OpenCG Surface from "{0}" ' \
|
||||
'which is not an OpenMC Surface'.format(openmc_surface)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ def get_openmc_surface(opencg_surface):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_surface, opencg.Surface):
|
||||
msg = 'Unable to create an OpenMC Surface from {0} which ' \
|
||||
msg = 'Unable to create an OpenMC Surface from "{0}" which ' \
|
||||
'is not an OpenCG Surface'.format(opencg_surface)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ def get_openmc_surface(opencg_surface):
|
|||
|
||||
else:
|
||||
msg = 'Unable to create an OpenMC Surface from an OpenCG ' \
|
||||
'Surface of type {0} since it is not a compatible ' \
|
||||
'Surface of type "{0}" since it is not a compatible ' \
|
||||
'Surface type in OpenMC'.format(opencg_surface._type)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ def get_compatible_opencg_surfaces(opencg_surface):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_surface, opencg.Surface):
|
||||
msg = 'Unable to create an OpenMC Surface from {0} which ' \
|
||||
msg = 'Unable to create an OpenMC Surface from "{0}" which ' \
|
||||
'is not an OpenCG Surface'.format(opencg_surface)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ def get_compatible_opencg_surfaces(opencg_surface):
|
|||
|
||||
else:
|
||||
msg = 'Unable to create a compatible OpenMC Surface an OpenCG ' \
|
||||
'Surface of type {0} since it already a compatible ' \
|
||||
'Surface of type "{0}" since it already a compatible ' \
|
||||
'Surface type in OpenMC'.format(opencg_surface._type)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ def get_opencg_cell(openmc_cell):
|
|||
"""
|
||||
|
||||
if not isinstance(openmc_cell, openmc.Cell):
|
||||
msg = 'Unable to create an OpenCG Cell from {0} which ' \
|
||||
msg = 'Unable to create an OpenCG Cell from "{0}" which ' \
|
||||
'is not an OpenMC Cell'.format(openmc_cell)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -518,17 +518,17 @@ def get_compatible_opencg_cells(opencg_cell, opencg_surface, halfspace):
|
|||
|
||||
"""
|
||||
if not isinstance(opencg_cell, opencg.Cell):
|
||||
msg = 'Unable to create compatible OpenMC Cell from {0} which ' \
|
||||
msg = 'Unable to create compatible OpenMC Cell from "{0}" which ' \
|
||||
'is not an OpenCG Cell'.format(opencg_cell)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(opencg_surface, opencg.Surface):
|
||||
msg = 'Unable to create compatible OpenMC Cell since {0} is ' \
|
||||
msg = 'Unable to create compatible OpenMC Cell since "{0}" is ' \
|
||||
'not an OpenCG Surface'.format(opencg_surface)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif halfspace not in [-1, +1]:
|
||||
msg = 'Unable to create compatible Cell since {0}' \
|
||||
msg = 'Unable to create compatible Cell since "{0}"' \
|
||||
'is not a +/-1 halfspace'.format(halfspace)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -626,7 +626,7 @@ def make_opencg_cells_compatible(opencg_universe):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_universe, opencg.Universe):
|
||||
msg = 'Unable to make compatible OpenCG Cells for {0} which ' \
|
||||
msg = 'Unable to make compatible OpenCG Cells for "{0}" which ' \
|
||||
'is not an OpenCG Universe'.format(opencg_universe)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -685,7 +685,7 @@ def get_openmc_cell(opencg_cell):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_cell, opencg.Cell):
|
||||
msg = 'Unable to create an OpenMC Cell from {0} which ' \
|
||||
msg = 'Unable to create an OpenMC Cell from "{0}" which ' \
|
||||
'is not an OpenCG Cell'.format(opencg_cell)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ def get_opencg_universe(openmc_universe):
|
|||
"""
|
||||
|
||||
if not isinstance(openmc_universe, openmc.Universe):
|
||||
msg = 'Unable to create an OpenCG Universe from {0} which ' \
|
||||
msg = 'Unable to create an OpenCG Universe from "{0}" which ' \
|
||||
'is not an OpenMC Universe'.format(openmc_universe)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -796,7 +796,7 @@ def get_openmc_universe(opencg_universe):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_universe, opencg.Universe):
|
||||
msg = 'Unable to create an OpenMC Universe from {0} which ' \
|
||||
msg = 'Unable to create an OpenMC Universe from "{0}" which ' \
|
||||
'is not an OpenCG Universe'.format(opencg_universe)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -846,7 +846,7 @@ def get_opencg_lattice(openmc_lattice):
|
|||
"""
|
||||
|
||||
if not isinstance(openmc_lattice, openmc.Lattice):
|
||||
msg = 'Unable to create an OpenCG Lattice from {0} which ' \
|
||||
msg = 'Unable to create an OpenCG Lattice from "{0}" which ' \
|
||||
'is not an OpenMC Lattice'.format(openmc_lattice)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -926,7 +926,7 @@ def get_openmc_lattice(opencg_lattice):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_lattice, opencg.Lattice):
|
||||
msg = 'Unable to create an OpenMC Lattice from {0} which ' \
|
||||
msg = 'Unable to create an OpenMC Lattice from "{0}" which ' \
|
||||
'is not an OpenCG Lattice'.format(opencg_lattice)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -997,7 +997,7 @@ def get_opencg_geometry(openmc_geometry):
|
|||
"""
|
||||
|
||||
if not isinstance(openmc_geometry, openmc.Geometry):
|
||||
msg = 'Unable to get OpenCG geometry from {0} which is ' \
|
||||
msg = 'Unable to get OpenCG geometry from "{0}" which is ' \
|
||||
'not an OpenMC Geometry object'.format(openmc_geometry)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -1037,7 +1037,7 @@ def get_openmc_geometry(opencg_geometry):
|
|||
"""
|
||||
|
||||
if not isinstance(opencg_geometry, opencg.Geometry):
|
||||
msg = 'Unable to get OpenMC geometry from {0} which is ' \
|
||||
msg = 'Unable to get OpenMC geometry from "{0}" which is ' \
|
||||
'not an OpenCG Geometry object'.format(opencg_geometry)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -210,18 +210,18 @@ class Plot(object):
|
|||
|
||||
for key in col_spec:
|
||||
if key < 0:
|
||||
msg = 'Unable to create Plot ID={0} with col_spec ID {1} ' \
|
||||
msg = 'Unable to create Plot ID="{0}" with col_spec ID "{1}" ' \
|
||||
'which is less than 0'.format(self._id, key)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(col_spec[key], Iterable):
|
||||
msg = 'Unable to create Plot ID={0} with col_spec RGB values' \
|
||||
' {1} which is not iterable'.format(self._id, col_spec[key])
|
||||
msg = 'Unable to create Plot ID="{0}" with col_spec RGB values' \
|
||||
' "{1}" which is not iterable'.format(self._id, col_spec[key])
|
||||
raise ValueError(msg)
|
||||
|
||||
elif len(col_spec[key]) != 3:
|
||||
msg = 'Unable to create Plot ID={0} with col_spec RGB ' \
|
||||
'values of length {1} since 3 values must be ' \
|
||||
msg = 'Unable to create Plot ID="{0}" with col_spec RGB ' \
|
||||
'values of length "{1}" since 3 values must be ' \
|
||||
'input'.format(self._id, len(col_spec[key]))
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ class PlotsFile(object):
|
|||
"""
|
||||
|
||||
if not isinstance(plot, Plot):
|
||||
msg = 'Unable to add a non-Plot {0} to the PlotsFile'.format(plot)
|
||||
msg = 'Unable to add a non-Plot "{0}" to the PlotsFile'.format(plot)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._plots.append(plot)
|
||||
|
|
|
|||
|
|
@ -426,28 +426,28 @@ class SettingsFile(object):
|
|||
@keff_trigger.setter
|
||||
def keff_trigger(self, keff_trigger):
|
||||
if not isinstance(keff_trigger, dict):
|
||||
msg = 'Unable to set a trigger on keff from {0} which ' \
|
||||
msg = 'Unable to set a trigger on keff from "{0}" which ' \
|
||||
'is not a Python dictionary'.format(keff_trigger)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif 'type' not in keff_trigger:
|
||||
msg = 'Unable to set a trigger on keff from {0} which ' \
|
||||
msg = 'Unable to set a trigger on keff from "{0}" which ' \
|
||||
'does not have a "type" key'.format(keff_trigger)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif keff_trigger['type'] not in ['variance', 'std_dev', 'rel_err']:
|
||||
msg = 'Unable to set a trigger on keff with ' \
|
||||
'type {0}'.format(keff_trigger['type'])
|
||||
'type "{0}"'.format(keff_trigger['type'])
|
||||
raise ValueError(msg)
|
||||
|
||||
elif 'threshold' not in keff_trigger:
|
||||
msg = 'Unable to set a trigger on keff from {0} which ' \
|
||||
msg = 'Unable to set a trigger on keff from "{0}" which ' \
|
||||
'does not have a "threshold" key'.format(keff_trigger)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(keff_trigger['threshold'], Real):
|
||||
msg = 'Unable to set a trigger on keff with ' \
|
||||
'threshold {0}'.format(keff_trigger['threshold'])
|
||||
'threshold "{0}"'.format(keff_trigger['threshold'])
|
||||
raise ValueError(msg)
|
||||
|
||||
self._keff_trigger = keff_trigger
|
||||
|
|
@ -574,20 +574,20 @@ class SettingsFile(object):
|
|||
@output.setter
|
||||
def output(self, output):
|
||||
if not isinstance(output, dict):
|
||||
msg = 'Unable to set output to {0} which is not a Python ' \
|
||||
msg = 'Unable to set output to "{0}" which is not a Python ' \
|
||||
'dictionary of string keys and boolean values'.format(output)
|
||||
raise ValueError(msg)
|
||||
|
||||
for element in output:
|
||||
keys = ['summary', 'cross_sections', 'tallies', 'distribmats']
|
||||
if element not in keys:
|
||||
msg = 'Unable to set output to {0} which is unsupported by ' \
|
||||
msg = 'Unable to set output to "{0}" which is unsupported by ' \
|
||||
'OpenMC'.format(element)
|
||||
raise ValueError(msg)
|
||||
|
||||
if not isinstance(output[element], (bool, np.bool)):
|
||||
msg = 'Unable to set output for {0} to a non-boolean ' \
|
||||
'value {1}'.format(element, output[element])
|
||||
msg = 'Unable to set output for "{0}" to a non-boolean ' \
|
||||
'value "{1}"'.format(element, output[element])
|
||||
raise ValueError(msg)
|
||||
|
||||
self._output = output
|
||||
|
|
@ -753,7 +753,7 @@ class SettingsFile(object):
|
|||
def track(self, track):
|
||||
check_type('track', track, Iterable, Integral)
|
||||
if len(track) % 3 != 0:
|
||||
msg = 'Unable to set the track to {0} since its length is ' \
|
||||
msg = 'Unable to set the track to "{0}" since its length is ' \
|
||||
'not a multiple of 3'.format(track)
|
||||
raise ValueError(msg)
|
||||
for t in zip(track[::3], track[1::3], track[2::3]):
|
||||
|
|
@ -832,7 +832,7 @@ class SettingsFile(object):
|
|||
len_nodemap = np.prod(self._dd_mesh_dimension)
|
||||
|
||||
if len(nodemap) < len_nodemap or len(nodemap) > len_nodemap:
|
||||
msg = 'Unable to set DD nodemap with length {0} which ' \
|
||||
msg = 'Unable to set DD nodemap with length "{0}" which ' \
|
||||
'does not have the same dimensionality as the domain ' \
|
||||
'mesh'.format(len(nodemap))
|
||||
raise ValueError(msg)
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ class StatePoint(object):
|
|||
path='{0}{1}/n_bins'.format(subbase, j))[0]
|
||||
|
||||
if n_bins <= 0:
|
||||
msg = 'Unable to create Filter {0} for Tally ID={2} ' \
|
||||
msg = 'Unable to create Filter "{0}" for Tally ID="{1}" ' \
|
||||
'since no bins were specified'.format(j, tally_key)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -748,7 +748,7 @@ class StatePoint(object):
|
|||
"""
|
||||
|
||||
if not isinstance(summary, openmc.summary.Summary):
|
||||
msg = 'Unable to link statepoint with {0} which ' \
|
||||
msg = 'Unable to link statepoint with "{0}" which ' \
|
||||
'is not a Summary object'.format(summary)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if not isinstance(trigger, Trigger):
|
||||
msg = 'Unable to add a tally trigger for Tally ID={0} to ' \
|
||||
msg = 'Unable to add a tally trigger for Tally ID="{0}" to ' \
|
||||
'since "{1}" is not a Trigger'.format(self.id, trigger)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if not isinstance(filter, (Filter, CrossFilter)):
|
||||
msg = 'Unable to add Filter "{0}" to Tally ID={1} since it is ' \
|
||||
msg = 'Unable to add Filter "{0}" to Tally ID="{1}" since it is ' \
|
||||
'not a Filter object'.format(filter, self.id)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -359,7 +359,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if not isinstance(score, (basestring, CrossScore)):
|
||||
msg = 'Unable to add score "{0}" to Tally ID={1} since it is ' \
|
||||
msg = 'Unable to add score "{0}" to Tally ID="{1}" since it is ' \
|
||||
'not a string'.format(score, self.id)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if score not in self.scores:
|
||||
msg = 'Unable to remove score "{0}" from Tally ID={1} since the ' \
|
||||
msg = 'Unable to remove score "{0}" from Tally ID="{1}" since the ' \
|
||||
'Tally does not contain this score'.format(score, self.id)
|
||||
ValueError(msg)
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if filter not in self.filters:
|
||||
msg = 'Unable to remove filter "{0}" from Tally ID={1} since the ' \
|
||||
msg = 'Unable to remove filter "{0}" from Tally ID="{1}" since the ' \
|
||||
'Tally does not contain this filter'.format(filter, self.id)
|
||||
ValueError(msg)
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if nuclide not in self.nuclides:
|
||||
msg = 'Unable to remove nuclide "{0}" from Tally ID={1} since the ' \
|
||||
msg = 'Unable to remove nuclide "{0}" from Tally ID="{1}" since the ' \
|
||||
'Tally does not contain this nuclide'.format(nuclide, self.id)
|
||||
ValueError(msg)
|
||||
|
||||
|
|
@ -561,7 +561,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
if not self.can_merge(tally):
|
||||
msg = 'Unable to merge tally ID={0} with {1}'.format(tally.id, self.id)
|
||||
msg = 'Unable to merge tally ID="{0}" with "{1}"'.format(tally.id, self.id)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Create deep copy of tally to return as merged tally
|
||||
|
|
@ -633,7 +633,7 @@ class Tally(object):
|
|||
|
||||
# Scores
|
||||
if len(self.scores) == 0:
|
||||
msg = 'Unable to get XML for Tally ID={0} since it does not ' \
|
||||
msg = 'Unable to get XML for Tally ID="{0}" since it does not ' \
|
||||
'contain any scores'.format(self.id)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ class Tally(object):
|
|||
# If we did not find the Filter, throw an Exception
|
||||
if filter is None:
|
||||
msg = 'Unable to find filter type "{0}" in ' \
|
||||
'Tally ID={1}'.format(filter_type, self.id)
|
||||
'Tally ID="{1}"'.format(filter_type, self.id)
|
||||
raise ValueError(msg)
|
||||
|
||||
return filter
|
||||
|
|
@ -859,7 +859,7 @@ class Tally(object):
|
|||
(value == 'rel_err' and self.mean is None) or \
|
||||
(value == 'sum' and self.sum is None) or \
|
||||
(value == 'sum_sq' and self.sum_sq is None):
|
||||
msg = 'The Tally ID={0} has no data to return. Call the ' \
|
||||
msg = 'The Tally ID="{0}" has no data to return. Call the ' \
|
||||
'StatePoint.read_results() method before using ' \
|
||||
'Tally.get_values(...)'.format(self.id)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -959,7 +959,7 @@ class Tally(object):
|
|||
elif value == 'sum_sq':
|
||||
data = self.sum_sq[indices]
|
||||
else:
|
||||
msg = 'Unable to return results from Tally ID={0} since the ' \
|
||||
msg = 'Unable to return results from Tally ID="{0}" since the ' \
|
||||
'the requested value "{1}" is not \'mean\', \'std_dev\', ' \
|
||||
'\rel_err\', \'sum\', or \'sum_sq\''.format(self.id, value)
|
||||
raise LookupError(msg)
|
||||
|
|
@ -1010,7 +1010,7 @@ class Tally(object):
|
|||
"""
|
||||
|
||||
# Ensure that StatePoint.read_results() was called first
|
||||
if self.mean is None or self.std_dev is None:
|
||||
if self._sum is None or self._sum_sq is None:
|
||||
msg = 'The Tally ID={0} has no data to return. Call the ' \
|
||||
'StatePoint.read_results() method before using ' \
|
||||
'Tally.get_pandas_dataframe(...)'.format(self.id)
|
||||
|
|
@ -1018,7 +1018,7 @@ class Tally(object):
|
|||
|
||||
# If using Summary, ensure StatePoint.link_with_summary(...) was called
|
||||
if summary and not self.with_summary:
|
||||
msg = 'The Tally ID={0} has not been linked with the Summary. ' \
|
||||
msg = 'The Tally ID="{0}" has not been linked with the Summary. ' \
|
||||
'Call the StatePoint.link_with_summary(...) method ' \
|
||||
'before using Tally.get_pandas_dataframe(...) with ' \
|
||||
'Summary info'.format(self.id)
|
||||
|
|
@ -1314,30 +1314,30 @@ class Tally(object):
|
|||
|
||||
# Ensure that StatePoint.read_results() was called first
|
||||
if self._sum is None or self._sum_sq is None:
|
||||
msg = 'The Tally ID={0} has no data to export. Call the ' \
|
||||
'StatePoint.read_results() method before using ' \
|
||||
msg = 'The Tally ID="{0}" has no data to export. Call the ' \
|
||||
'StatePoint.read_results() routine before using ' \
|
||||
'Tally.export_results(...)'.format(self.id)
|
||||
raise KeyError(msg)
|
||||
|
||||
if not isinstance(filename, basestring):
|
||||
msg = 'Unable to export the results for Tally ID={0} to ' \
|
||||
msg = 'Unable to export the results for Tally ID="{0}" to ' \
|
||||
'filename="{1}" since it is not a ' \
|
||||
'string'.format(self.id, filename)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(directory, basestring):
|
||||
msg = 'Unable to export the results for Tally ID={0} to ' \
|
||||
msg = 'Unable to export the results for Tally ID="{0}" to ' \
|
||||
'directory="{1}" since it is not a ' \
|
||||
'string'.format(self.id, directory)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif format not in ['hdf5', 'pkl', 'csv']:
|
||||
msg = 'Unable to export the results for Tally ID={0} to format ' \
|
||||
msg = 'Unable to export the results for Tally ID="{0}" to format ' \
|
||||
'"{1}" since it is not supported'.format(self.id, format)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif not isinstance(append, bool):
|
||||
msg = 'Unable to export the results for Tally ID={0} since the ' \
|
||||
msg = 'Unable to export the results for Tally ID="{0}" since the ' \
|
||||
'append parameter is not True/False'.format(self.id, append)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -2218,7 +2218,7 @@ class TalliesFile(object):
|
|||
"""
|
||||
|
||||
if not isinstance(tally, Tally):
|
||||
msg = 'Unable to add a non-Tally {0} to the TalliesFile'.format(tally)
|
||||
msg = 'Unable to add a non-Tally "{0}" to the TalliesFile'.format(tally)
|
||||
raise ValueError(msg)
|
||||
|
||||
if merge:
|
||||
|
|
@ -2289,7 +2289,7 @@ class TalliesFile(object):
|
|||
"""
|
||||
|
||||
if not isinstance(mesh, Mesh):
|
||||
msg = 'Unable to add a non-Mesh {0} to the TalliesFile'.format(mesh)
|
||||
msg = 'Unable to add a non-Mesh "{0}" to the TalliesFile'.format(mesh)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._meshes.append(mesh)
|
||||
|
|
@ -2333,4 +2333,4 @@ class TalliesFile(object):
|
|||
# Write the XML Tree to the tallies.xml file
|
||||
tree = ET.ElementTree(self._tallies_file)
|
||||
tree.write("tallies.xml", xml_declaration=True,
|
||||
encoding='utf-8', method="xml")
|
||||
encoding='utf-8', method="xml")
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ class Cell(object):
|
|||
if fill.strip().lower() == 'void':
|
||||
self._type = 'void'
|
||||
else:
|
||||
msg = 'Unable to set Cell ID={0} to use a non-Material or ' \
|
||||
'Universe fill {1}'.format(self._id, fill)
|
||||
msg = 'Unable to set Cell ID="{0}" to use a non-Material or ' \
|
||||
'Universe fill "{1}"'.format(self._id, fill)
|
||||
raise ValueError(msg)
|
||||
|
||||
elif isinstance(fill, openmc.Material):
|
||||
|
|
@ -140,8 +140,8 @@ class Cell(object):
|
|||
self._type = 'lattice'
|
||||
|
||||
else:
|
||||
msg = 'Unable to set Cell ID={0} to use a non-Material or ' \
|
||||
'Universe fill {1}'.format(self._id, fill)
|
||||
msg = 'Unable to set Cell ID="{0}" to use a non-Material or ' \
|
||||
'Universe fill "{1}"'.format(self._id, fill)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._fill = fill
|
||||
|
|
@ -177,13 +177,13 @@ class Cell(object):
|
|||
"""
|
||||
|
||||
if not isinstance(surface, openmc.Surface):
|
||||
msg = 'Unable to add Surface {0} to Cell ID={1} since it is ' \
|
||||
msg = 'Unable to add Surface "{0}" to Cell ID="{1}" since it is ' \
|
||||
'not a Surface object'.format(surface, self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
if halfspace not in [-1, +1]:
|
||||
msg = 'Unable to add Surface {0} to Cell ID={1} with halfspace ' \
|
||||
'{2} since it is not +/-1'.format(surface, self._id, halfspace)
|
||||
msg = 'Unable to add Surface "{0}" to Cell ID="{1}" with halfspace ' \
|
||||
'"{2}" since it is not +/-1'.format(surface, self._id, halfspace)
|
||||
raise ValueError(msg)
|
||||
|
||||
# If the Cell does not already contain the Surface, add it
|
||||
|
|
@ -201,7 +201,7 @@ class Cell(object):
|
|||
"""
|
||||
|
||||
if not isinstance(surface, openmc.Surface):
|
||||
msg = 'Unable to remove Surface {0} from Cell ID={1} since it is ' \
|
||||
msg = 'Unable to remove Surface "{0}" from Cell ID="{1}" since it is ' \
|
||||
'not a Surface object'.format(surface, self._id)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -452,7 +452,7 @@ class Universe(object):
|
|||
"""
|
||||
|
||||
if not isinstance(cell, Cell):
|
||||
msg = 'Unable to add a Cell to Universe ID={0} since {1} is not ' \
|
||||
msg = 'Unable to add a Cell to Universe ID="{0}" since "{1}" is not ' \
|
||||
'a Cell'.format(self._id, cell)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ class Universe(object):
|
|||
"""
|
||||
|
||||
if not isinstance(cells, Iterable):
|
||||
msg = 'Unable to add Cells to Universe ID={0} since {1} is not ' \
|
||||
msg = 'Unable to add Cells to Universe ID="{0}" since "{1}" is not ' \
|
||||
'iterable'.format(self._id, cells)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ class Universe(object):
|
|||
"""
|
||||
|
||||
if not isinstance(cell, Cell):
|
||||
msg = 'Unable to remove a Cell from Universe ID={0} since {1} is ' \
|
||||
msg = 'Unable to remove a Cell from Universe ID="{0}" since "{1}" is ' \
|
||||
'not a Cell'.format(self._id, cell)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue