Example #1
0
def test_epochs_deconv():
    """Test epochs deconvolution"""
    tmin, tmax = -0.5, 1.5
    event_dict = dict(foo=999)
    events = np.array([np.arange(0, 21000, 1000, int),
                       999 * np.ones(21, int)]).T
    for fi, fname in enumerate(fnames):
        if fi == 0:
            n_jobs = 1
        else:
            n_jobs = 0
        raw = read_raw(fname)
        epochs = Epochs(raw, events, event_dict, tmin, tmax)
        a = raw.info['sample_fields']
        b = epochs.info['data_cols']
        assert_equal(len(a), len(b))
        assert_true(all(aa == bb for aa, bb in zip(a, b)))
        data = epochs.get_data('ps')
        assert_raises(RuntimeError, Epochs, raw, events, 'test', tmin, tmax)
        fit, times = epochs.deconvolve()
        assert_array_equal(data, epochs.get_data('ps'))
        assert_equal(fit.shape, (len(epochs), len(times)))
        fit, times = epochs.deconvolve(spacing=[-0.1, 0.4, 1.0],
                                       bounds=(0, np.inf),
                                       n_jobs=n_jobs)
        assert_equal(fit.shape, (len(epochs), len(times)))
        assert_equal(len(times), 3)
        if fi == 0:
            if _has_joblib():
                assert_raises(ValueError, epochs.deconvolve, n_jobs=-1000)
Example #2
0
def test_epochs_deconv():
    """Test epochs deconvolution"""
    tmin, tmax = -0.5, 1.5
    event_dict = dict(foo=999)
    events = np.array([np.arange(0, 21000, 1000, int),
                       999 * np.ones(21, int)]).T
    for fi, fname in enumerate(fnames):
        if fi == 0:
            n_jobs = 1
        else:
            n_jobs = 0
        raw = read_raw(fname)
        epochs = Epochs(raw, events, event_dict,
                        tmin, tmax)
        a = raw.info['sample_fields']
        b = epochs.info['data_cols']
        assert_equal(len(a), len(b))
        assert_true(all(aa == bb for aa, bb in zip(a, b)))
        data = epochs.get_data('ps')
        assert_raises(RuntimeError, Epochs, raw, events, 'test', tmin, tmax)
        fit, times = epochs.deconvolve()
        assert_array_equal(data, epochs.get_data('ps'))
        assert_equal(fit.shape, (len(epochs), len(times)))
        fit, times = epochs.deconvolve(spacing=[-0.1, 0.4, 1.0],
                                       bounds=(0, np.inf), n_jobs=n_jobs)
        assert_equal(fit.shape, (len(epochs), len(times)))
        assert_equal(len(times), 3)
        if fi == 0:
            if _has_joblib():
                assert_raises(ValueError, epochs.deconvolve, n_jobs=-1000)