From c29ffa947dd08ab4410c1927729b5d3d1f5195f5 Mon Sep 17 00:00:00 2001 From: Ethan Peterson Date: Fri, 28 Feb 2020 08:03:36 -0500 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Paul Romano --- openmc/surface.py | 6 +++--- tests/unit_tests/test_surface.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openmc/surface.py b/openmc/surface.py index f0198e02b..0909b02a8 100644 --- a/openmc/surface.py +++ b/openmc/surface.py @@ -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: diff --git a/tests/unit_tests/test_surface.py b/tests/unit_tests/test_surface.py index b5e401549..b37dc8f31 100644 --- a/tests/unit_tests/test_surface.py +++ b/tests/unit_tests/test_surface.py @@ -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())