From bf2fd07baa89bf549ea08bb799fa2ee4fc370dcd Mon Sep 17 00:00:00 2001
From: Kelvin <krodriguez@usgs.gov>
Date: Fri, 17 Jan 2025 11:35:49 -0700
Subject: [PATCH] revert the revert

---
 ale/rotation.py                          | 34 ++++++++++++------------
 tests/pytests/data/isds/dawnvir_isd.json |  8 +++---
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/ale/rotation.py b/ale/rotation.py
index d511117..eaded57 100644
--- a/ale/rotation.py
+++ b/ale/rotation.py
@@ -198,23 +198,23 @@ class TimeDependentRotation:
         """
         quats = self._rots.as_quat()
 
-        # # First find the largest magnitude quaternion coefficient and its coordinate
-        # num_quats = len(quats)
-        # max_q = 0.0
-        # max_j = 0
-        # for i in range(num_quats):
-        #     for j in range(4):
-        #         if abs(quats[i][j]) > abs(max_q):
-        #             max_q = quats[i][j]
-        #             max_j = j
-
-        # # Ensure the signs are consistent
-        # qcnt = 0
-        # for i in range(num_quats):
-        #     if quats[i][max_j] * max_q < 0:
-        #         qcnt = qcnt + 1
-        #         for j in range(4):
-        #             quats[i][j] *= -1.0
+        # First find the largest magnitude quaternion coefficient and its coordinate
+        num_quats = len(quats)
+        max_q = 0.0
+        max_j = 0
+        for i in range(num_quats):
+            for j in range(4):
+                if abs(quats[i][j]) > abs(max_q):
+                    max_q = quats[i][j]
+                    max_j = j
+
+        # Ensure the signs are consistent
+        qcnt = 0
+        for i in range(num_quats):
+            if quats[i][max_j] * max_q < 0:
+                qcnt = qcnt + 1
+                for j in range(4):
+                    quats[i][j] *= -1.0
 
         return quats
 
diff --git a/tests/pytests/data/isds/dawnvir_isd.json b/tests/pytests/data/isds/dawnvir_isd.json
index 90674bb..01c3df4 100644
--- a/tests/pytests/data/isds/dawnvir_isd.json
+++ b/tests/pytests/data/isds/dawnvir_isd.json
@@ -339,10 +339,10 @@
     ],
     "quaternions": [
       [
-        -0.08339426680875163,
-        0.2825790922154143,
-        -0.2899354389711647,
-        0.9105667982826637
+        0.08339426680875163,
+        -0.2825790922154143,
+        0.2899354389711647,
+        -0.9105667982826637
       ],
       [
         -0.05753008804150366,
-- 
GitLab