From 68802904c2a526c436bc46b7520fba9519416647 Mon Sep 17 00:00:00 2001 From: Austin Marshall Date: Thu, 9 Apr 2015 21:34:57 -0500 Subject: [PATCH] Cleanup geospatial coordinate encoder unit tests --- tests/unit/nupic/encoders/geospatial_coordinate_test.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit/nupic/encoders/geospatial_coordinate_test.py b/tests/unit/nupic/encoders/geospatial_coordinate_test.py index b1840db1cb..4706d4231e 100755 --- a/tests/unit/nupic/encoders/geospatial_coordinate_test.py +++ b/tests/unit/nupic/encoders/geospatial_coordinate_test.py @@ -134,7 +134,7 @@ def testEncodeIntoArrayAltitude(self): overlap1 = overlap(encoding1, encoding2) overlap2 = overlap(encoding1, encoding3) - self.assertTrue(overlap1 > overlap2) + self.assertGreater(overlap1, overlap2) def testEncodeIntoArray3D(self): @@ -151,7 +151,7 @@ def testEncodeIntoArray3D(self): overlap1 = overlap(encoding1, encoding2) overlap2 = overlap(encoding1, encoding3) - self.assertTrue(overlap1 > overlap2) + self.assertGreater(overlap1, overlap2) def testReadWrite(self): @@ -159,8 +159,8 @@ def testReadWrite(self): timestep = 60 # seconds speed = 2.5 # meters per second original = GeospatialCoordinateEncoder(scale, timestep, n=999, w=25) - encoding1 = encode(original, speed, -122.229194, 37.486782, 0) - encoding2 = encode(original, speed, -122.229294, 37.486882, 100) + encode(original, speed, -122.229194, 37.486782, 0) + encode(original, speed, -122.229294, 37.486882, 100) proto1 = GeospatialCoordinateEncoderProto.new_message() original.write(proto1) @@ -190,6 +190,7 @@ def encode(encoder, speed, longitude, latitude, altitude=None): encoder.encodeIntoArray((speed, longitude, latitude, altitude), output) return output + def overlap(sdr1, sdr2): assert sdr1.size == sdr2.size return float((sdr1 & sdr2).sum()) / sdr1.sum()