Fix bugs discovered during CNL workshop

This commit is contained in:
Paul Romano 2017-03-15 11:25:24 -04:00
parent 6f854d2dee
commit d938fa0176
5 changed files with 26 additions and 17 deletions

View file

@ -289,9 +289,10 @@ class Cell(object):
c3, s3 = cos(phi), sin(phi)
c2, s2 = cos(theta), sin(theta)
c1, s1 = cos(psi), sin(psi)
return np.array([[c1*c2, c1*s2*s3 - c3*s1, s1*s3 + c1*c3*s2],
[c2*s1, c1*c3 + s1*s2*s3, c3*s1*s2 - c1*s3],
[-s2, c2*s3, c2*c3]])
self._rotation_matrix = np.array([
[c1*c2, c1*s2*s3 - c3*s1, s1*s3 + c1*c3*s2],
[c2*s1, c1*c3 + s1*s2*s3, c3*s1*s2 - c1*s3],
[-s2, c2*s3, c2*c3]])
@translation.setter
def translation(self, translation):

View file

@ -361,18 +361,25 @@ class Geometry(object):
if not case_sensitive:
name = name.lower()
all_cells = self.get_all_cells().values()
cells = set()
for cell in all_cells:
cell_fill_name = cell.fill.name
if not case_sensitive:
cell_fill_name = cell_fill_name.lower()
for cell in self.get_all_cells().values():
names = []
if cell.fill_type in ('material', 'universe', 'lattice'):
names.append(cell.fill.name)
elif cell.fill_type == 'distribmat':
for mat in cell.fill:
if mat is not None:
names.append(mat.name)
if cell_fill_name == name:
cells.add(cell)
elif not matching and name in cell_fill_name:
cells.add(cell)
for fill_name in names:
if not case_sensitive:
fill_name = fill_name.lower()
if fill_name == name:
cells.add(cell)
elif not matching and name in fill_name:
cells.add(cell)
cells = list(cells)
cells.sort(key=lambda x: x.id)

View file

@ -54,7 +54,8 @@ class PolarAzimuthal(UnitSphere):
"""Angular distribution represented by polar and azimuthal angles
This distribution allows one to specify the distribution of the cosine of
the polar angle and the azimuthal angle independently of once another.
the polar angle and the azimuthal angle independently of one another. The
polar angle is measured relative to the reference angle.
Parameters
----------

View file

@ -29,7 +29,7 @@ class TallyDerivative(EqualityMixin):
variable : str, optional
Accepted values are 'density', 'nuclide_density', and 'temperature'
material : int, optional
The perturubed material ID
The perturbed material ID
nuclide : str, optional
The perturbed nuclide. Only needed for 'nuclide_density' derivatives.
Ex: 'Xe135'

View file

@ -246,9 +246,9 @@ class VolumeCalculation(object):
results = type(self).from_hdf5(filename)
# Make sure properties match
assert self.domains == results.domains
assert self.lower_left == results.lower_left
assert self.upper_right == results.upper_right
assert self.ids == results.ids
assert np.all(self.lower_left == results.lower_left)
assert np.all(self.upper_right == results.upper_right)
# Copy results
self.volumes = results.volumes