Example #1
0
 def test_subtract_zero_drift(self):
     N = 10
     drift = DataFrame(np.zeros((N - 1, 2)), 
                       index=np.arange(1, N)).astype('float64')
     drift.columns = ['x', 'y']
     drift.index.name = 'frame'
     actual = mr.subtract_drift(self.dead_still, drift)
     assert_frame_equal(actual, self.dead_still)
     actual = mr.subtract_drift(self.many_walks, drift)
     assert_frame_equal(actual, self.many_walks)
     actual = mr.subtract_drift(self.steppers, drift)
     assert_frame_equal(actual, self.steppers)
Example #2
0
 def test_subtract_constant_drift(self):
     N = 10
     # Add a constant drift here, and then use subtract_drift to 
     # subtract it.
     drift = DataFrame(np.outer(np.arange(N - 1), [1, 1]), 
                       index=np.arange(1, N))
     drift.columns = ['x', 'y']
     drift.index.name = 'frame'
     actual = mr.subtract_drift(
         self.dead_still.add(drift, fill_value=0), drift)
     assert_frame_equal(actual, self.dead_still)
     actual = mr.subtract_drift(
         self.many_walks.add(drift, fill_value=0), drift)
     assert_frame_equal(actual, self.many_walks)
     actual = mr.subtract_drift(
         self.steppers.add(drift, fill_value=0), drift)
     assert_frame_equal(actual, self.steppers)