diff --git a/docs/source/io_formats/mgxs_library.rst b/docs/source/io_formats/mgxs_library.rst index e9b59a20f..9262a234e 100644 --- a/docs/source/io_formats/mgxs_library.rst +++ b/docs/source/io_formats/mgxs_library.rst @@ -6,7 +6,7 @@ Multi-Group Cross Section Library Format OpenMC can be run in continuous-energy mode or multi-group mode, provided the nuclear data is available. In continuous-energy mode, the -``cross_sections.xml`` file contains necessary meta-data for each data set, +``cross_sections.xml`` file contains necessary meta-data for each dataset, including the name and a file system location where the complete library can be found. In multi-group mode, the multi-group meta-data and the nuclear data itself is contained within an ``mgxs.h5``. This portion of @@ -89,19 +89,19 @@ Temperature-dependent data, provided for temperature K. cross section. This is a 1-D vector if `representation` is "isotropic", or a 3-D vector if `representation` is "angle" with dimensions of - [groups, azimuthal, polar]. This is only required if the data set + [groups, azimuthal, polar]. This is only required if the dataset is fissionable and fission-tallies are expected to be used. - **kappa-fission** (*double[]* or *double[][][]*) -- Kappa-Fission (energy-release from fission) cross section. This is a 1-D vector if `representation` is "isotropic", or a 3-D vector if `representation` is "angle" with dimensions of - [groups, azimuthal, polar]. This is only required if the data set + [groups, azimuthal, polar]. This is only required if the dataset is fissionable and fission-tallies are expected to be used. - **chi** (*double[]* or *double[][][]*) -- Fission neutron energy spectra. This is a 1-D vector if `representation` is "isotropic", or a 3-D vector if `representation` is "angle" with dimensions of - [groups, azimuthal, polar]. This is only required if the data set + [groups, azimuthal, polar]. This is only required if the dataset is fissionable and fission-tallies are expected to be used. - **nu-fission** (*double[]* to *double[][][][]*) -- Nu-Fission cross section. diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index c4515c969..5535f8485 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -186,14 +186,14 @@ class Library(object): @property def domains(self): - if self._domains == 'all': - if self.domain_type == 'material': + if self._domains is 'all': + if self.domain_type is 'material': return self.openmc_geometry.get_all_materials() elif self.domain_type in ['cell', 'distribcell']: return self.openmc_geometry.get_all_material_cells() - elif self.domain_type == 'universe': + elif self.domain_type is 'universe': return self.openmc_geometry.get_all_universes() - elif self.domain_type == 'mesh': + elif self.domain_type is 'mesh': raise ValueError('Unable to get domains for Mesh domain type') else: raise ValueError('Unable to get domains without a domain type') @@ -265,7 +265,7 @@ class Library(object): @mgxs_types.setter def mgxs_types(self, mgxs_types): all_mgxs_types = openmc.mgxs.MGXS_TYPES + openmc.mgxs.MDGXS_TYPES - if mgxs_types == 'all': + if mgxs_types is 'all': self._mgxs_types = all_mgxs_types else: cv.check_iterable_type('mgxs_types', mgxs_types, basestring) @@ -277,7 +277,7 @@ class Library(object): def by_nuclide(self, by_nuclide): cv.check_type('by_nuclide', by_nuclide, bool) - if by_nuclide == True and self.domain_type == 'mesh': + if by_nuclide == True and self.domain_type is 'mesh': raise ValueError('Unable to create MGXS library by nuclide with ' 'mesh domain') @@ -287,7 +287,7 @@ class Library(object): def domain_type(self, domain_type): cv.check_value('domain type', domain_type, openmc.mgxs.DOMAIN_TYPES) - if self.by_nuclide == True and domain_type == 'mesh': + if self.by_nuclide == True and domain_type is 'mesh': raise ValueError('Unable to create MGXS library by nuclide with ' 'mesh domain') @@ -297,21 +297,21 @@ class Library(object): def domains(self, domains): # Use all materials, cells or universes in the geometry as domains - if domains == 'all': + if domains is 'all': self._domains = domains # User specified a list of material, cell or universe domains else: - if self.domain_type == 'material': + if self.domain_type is 'material': cv.check_iterable_type('domain', domains, openmc.Material) all_domains = self.openmc_geometry.get_all_materials() elif self.domain_type in ['cell', 'distribcell']: cv.check_iterable_type('domain', domains, openmc.Cell) all_domains = self.openmc_geometry.get_all_material_cells() - elif self.domain_type == 'universe': + elif self.domain_type is 'universe': cv.check_iterable_type('domain', domains, openmc.Universe) all_domains = self.openmc_geometry.get_all_universes() - elif self.domain_type == 'mesh': + elif self.domain_type is 'mesh': cv.check_iterable_type('domain', domains, openmc.Mesh) # The mesh and geometry are independent, so set all_domains @@ -355,7 +355,7 @@ class Library(object): def correction(self, correction): cv.check_value('correction', correction, ('P0', None)) - if correction == 'P0' and self.legendre_order > 0: + if correction is 'P0' and self.legendre_order > 0: warn('The P0 correction will be ignored since the scattering ' 'order "{}" is greater than zero'.format(self.legendre_order)) @@ -367,7 +367,7 @@ class Library(object): cv.check_greater_than('legendre_order', legendre_order, 0, equality=True) cv.check_less_than('legendre_order', legendre_order, 10, equality=True) - if self.correction == 'P0' and legendre_order > 0: + if self.correction is 'P0' and legendre_order > 0: msg = 'The P0 correction will be ignored since the scattering ' \ 'order {} is greater than zero'.format(self.legendre_order) warn(msg, RuntimeWarning) @@ -505,7 +505,7 @@ class Library(object): self._openmc_geometry = statepoint.summary.openmc_geometry self._nuclides = statepoint.summary.nuclides - if statepoint.run_mode == 'k-eigenvalue': + if statepoint.run_mode is 'k-eigenvalue': self._keff = statepoint.k_combined[0] # Load tallies for each MGXS for each domain and mgxs type @@ -543,13 +543,13 @@ class Library(object): """ - if self.domain_type == 'material': + if self.domain_type is 'material': cv.check_type('domain', domain, (openmc.Material, Integral)) - elif self.domain_type == 'cell' or self.domain_type == 'distribcell': + elif self.domain_type is 'cell' or self.domain_type is 'distribcell': cv.check_type('domain', domain, (openmc.Cell, Integral)) - elif self.domain_type == 'universe': + elif self.domain_type is 'universe': cv.check_type('domain', domain, (openmc.Universe, Integral)) - elif self.domain_type == 'mesh': + elif self.domain_type is 'mesh': cv.check_type('domain', domain, (openmc.Mesh, Integral)) # Check that requested domain is included in library @@ -662,7 +662,7 @@ class Library(object): # Clone this Library to initialize the subdomain-averaged version subdomain_avg_library = copy.deepcopy(self) - if subdomain_avg_library.domain_type == 'distribcell': + if subdomain_avg_library.domain_type is 'distribcell': subdomain_avg_library.domain_type = 'cell' else: return subdomain_avg_library @@ -671,7 +671,7 @@ class Library(object): for domain in self.domains: for mgxs_type in self.mgxs_types: mgxs = subdomain_avg_library.get_mgxs(domain, mgxs_type) - if mgxs.domain_type == 'distribcell': + if mgxs.domain_type is 'distribcell': avg_mgxs = mgxs.get_subdomain_avg_xs() subdomain_avg_library.all_mgxs[domain.id][mgxs_type] = avg_mgxs @@ -751,7 +751,7 @@ class Library(object): for mgxs_type in self.mgxs_types: mgxs = self.all_mgxs[domain.id][mgxs_type] - if subdomains == 'avg': + if subdomains is 'avg': mgxs = mgxs.get_subdomain_avg_xs() mgxs.build_hdf5_store(filename, directory, xs_type=xs_type, @@ -824,8 +824,9 @@ class Library(object): def get_xsdata(self, domain, xsdata_name, nuclide='total', xs_type='macro', order=None, subdomain=None): """Generates an openmc.XSdata object describing a multi-group cross section - data set for eventual combination in to an openmc.MGXSLibrary object - (i.e., the library). Note that this method does not build an XSdata + dataset for writing to an openmc.MGXSLibrary object. + + Note that this method does not build an XSdata object with nested temperature tables. The temperature of each XSdata object will be left at the default value of 300K. @@ -856,7 +857,7 @@ class Library(object): Returns ------- xsdata : openmc.XSdata - Multi-Group Cross Section data set object. + Multi-Group Cross Section dataset object. Raises ------ @@ -920,7 +921,7 @@ class Library(object): subdomain = [subdomain] # Now get xs data itself - if 'nu-transport' in self.mgxs_types and self.correction == 'P0': + if 'nu-transport' in self.mgxs_types and self.correction is 'P0': mymgxs = self.get_mgxs(domain, 'nu-transport') xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide], subdomains=subdomain) @@ -995,7 +996,7 @@ class Library(object): # scattering multiplication (nu-scatter) must be # accounted for approximately by using an adjusted # absorption cross section. - if 'total' in self.mgxs_types: + if 'total' in self.mgxs_types or 'transport' in self.mgxs_types: for i in range(len(xsdata.temperatures)): xsdata._absorption[i] = \ np.subtract(xsdata._total[i], np.sum( @@ -1005,9 +1006,11 @@ class Library(object): def create_mg_library(self, xs_type='macro', xsdata_names=None): """Creates an openmc.MGXSLibrary object to contain the MGXS data for the - Multi-Group mode of OpenMC. Note that this library will not make use - of nested temperature tables. Every dataset in the library will be - treated as if it was at the same default temperature. + Multi-Group mode of OpenMC. + + Note that this library will not make use of nested temperature tables. + Every dataset in the library will be treated as if it was at the same + default temperature. Parameters ---------- @@ -1053,7 +1056,7 @@ class Library(object): # Initialize file mgxs_file = openmc.MGXSLibrary(self.energy_groups) - if self.domain_type == 'mesh': + if self.domain_type is 'mesh': # Create the xsdata objects and add to the mgxs_file i = 0 for domain in self.domains: @@ -1099,14 +1102,15 @@ class Library(object): def create_mg_mode(self, xsdata_names=None, bc=['reflective'] * 6): """Creates an openmc.MGXSLibrary object to contain the MGXS data for the Multi-Group mode of OpenMC as well as the associated openmc.Materials - and openmc.Geometry objects. The created Geometry is the same as that - used to generate the MGXS data, with the only differences being - modifications to point to newly-created Materials which point to the - multi-group data. This method only creates a macroscopic - MGXS Library even if nuclidic tallies are specified in the Library. - Note that this library will not make use of nested temperature tables. - Every dataset in the library will be treated as if it was at the same - default temperature. + and openmc.Geometry objects. + + The created Geometry is the same as that used to generate the MGXS + data, with the only differences being modifications to point to + newly-created Materials which point to the multi-group data. This + method only creates a macroscopic MGXS Library even if nuclidic tallies + are specified in the Library. Note that this library will not make + use of nested temperature tables. Every dataset in the library will + be treated as if it was at the same default temperature. Parameters ---------- @@ -1155,14 +1159,14 @@ class Library(object): # the multiple meshes could be overlapping or in disparate regions # of the continuous energy model. The next step makes sure there is # only one before continuing. - if self.domain_type == 'mesh': + if self.domain_type is 'mesh': cv.check_length("domains", self.domains, 1, 1) # Get the MGXS File Data mgxs_file = self.create_mg_library('macro', xsdata_names) # Now move on the creating the geometry and assigning materials - if self.domain_type == 'mesh': + if self.domain_type is 'mesh': root = openmc.Universe(name='root', universe_id=0) # Add cells representative of the mesh with reflective BC @@ -1208,13 +1212,13 @@ class Library(object): materials.append(material) # Differentiate Geometry with new Material - if self.domain_type == 'material': + if self.domain_type is 'material': # Fill all appropriate Cells with new Material for cell in all_cells: if cell.fill.id == domain.id: cell.fill = material - elif self.domain_type == 'cell': + elif self.domain_type is 'cell': for cell in all_cells: if cell.id == domain.id: cell.fill = material diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py index 8e6089a1a..67a9b01f4 100644 --- a/openmc/mgxs_library.py +++ b/openmc/mgxs_library.py @@ -242,28 +242,28 @@ class XSdata(object): @property def vector_shape(self): - if self.representation == 'isotropic': + if self.representation is 'isotropic': return (self.energy_groups.num_groups,) - elif self.representation == 'angle': + elif self.representation is 'angle': return (self.num_polar, self.num_azimuthal, self.energy_groups.num_groups) @property def matrix_shape(self): - if self.representation == 'isotropic': + if self.representation is 'isotropic': return (self.energy_groups.num_groups, self.energy_groups.num_groups) - elif self.representation == 'angle': + elif self.representation is 'angle': return (self.num_polar, self.num_azimuthal, self.energy_groups.num_groups, self.energy_groups.num_groups) @property def pn_matrix_shape(self): - if self.representation == 'isotropic': + if self.representation is 'isotropic': return (self.num_orders, self.energy_groups.num_groups, self.energy_groups.num_groups) - elif self.representation == 'angle': + elif self.representation is 'angle': return (self.num_polar, self.num_azimuthal, self.num_orders, self.energy_groups.num_groups, self.energy_groups.num_groups) @@ -297,11 +297,6 @@ class XSdata(object): check_greater_than('atomic_weight_ratio', atomic_weight_ratio, 0.0) self._atomic_weight_ratio = atomic_weight_ratio - @fissionable.setter - def fissionable(self, fissionable): - check_type('fissionable', fissionable, bool) - self._fissionable = fissionable - @temperatures.setter def temperatures(self, temperatures): check_iterable_type('temperatures', temperatures, Real) @@ -374,8 +369,8 @@ class XSdata(object): total: np.ndarray Total Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -389,7 +384,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._total[i] = nptotal def set_absorption(self, absorption, temperature=294.): @@ -401,8 +396,8 @@ class XSdata(object): absorption: np.ndarray Absorption Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -417,7 +412,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._absorption[i] = npabsorption def set_fission(self, fission, temperature=294.): @@ -429,8 +424,8 @@ class XSdata(object): fission: np.ndarray Fission Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -444,7 +439,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._fission[i] = npfission if np.sum(npfission) > 0.0: @@ -459,8 +454,8 @@ class XSdata(object): kappa_fission: np.ndarray Kappa-Fission Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -476,7 +471,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._kappa_fission[i] = npkappa_fission if np.sum(npkappa_fission) > 0.0: @@ -491,8 +486,8 @@ class XSdata(object): chi: np.ndarray Fission Spectrum temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -515,7 +510,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._chi[i] = npchi if self.use_chi is not None: @@ -530,8 +525,8 @@ class XSdata(object): scatter: np.ndarray Scattering Matrix Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -546,7 +541,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._scatter_matrix[i] = npscatter def set_multiplicity_matrix(self, multiplicity, temperature=294.): @@ -558,8 +553,8 @@ class XSdata(object): multiplicity: np.ndarray Multiplicity Matrix Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -575,7 +570,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._multiplicity_matrix[i] = npmultiplicity def set_nu_fission(self, nu_fission, temperature=294.): @@ -587,8 +582,8 @@ class XSdata(object): nu_fission: np.ndarray Nu-fission Cross Section temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). See also -------- @@ -630,7 +625,7 @@ class XSdata(object): else: self.use_chi = False - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._nu_fission[i] = npnu_fission if np.sum(npnu_fission) > 0.0: self._fissionable = True @@ -644,8 +639,8 @@ class XSdata(object): inv_vel: np.ndarray Inverse velocities in units of sec/cm. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). """ check_type('inverse velocities', inv_vel, Iterable, @@ -657,7 +652,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) self._inverse_velocities[i] = npinv_vel def set_total_mgxs(self, total, temperature=294., nuclide='total', @@ -672,8 +667,8 @@ class XSdata(object): MGXS Object containing the total or transport cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -699,7 +694,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': self._total[i] = total.get_xs(nuclides=nuclide, xs_type=xs_type, subdomains=subdomain) @@ -718,8 +713,8 @@ class XSdata(object): MGXS Object containing the absorption cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -745,7 +740,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': self._absorption[i] = absorption.get_xs(nuclides=nuclide, xs_type=xs_type, @@ -765,8 +760,8 @@ class XSdata(object): MGXS Object containing the fission cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -792,7 +787,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': self._fission[i] = fission.get_xs(nuclides=nuclide, xs_type=xs_type, @@ -812,8 +807,8 @@ class XSdata(object): MGXS Object containing the nu-fission cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -840,7 +835,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': self._nu_fission[i] = nu_fission.get_xs(nuclides=nuclide, xs_type=xs_type, @@ -870,8 +865,8 @@ class XSdata(object): MGXS Object containing the kappa-fission cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -897,7 +892,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': self._kappa_fission[i] = k_fission.get_xs(nuclides=nuclide, xs_type=xs_type, @@ -916,8 +911,8 @@ class XSdata(object): chi: openmc.mgxs.Chi MGXS Object containing chi for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -948,7 +943,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': self._chi[i] = chi.get_xs(nuclides=nuclide, xs_type=xs_type, subdomains=subdomain) @@ -973,8 +968,8 @@ class XSdata(object): MGXS Object containing the scatter matrix cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -1000,7 +995,7 @@ class XSdata(object): check_type('temperature', temperature, Real) check_value('temperature', temperature, self.temperatures) - if (self.scatter_format != 'legendre'): + if self.scatter_format is not 'legendre': msg = 'Anisotropic scattering representations other than ' \ 'Legendre expansions have not yet been implemented in ' \ 'openmc.mgxs.' @@ -1016,7 +1011,7 @@ class XSdata(object): check_value('legendre_order', scatter.legendre_order, [self.order]) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': # Get the scattering orders in the outermost dimension self._scatter_matrix[i] = np.zeros((self.num_orders, @@ -1054,8 +1049,8 @@ class XSdata(object): MGXS Object containing the scattering matrix cross section for the domain of interest. temperature : float - Temperature (in units of Kelvin) of the provided dataset. Defaults - to 294K + Temperature (in Kelvin) of the data. Defaults to room temperature + (294K). nuclide : str Individual nuclide (or 'total' if obtaining material-wise data) to gather data for. Defaults to 'total'. @@ -1094,7 +1089,7 @@ class XSdata(object): check_value('domain_type', scatter.domain_type, ['universe', 'cell', 'material', 'mesh']) - i = self.temperatures.tolist().index(temperature) + i = np.where(self.temperatures == temperature) if self.representation is 'isotropic': nuscatt = nuscatter.get_xs(nuclides=nuclide, xs_type=xs_type, moment=0, @@ -1129,7 +1124,7 @@ class XSdata(object): if self.representation is not None: grp.attrs['representation'] = np.array(self.representation, dtype='S') - if self.representation == 'angle': + if self.representation is 'angle': if self.num_azimuthal is not None: grp.attrs['num_azimuthal'] = self.num_azimuthal if self.num_polar is not None: @@ -1176,7 +1171,7 @@ class XSdata(object): # Get the sparse scattering data to print to the library G = self.energy_groups.num_groups - if self.representation == 'isotropic': + if self.representation is 'isotropic': g_out_bounds = np.zeros((G, 2), dtype=np.int) for g_in in range(G): nz = np.nonzero(self._scatter_matrix[i][0, g_in, :]) @@ -1212,7 +1207,7 @@ class XSdata(object): scatt_grp.create_dataset("g_min", data=g_out_bounds[:, 0]) scatt_grp.create_dataset("g_max", data=g_out_bounds[:, 1]) - elif self.representation == 'angle': + elif self.representation is 'angle': Np = self.num_polar Na = self.num_azimuthal g_out_bounds = np.zeros((Np, Na, G, 2), dtype=np.int) diff --git a/scripts/openmc-update-mgxs b/scripts/openmc-update-mgxs index f16ad9d1b..6122ff626 100755 --- a/scripts/openmc-update-mgxs +++ b/scripts/openmc-update-mgxs @@ -51,10 +51,10 @@ def parse_args(): help='HDF5 Compression Level') args = vars(parser.parse_args()) - if args['output'] == '': + if args['output'] is '': filename = args['input'].name extension = filenameos.path.splitext() - if extension == '.xml': + if extension is '.xml': filename = filename[:filename.rfind('.')] + '.h5' args['output'] = filename @@ -75,7 +75,7 @@ def get_data(element, entry): return value -if __name__ == '__main__': +if __name__ is '__main__': args = parse_args() # Parse the XML data. @@ -117,7 +117,7 @@ if __name__ == '__main__': representation = get_data(xsdata_elem, 'representation') if representation is None: representation = 'isotropic' - if representation == 'angle': + if representation is 'angle': n_azi = int(get_data(xsdata_elem, 'num_azimuthal')) n_pol = int(get_data(xsdata_elem, 'num_polar')) @@ -146,14 +146,14 @@ if __name__ == '__main__': representation=representation)) if awr is not None: xsd[-1].atomic_weight_ratio = awr - if representation == 'angle': + if representation is 'angle': xsd[-1].num_azimuthal = n_azi xsd[-1].num_polar = n_pol xsd[-1].scatter_format = scatter_format xsd[-1].order = order names.append(name) - if scatter_format == 'legendre': + if scatter_format is 'legendre': order_dim = order + 1 else: order_dim = order diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 8d5628567..fd8a33c68 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -4673,7 +4673,7 @@ contains libraries(i) % materials(1) = names(i) end do - ! Close MGXS HDF file + ! Close MGXS HDF5 file call file_close(file_id) end subroutine read_mg_cross_sections_header