Skip to content

Commit

Permalink
set seeds for the coord utils test
Browse files Browse the repository at this point in the history
  • Loading branch information
lheagy committed Nov 10, 2015
1 parent 4a5a0a3 commit b7be386
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/utils/test_coordutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@
class coorUtilsTest(unittest.TestCase):

def test_rotationMatrixFromNormals(self):
np.random.seed(0)
v0 = np.random.rand(3)
v0 *= 1./np.linalg.norm(v0)

np.random.seed(5)
v1 = np.random.rand(3)
v1 *= 1./np.linalg.norm(v1)

Rf = Utils.coordutils.rotationMatrixFromNormals(v0,v1)
Ri = Utils.coordutils.rotationMatrixFromNormals(v1,v0)

self.assertTrue(np.linalg.norm(Utils.mkvc(Rf.dot(v0) - v1)) < tol)
self.assertTrue(np.linalg.norm(Utils.mkvc(Ri.dot(v1) - v0)) < tol)

def test_rotatePointsFromNormals(self):
np.random.seed(10)
v0 = np.random.rand(3)
v0*= 1./np.linalg.norm(v0)

np.random.seed(15)
v1 = np.random.rand(3)
v1*= 1./np.linalg.norm(v1)

Expand All @@ -28,11 +35,15 @@ def test_rotatePointsFromNormals(self):
self.assertTrue(np.linalg.norm(v2-v1) < tol)

def test_rotateMatrixFromNormals(self):
np.random.seed(20)
n0 = np.random.rand(3)
n0*= 1./np.linalg.norm(n0)
n0 *= 1./np.linalg.norm(n0)

np.random.seed(25)
n1 = np.random.rand(3)
n1*= 1./np.linalg.norm(n1)
n1 *= 1./np.linalg.norm(n1)

np.random.seed(30)
scale = np.random.rand(100,1)
XYZ0 = scale * n0
XYZ1 = scale * n1
Expand Down

0 comments on commit b7be386

Please sign in to comment.