Example #1
0
def test_epochs_plot():
    """Test plotting of epochs"""
    tmin, tmax, event_id = -0.5, 1.5, 999
    # create some evil events
    events = np.array([[1000, 999], [2000, 999], [3000, 999]])
    for fname in fnames:
        raw = Raw(fname)
        epochs = Epochs(raw, events, event_id, tmin, tmax)
        assert_raises(ValueError, epochs.plot, picks=['whatever'])
        epochs.plot(picks=['ps'])
        fig = epochs.plot(n_chunks=2)

    # test clicking: find our callbacks
    for func in fig.canvas.callbacks.callbacks['button_press_event'].items():
        func = func[1].func
        if isinstance(func, partial):
            break
    params = func.keywords['params']
    for ax in fig.axes:
        _epochs_axes_onclick(DummyEvent(ax), params)

    # nav clicking
    _epochs_navigation_onclick(DummyEvent(params['next'].ax), params)
    _epochs_navigation_onclick(DummyEvent(params['back'].ax), params)
    _epochs_navigation_onclick(DummyEvent(params['reject-quit'].ax), params)
Example #2
0
def test_epochs_plot():
    """Test plotting of epochs"""
    tmin, tmax, event_id = -0.5, 1.5, 999
    # create some evil events
    events = np.array([[1000, 999], [2000, 999], [3000, 999]])
    for fname in fnames:
        raw = read_raw(fname)
        epochs = Epochs(raw, events, event_id, tmin, tmax)
        assert_raises(ValueError, epochs.plot, picks=['whatever'])
        epochs.plot(picks=['ps'])
        fig = epochs.plot(n_chunks=2)
        epochs.plot(draw_discrete='saccades')

    # test clicking: find our callbacks
    for func in fig.canvas.callbacks.callbacks['button_press_event'].items():
        func = func[1].func
        if isinstance(func, partial):
            break
    params = func.keywords['params']
    for ax in fig.axes:
        _epochs_axes_onclick(DummyEvent(ax), params)

    # nav clicking
    _epochs_navigation_onclick(DummyEvent(params['next'].ax), params)
    _epochs_navigation_onclick(DummyEvent(params['back'].ax), params)
    _epochs_navigation_onclick(DummyEvent(params['reject-quit'].ax), params)