def test_merge_segments(): """ """ trajs = Trajectories(data.brownian_trajs_df()) trajs.reset_index(inplace=True) trajs.loc[15, ['label']] = 88 trajs.loc[20, ['label']] = 88 trajs.set_index(['t_stamp', 'label'], inplace=True) new_trajs = trajs.merge_segments([0, 88], inplace=False) assert_array_almost_equal(trajs.values, new_trajs.values) trajs = Trajectories(data.brownian_trajs_df()) good_trajs = trajs.copy() trajs.reset_index(inplace=True) trajs.loc[15, ['label']] = 88 trajs.loc[20, ['label']] = 88 trajs.set_index(['t_stamp', 'label'], inplace=True) trajs.merge_segments([0, 88], inplace=True) assert_array_almost_equal(trajs.values, good_trajs.values)
def test_copy(): trajs = data.brownian_trajs_df() trajs = Trajectories(trajs) assert isinstance(trajs.copy(), Trajectories)