def test_normalizing(self): # eGaiT_database/P100_E4_left.dat # A917.csv calibrationLeft = self.tmp.write('left.csv', b"2367.1,2274.9,2271.2\n1871.8,1795.5,1753.1\n1785.8,1684.4,1855.4") # A6DF.csv calibrationRight = self.tmp.write('right.csv', b"2403.5,2254.8,2266.1\n1899.7,1769.3,1773.2\n1835.2, 1709.6,1860.5") # first 12 bytes of P100_E4_left.dat rawRight = shared.Sensorsegment._make([1762, 2155, 2024, 1849, 1713, 1864]) # first 12 bytes of P100_E4_right.dat rawLeft = shared.Sensorsegment._make([1797, 2109, 2013, 1777, 1688, 1850]) # expected left end results resL = shared.Sensorsegment._make([-1.3020391681808998,0.30788485607008736,0.003281219841729923,-3.2222629073599247,1.318198462101761,-1.9772976931527246]) # expected right end results resR = shared.Sensorsegment._make([-1.5466454942437473,0.5888774459320278,0.01765063907486269,5.053094104723528,1.2449652142072833,1.2815818381545223]) sensL = Sensor(shared.Orientation.left, calibrationLeft) sensR = Sensor(shared.Orientation.right, calibrationRight) bar = sensL._normalizeRawSegment(rawLeft) foo = sensR._normalizeRawSegment(rawRight) self.assertEqual(resL, bar) self.assertEqual(resR, foo)
def test_normalizing_return(self): sens = Sensor(shared.Orientation(1).name, self.calibration) foo = shared.Sensorsegment._make([1,2,3,4,5,6]) bar = sens._normalizeRawSegment(foo) self.assertIsInstance(foo, type(foo))