Example #1
0
def test_isc_corrmat_within_correct():
    assert np.allclose(isc_within_diff(D[0:3], D[0:3]), 0)
Example #2
0
def test_isc_corrmat_within_correct():
    assert np.allclose(isc_within_diff(D[0:3], D[0:3]), 0)
Example #3
0
import numpy as np

def test_perm_test_is_permuting():
    np.random.seed(1)
    fun = lambda  A, B: sum(A) - sum(B)
    out = perm([0,0,0,0], [1,1,1,1], fun, nreps=1000)
    assert .010 < np.mean(np.array(out) == 4) < .018

C11 = np.ones([3,3]) * .3
C22 = np.ones([3,3]) * .5
C12 = np.ones([3,3]) * 0 
C = np.hstack([np.vstack([C11, C12]), np.vstack([C12, C22])])
C[np.diag_indices_from(C)] = 1

D = corr_eig(None, 6, 20, C)[1].T
a = isc_within_diff(D[0:3], D[3:])
b = isc_corrmat_within_diff(range(3), range(3, 6), C)
#TODO wrap in setup func or class
def test_isc_within_both_equiv():
    assert np.allclose(a, b)

def test_isc_within_correct():
    assert np.allclose(isc_corrmat_within_diff(range(3), range(3), C), 0)

def test_isc_corrmat_within_correct():
    assert np.allclose(isc_within_diff(D[0:3], D[0:3]), 0)

# this would hold if you were doing actual isc not subject-total corr
#def test_isc_within_correct_diff():
#    assert np.allclose(a, -.2)
#
Example #4
0
def test_perm_test_is_permuting():
    np.random.seed(1)
    fun = lambda A, B: sum(A) - sum(B)
    out = perm([0, 0, 0, 0], [1, 1, 1, 1], fun, nreps=1000)
    assert .010 < np.mean(np.array(out) == 4) < .018


C11 = np.ones([3, 3]) * .3
C22 = np.ones([3, 3]) * .5
C12 = np.ones([3, 3]) * 0
C = np.hstack([np.vstack([C11, C12]), np.vstack([C12, C22])])
C[np.diag_indices_from(C)] = 1

D = corr_eig(None, 6, 20, C)[1].T
a = isc_within_diff(D[0:3], D[3:])
b = isc_corrmat_within_diff(range(3), range(3, 6), C)


#TODO wrap in setup func or class
def test_isc_within_both_equiv():
    assert np.allclose(a, b)


def test_isc_within_correct():
    assert np.allclose(isc_corrmat_within_diff(range(3), range(3), C), 0)


def test_isc_corrmat_within_correct():
    assert np.allclose(isc_within_diff(D[0:3], D[0:3]), 0)