def test_events():
    'Tests that expected events are created by MOTAccumulator.update().'
    acc = mm.MOTAccumulator()
    acc.update([], [1, 2], [], frameid=0)
    acc.update([1, 2], [], [], frameid=1)
    acc.update([1, 2], [1, 2], [[1, 0.5], [0.3, 1]], frameid=2)
    acc.update([1, 2], [1, 2], [[0.2, np.nan], [np.nan, 0.1]], frameid=3)
    acc.update([1, 2], [1, 2], [[5, 1], [1, 5]], frameid=4)
    acc.update([], [], [], frameid=5)
    expect = mm.MOTAccumulator.new_event_dataframe()
    expect.loc[(0, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(0, 1), :] = ['RAW', np.nan, 1, np.nan]
    expect.loc[(0, 2), :] = ['RAW', np.nan, 2, np.nan]
    expect.loc[(0, 3), :] = ['FP', np.nan, 1, np.nan]
    expect.loc[(0, 4), :] = ['FP', np.nan, 2, np.nan]
    expect.loc[(1, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(1, 1), :] = ['RAW', 1, np.nan, np.nan]
    expect.loc[(1, 2), :] = ['RAW', 2, np.nan, np.nan]
    expect.loc[(1, 3), :] = ['MISS', 1, np.nan, np.nan]
    expect.loc[(1, 4), :] = ['MISS', 2, np.nan, np.nan]
    expect.loc[(2, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(2, 1), :] = ['RAW', 1, 1, 1.0]
    expect.loc[(2, 2), :] = ['RAW', 1, 2, 0.5]
    expect.loc[(2, 3), :] = ['RAW', 2, 1, 0.3]
    expect.loc[(2, 4), :] = ['RAW', 2, 2, 1.0]
    expect.loc[(2, 5), :] = ['MATCH', 1, 2, 0.5]
    expect.loc[(2, 6), :] = ['MATCH', 2, 1, 0.3]
    expect.loc[(3, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(3, 1), :] = ['RAW', 1, 1, 0.2]
    expect.loc[(3, 2), :] = ['RAW', 2, 2, 0.1]
    expect.loc[(3, 3), :] = ['TRANSFER', 1, 1, 0.2]
    expect.loc[(3, 4), :] = ['SWITCH', 1, 1, 0.2]
    expect.loc[(3, 5), :] = ['TRANSFER', 2, 2, 0.1]
    expect.loc[(3, 6), :] = ['SWITCH', 2, 2, 0.1]
    expect.loc[(4, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(4, 1), :] = ['RAW', 1, 1, 5.0]
    expect.loc[(4, 2), :] = ['RAW', 1, 2, 1.0]
    expect.loc[(4, 3), :] = ['RAW', 2, 1, 1.0]
    expect.loc[(4, 4), :] = ['RAW', 2, 2, 5.0]
    expect.loc[(4, 5), :] = ['MATCH', 1, 1, 5.0]
    expect.loc[(4, 6), :] = ['MATCH', 2, 2, 5.0]
    expect.loc[(5, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    pd.util.testing.assert_frame_equal(acc.events, expect)
Tests that expected events are created by MOTAccumulator.update().
def test_events():
    
    acc = mm.MOTAccumulator()
    acc.update([], [1, 2], [], frameid=0)
    acc.update([1, 2], [], [], frameid=1)
    acc.update([1, 2], [1, 2], [[1, 0.5], [0.3, 1]], frameid=2)
    acc.update([1, 2], [1, 2], [[0.2, np.nan], [np.nan, 0.1]], frameid=3)
    acc.update([1, 2], [1, 2], [[5, 1], [1, 5]], frameid=4)
    acc.update([], [], [], frameid=5)
    expect = mm.MOTAccumulator.new_event_dataframe()
    expect.loc[(0, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(0, 1), :] = ['RAW', np.nan, 1, np.nan]
    expect.loc[(0, 2), :] = ['RAW', np.nan, 2, np.nan]
    expect.loc[(0, 3), :] = ['FP', np.nan, 1, np.nan]
    expect.loc[(0, 4), :] = ['FP', np.nan, 2, np.nan]
    expect.loc[(1, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(1, 1), :] = ['RAW', 1, np.nan, np.nan]
    expect.loc[(1, 2), :] = ['RAW', 2, np.nan, np.nan]
    expect.loc[(1, 3), :] = ['MISS', 1, np.nan, np.nan]
    expect.loc[(1, 4), :] = ['MISS', 2, np.nan, np.nan]
    expect.loc[(2, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(2, 1), :] = ['RAW', 1, 1, 1.0]
    expect.loc[(2, 2), :] = ['RAW', 1, 2, 0.5]
    expect.loc[(2, 3), :] = ['RAW', 2, 1, 0.3]
    expect.loc[(2, 4), :] = ['RAW', 2, 2, 1.0]
    expect.loc[(2, 5), :] = ['MATCH', 1, 2, 0.5]
    expect.loc[(2, 6), :] = ['MATCH', 2, 1, 0.3]
    expect.loc[(3, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(3, 1), :] = ['RAW', 1, 1, 0.2]
    expect.loc[(3, 2), :] = ['RAW', 2, 2, 0.1]
    expect.loc[(3, 3), :] = ['TRANSFER', 1, 1, 0.2]
    expect.loc[(3, 4), :] = ['SWITCH', 1, 1, 0.2]
    expect.loc[(3, 5), :] = ['TRANSFER', 2, 2, 0.1]
    expect.loc[(3, 6), :] = ['SWITCH', 2, 2, 0.1]
    expect.loc[(4, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    expect.loc[(4, 1), :] = ['RAW', 1, 1, 5.0]
    expect.loc[(4, 2), :] = ['RAW', 1, 2, 1.0]
    expect.loc[(4, 3), :] = ['RAW', 2, 1, 1.0]
    expect.loc[(4, 4), :] = ['RAW', 2, 2, 5.0]
    expect.loc[(4, 5), :] = ['MATCH', 1, 1, 5.0]
    expect.loc[(4, 6), :] = ['MATCH', 2, 2, 5.0]
    expect.loc[(5, 0), :] = ['RAW', np.nan, np.nan, np.nan]
    pd.util.testing.assert_frame_equal(acc.events, expect)