Apply suggestions from code review

Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Ethan Peterson 2020-02-28 08:03:36 -05:00 committed by GitHub
parent c88bd49597
commit c29ffa947d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -541,9 +541,9 @@ class PlaneMixin(metaclass=ABCMeta):
def rotate(self, rotation, pivot=(0., 0., 0.), order='xyz', inplace=False):
pivot = np.asarray(pivot)
rotation = np.asarray(rotation)
rotation = np.asarray(rotation, dtype=float)
# Allow rotaiton matrix to be passed in directly, otherwise build it
# Allow rotation matrix to be passed in directly, otherwise build it
if rotation.ndim == 2:
check_type('surface rotation', rotation, Iterable, Real)
check_length('surface rotation', rotation.ravel(), 9)
@ -1108,7 +1108,7 @@ class QuadricMixin(metaclass=ABCMeta):
def rotate(self, rotation, pivot=(0., 0., 0.), order='xyz', inplace=False):
# Get pivot and rotation matrix
pivot = np.asarray(pivot)
rotation = np.asarray(rotation)
rotation = np.asarray(rotation, dtype=float)
# Allow rotaiton matrix to be passed in directly, otherwise build it
if rotation.ndim == 2:

View file

@ -39,12 +39,12 @@ def test_plane():
# rotate method
yp = openmc.YPlane(abs(s.d)/math.sqrt(s.a**2 + s.b**2 + s.c**2))
psi = math.degrees(np.arctan2(1, 2))
phi = math.degrees(np.arctan2(1, np.sqrt(5)))
psi = math.degrees(math.atan2(1, 2))
phi = math.degrees(math.atan2(1, math.sqrt(5)))
sr = s.rotate((phi, 0., psi), order='zyx')
assert yp.normalize() == pytest.approx(sr.normalize())
# test rotation ordering
phi = math.degrees(np.arctan2(1, np.sqrt(2)))
phi = math.degrees(math.atan2(1, math.sqrt(2)))
sr = s.rotate((0., -45., phi), order='xyz')
assert yp.normalize() == pytest.approx(sr.normalize())