示例#1
0
 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')
示例#2
0
 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)
示例#3
0
 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))
示例#4
0
 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])
示例#5
0
 def test_constructor_with_one_dim(self):
     a = ma.TimeSequence('ba',1,10,200,0.0,-1,'foo');
     self.assertEqual(a.elements(), 10);
示例#6
0
 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))
示例#7
0
 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)
示例#8
0
 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]);