def test_linear_emsd(self): A = 1 EARLY = 7 # only early lag times have good stats actual = mr.emsd(self.many_walks, 1, 1, max_lagtime=EARLY) a = np.arange(EARLY, dtype='float64') expected = Series(2*A*a, index=a).iloc[1:] expected.name = 'msd' expected.index.name = 'lag time [s]' # HACK: Float64Index imprecision ruins index equality. # Test them separately. If that works, make them exactly the same. assert_almost_equal(actual.index.values, expected.index.values) actual.index = expected.index assert_series_equal(np.round(actual), expected)
def test_zero_emsd(self): N = 10 actual = mr.emsd(self.dead_still, 1, 1) expected = Series(np.zeros(N)).iloc[1:].astype('float64') assert_series_equal(actual, expected)