diff --git a/docs/source/conf.py b/docs/source/conf.py index 9330315903..b97ff782d9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -27,8 +27,9 @@ except ImportError: MOCK_MODULES = ['numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial', 'numpy.ctypeslib', 'scipy', 'scipy.sparse', 'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.special', - 'scipy.stats', 'h5py', 'pandas', 'uncertainties', 'matplotlib', - 'matplotlib.pyplot','openmoc', 'openmc.data.reconstruct'] + 'scipy.stats', 'scipy.spatial', 'h5py', 'pandas', 'uncertainties', + 'matplotlib', 'matplotlib.pyplot','openmoc', + 'openmc.data.reconstruct'] sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES) import numpy as np diff --git a/openmc/lattice.py b/openmc/lattice.py index 730d7dc4a9..89cfcfe52c 100644 --- a/openmc/lattice.py +++ b/openmc/lattice.py @@ -607,12 +607,12 @@ class RectLattice(Lattice): element coordinate system """ - ix = floor((point[0] - self.lower_left[0])/self.pitch[0]) - iy = floor((point[1] - self.lower_left[1])/self.pitch[1]) + ix = int(floor((point[0] - self.lower_left[0])/self.pitch[0])) + iy = int(floor((point[1] - self.lower_left[1])/self.pitch[1])) if self.ndim == 2: idx = (ix, iy) else: - iz = floor((point[2] - self.lower_left[2])/self.pitch[2]) + iz = int(floor((point[2] - self.lower_left[2])/self.pitch[2])) idx = (ix, iy, iz) return idx, self.get_local_coordinates(point, idx) @@ -1019,10 +1019,10 @@ class HexLattice(Lattice): iz = 1 else: z = point[2] - self.center[2] - iz = floor(z/self.pitch[1] + 0.5*self.num_axial) + iz = int(floor(z/self.pitch[1] + 0.5*self.num_axial)) alpha = y - x/sqrt(3.) - ix = floor(x/(sqrt(0.75) * self.pitch[0])) - ia = floor(alpha/self.pitch[0]) + ix = int(floor(x/(sqrt(0.75) * self.pitch[0]))) + ia = int(floor(alpha/self.pitch[0])) # Check four lattice elements to see which one is closest based on local # coordinates diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index a557e51cc1..0c0b15ad9d 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -10,6 +10,7 @@ import itertools from six import add_metaclass, string_types import numpy as np +import h5py import openmc import openmc.checkvalue as cv @@ -1682,13 +1683,8 @@ class MGXS(object): ValueError When this method is called before the multi-group cross section is computed from tally data. - ImportError - When h5py is not installed. """ - - import h5py - # Make directory if it does not exist if not os.path.exists(directory): os.makedirs(directory) diff --git a/openmc/model/triso.py b/openmc/model/triso.py index 67bf3bc442..7258a86f21 100644 --- a/openmc/model/triso.py +++ b/openmc/model/triso.py @@ -12,11 +12,7 @@ from abc import ABCMeta, abstractproperty, abstractmethod from six import add_metaclass import numpy as np -try: - import scipy.spatial - _SCIPY_AVAILABLE = True -except ImportError: - _SCIPY_AVAILABLE = False +import scipy.spatial import openmc import openmc.checkvalue as cv @@ -742,7 +738,7 @@ def _close_random_pack(domain, particles, contraction_rate): outer_pf = (4/3 * pi * (outer_diameter[0]/2)**3 * n_particles / domain.volume) - j = floor(-log10(outer_pf - inner_pf)) + j = int(floor(-log10(outer_pf - inner_pf))) outer_diameter[0] = (outer_diameter[0] - 0.5**j * contraction_rate * initial_outer_diameter / n_particles) @@ -837,10 +833,6 @@ def _close_random_pack(domain, particles, contraction_rate): if rods: inner_diameter[0] = rods[0][0] - if not _SCIPY_AVAILABLE: - raise ImportError('SciPy must be installed to perform ' - 'close random packing.') - n_particles = len(particles) diameter = 2*domain.particle_radius diff --git a/openmc/tallies.py b/openmc/tallies.py index 235ad2472e..b685dcae39 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -1508,8 +1508,6 @@ class Tally(IDManagerMixin): ------ KeyError When this method is called before the Tally is populated with data - ImportError - When Pandas can not be found on the caller's system """