def constructor_with_two_dims(self): a = ma.TimeSequence('ba', [3, 3], 10, 200, 0.0, -1, 'foo') self.verifyEqual(a.elements(), 90) a = ma.TimeSequence('ba', [int(3), int(3)], 10, 200, 0.0, -1, 'foo') self.verifyEqual(a.elements(), 90) self.assertRaises(ValueError, ma.TimeSequence, 'ba', [3.4, 3.1], 10, 200, 0.0, -1, 'foo')
def data(self): a = ma.TimeSequence('ba', 4, 10, 200, 0.0, ma.TimeSequence.Type_Marker, 'mm') temp = np.random.random(10, 4) a.setData(temp) self.verifyEqual(a.data(), temp)
def data_wrong_dims(self): a = ma.TimeSequence('ba', 4, 10, 200, 0.0, ma.TimeSequence.Type_Marker, 'mm') self.assertRaises(ValueError, a.setData, np.random.random(2, 2))
def range(self): a = ma.TimeSequence('ba', 4, 10, 200, 0.0, ma.TimeSequence.Type_Marker, 'mm') self.verifyEqual(a.range(), [-np.inf, np.inf]) a.setRange([-10, 10]) self.verifyEqual(a.range(), [-10, 10])
def test_constructor_with_one_dim(self): a = ma.TimeSequence('ba',1,10,200,0.0,-1,'foo'); self.assertEqual(a.elements(), 10);
def test_data_wrong_dims(self): a = ma.TimeSequence('ba',4,10,200,0.0,ma.TimeSequence.Type_Position,'mm'); self.assertRaises(ValueError, a.setData, np.random.rand(2,2))
def test_data_bis(self): a = ma.TimeSequence('ba',4,10,200,0.0,ma.TimeSequence.Type_Position,'mm'); temp = np.random.rand(10,4); a.setData(temp); self.assertEqual(np.allclose(a.data(), temp), True)
def test_range(self): a = ma.TimeSequence('ba',4,10,200,0.0,ma.TimeSequence.Type_Position,'mm'); self.assertEqual(a.range(), [-np.inf, np.inf]); a.setRange([-10,10]); self.assertEqual(a.range(), [-10, 10]);