Пример #1
0
 def testNumpyMaskedArray(self):
     datasets = [
         [1,2,1,2,1,2],
         [5,2,1,2,1,2],
         [100,2,1,2,1,2]
     ]
     for data in datasets:
         np_movement = np.array(data)
         masked_movement = np.ma.masked_array(np_movement, np_movement==1)
         integ = utils.integ_from_movement(masked_movement)
         np.testing.assert_array_equal(integ.compressed(), [0, 2, 4, 6])
         np.testing.assert_array_equal(integ, np.ma.masked_array([0,2,2000,4,2000,6], mask=[0,0,1,0,1,0]))
Пример #2
0
 def testNormal(self):
     np.testing.assert_array_equal(utils.integ_from_movement([1,2,1,2,1,2]), [0,2,3,5,6,8])
     np.testing.assert_array_equal(utils.integ_from_movement([5,2,1,2,1,2]), [0,2,3,5,6,8])
     np.testing.assert_array_equal(utils.integ_from_movement([100,2,1,2,1,2]), [0,2,3,5,6,8])
Пример #3
0
 def testNumpyArray(self):   
     np.testing.assert_array_equal(utils.integ_from_movement(np.array([1,2,1,2,1,2])), [0,2,3,5,6,8])
     np.testing.assert_array_equal(utils.integ_from_movement(np.array([5,2,1,2,1,2])), [0,2,3,5,6,8])
     np.testing.assert_array_equal(utils.integ_from_movement(np.array([100,2,1,2,1,2])), [0,2,3,5,6,8])