Example #1
0
def test_hkernel():
    """ test the hrf computation
    """
    tr = 2.0
    h = _hrf_kernel('spm', tr)
    assert_almost_equal(h[0], spm_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('spm + derivative', tr)
    assert_almost_equal(h[1], spm_time_derivative(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('spm + derivative + dispersion', tr)
    assert_almost_equal(h[2], spm_dispersion_derivative(tr))
    assert_equal(len(h), 3)
    h = _hrf_kernel('glover', tr)
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('glover + derivative', tr)
    assert_almost_equal(h[1], glover_time_derivative(tr))
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('fir', tr, fir_delays=np.arange(4))
    assert_equal(len(h), 4)
    for dh in h:
        assert_equal(dh.sum(), 50.)
    #
    h = _hrf_kernel(None, tr)
    assert_equal(len(h), 1)
    assert_almost_equal(h[0], np.hstack((1, np.zeros(49))))
def test_hkernel():
    """ test the hrf computation
    """
    tr = 2.0
    h = _hrf_kernel('spm', tr)
    assert_almost_equal(h[0], spm_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('spm + derivative', tr)
    assert_almost_equal(h[1], spm_time_derivative(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('spm + derivative + dispersion', tr)
    assert_almost_equal(h[2], spm_dispersion_derivative(tr))
    assert_equal(len(h), 3)
    h = _hrf_kernel('glover', tr)
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('glover + derivative', tr)
    assert_almost_equal(h[1], glover_time_derivative(tr))
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('fir', tr, fir_delays=np.arange(4))
    assert_equal(len(h), 4)
    for dh in h:
        assert_equal(dh.sum(), 50.)
    # 
    h = _hrf_kernel(None, tr)
    assert_equal(len(h), 1)
    assert_almost_equal(h[0], np.hstack((1, np.zeros(49))))
Example #3
0
def test_spm_hrf_derivative():
    """ test that the spm_hrf is correctly normalized and has correct length
    """
    h = spm_time_derivative(2.0)
    assert_almost_equal(h.sum(), 0)
    assert_equal(len(h), 800)
    h = spm_dispersion_derivative(2.0)
    assert_almost_equal(h.sum(), 0)
    assert_equal(len(h), 800)
def test_spm_hrf_derivative():
    """ test that the spm_hrf is correctly normalized and has correct length
    """
    h = spm_time_derivative(2.0)
    assert_almost_equal(h.sum(), 0)
    assert_equal(len(h), 800)
    h = spm_dispersion_derivative(2.0)
    assert_almost_equal(h.sum(), 0)
    assert_equal(len(h), 800)
def test_hkernel():
    """ test the hrf computation
    """
    tr = 2.0
    h = _hrf_kernel('spm', tr)
    assert_almost_equal(h[0], spm_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('spm_time', tr)
    assert_almost_equal(h[1], spm_time_derivative(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('spm_time_dispersion', tr)
    assert_almost_equal(h[2], spm_dispersion_derivative(tr))
    assert_equal(len(h), 3)
    h = _hrf_kernel('canonical', tr)
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('canonical with derivative', tr)
    assert_almost_equal(h[1], glover_time_derivative(tr))
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('fir', tr, fir_delays=np.arange(4))
    assert_equal(len(h), 4)
    for dh in h:
        assert_equal(dh.sum(), 16.)
def test_hkernel():
    """ test the hrf computation
    """
    tr = 2.0
    h = _hrf_kernel('spm', tr)
    assert_almost_equal(h[0], spm_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('spm_time', tr)
    assert_almost_equal(h[1], spm_time_derivative(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('spm_time_dispersion', tr)
    assert_almost_equal(h[2], spm_dispersion_derivative(tr))
    assert_equal(len(h), 3)
    h = _hrf_kernel('canonical', tr)
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel('canonical with derivative', tr)
    assert_almost_equal(h[1], glover_time_derivative(tr))
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel('fir', tr, fir_delays=np.arange(4))
    assert_equal(len(h), 4)
    for dh in h:
        assert_equal(dh.sum(), 16.)
def test_hkernel():
    """ test the hrf computation
    """
    tr = 2.0
    h = _hrf_kernel("spm", tr)
    assert_almost_equal(h[0], spm_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel("spm + derivative", tr)
    assert_almost_equal(h[1], spm_time_derivative(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel("spm + derivative + dispersion", tr)
    assert_almost_equal(h[2], spm_dispersion_derivative(tr))
    assert_equal(len(h), 3)
    h = _hrf_kernel("glover", tr)
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 1)
    h = _hrf_kernel("glover + derivative", tr)
    assert_almost_equal(h[1], glover_time_derivative(tr))
    assert_almost_equal(h[0], glover_hrf(tr))
    assert_equal(len(h), 2)
    h = _hrf_kernel("fir", tr, fir_delays=np.arange(4))
    assert_equal(len(h), 4)
    for dh in h:
        assert_equal(dh.sum(), 16.0)