예제 #1
0
    ]
    corrs = np.corrcoef(hemi_data)
    subj_data = corrs
    headers = ['%s(%s)' % (r, h) for h in hemi for r in rois]
    conn_titles = [
        '%s - %s' % (headers[il[0][i]], headers[il[1][i]])
        for i in range(len(il[0]))
    ]
    if s in g1:
        g1_data.append(np.array(subj_data))
    elif s in g2:
        g2_data.append(np.array(subj_data))
    elif s in g3:
        g3_data.append(np.array(subj_data))

res = []
g1_data = np.arctanh(g1_data).transpose([1, 2, 0])
g2_data = np.arctanh(g2_data).transpose([1, 2, 0])
g3_data = np.arctanh(g3_data).transpose([1, 2, 0])
print '=== nvVSper ==='
pval, adj, null = nbs.compute_nbs(stats, g1_data, g2_data, thresh, nperms,
                                  tail)
res.append([pval, adj])
print '=== nvVSrem ==='
pval, adj, null = nbs.compute_nbs(stats, g1_data, g3_data, thresh, nperms,
                                  tail)
res.append([pval, adj])
print '=== remVSper ==='
pval, adj, null = nbs.compute_nbs(stats, g2_data, g3_data, thresh, nperms,
                                  tail)
res.append([pval, adj])
예제 #2
0
        x_sx = copy.deepcopy(g1_sx)
        for i in delme:
            x_sx.pop(i)
    delme = np.unique(np.nonzero(np.isnan(y))[2])
    y = np.delete(y, delme, axis=2)
    if stats == 'linreg':
        y_sx = copy.deepcopy(g2_sx)
        for i in delme:
            y_sx.pop(i)
    if len(g3) > 0:
        z = np.array(g3_data[b]).transpose([1, 2, 0])
        delme = np.unique(np.nonzero(np.isnan(z))[2])
        z = np.delete(z, delme, axis=2)

    if stats in ['ttest', 'mwu']:
        pval, adj, null = nbs.compute_nbs(stats, x, y, thresh, nperms, tail)
    elif stats == 'linreg':
        adhd = np.dstack([x, y])
        sx = np.array(x_sx + y_sx)
        pval, adj, null = nbs.compute_nbs(stats, adhd, sx, thresh, nperms)
    elif stats in ['anova', 'kw']:
        pval, adj, null = nbs.compute_nbs(stats, x, y, thresh, nperms, tail, z)
    res.append([pval, adj])

n1 = len(g1_data[0])
n2 = len(g2_data[0])
print 'size1 =', n1
print 'size2 =', n2
print 'g1 =', g1_fname
print 'g2 =', g2_fname
print 'g3 =', g3_fname
예제 #3
0
    # if stats=='linreg':
    #     y_sx = copy.deepcopy(g2_sx)
    #     for i in delme:
    #         y_sx.pop(i)
    # if len(g3)>0:
    #     z = np.array(g3_data[b]).transpose([1,2,0])
    #     delme = np.unique(np.nonzero(np.isnan(z))[2])
    #     z = np.delete(z, delme, axis=2)
    for t in thresh:
        # anova[b].append(nbs.compute_nbs('anova',x,y,t,nperms,z))
        # kruskal[b].append(nbs.compute_nbs('kw',x,y,t,nperms,z))
        # nvVSper_mwu[b].append(nbs.compute_nbs('mwu',x,y,t,nperms))
        # nvVSrem_mwu[b].append(nbs.compute_nbs('mwu',x,z,t,nperms))
        # perVSrem_mwu[b].append(nbs.compute_nbs('mwu',y,z,t,nperms))
        # nvVSper[b].append(nbs.compute_nbs('ttest',x,y,t,nperms))
        nvVSrem[b].append(nbs.compute_nbs('ttest', x, z, t, nperms))
        # perVSrem[b].append(nbs.compute_nbs('ttest',y,z,t,nperms))
        # inatt[b].append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_inatt+g3_inatt),t,nperms))
        # hi[b].append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_hi+g3_hi),t,nperms))

n1 = len(g1_data[0])
n2 = len(g2_data[0])
n3 = len(g3_data[0])
print 'size1 =', n1
print 'size2 =', n2
print 'size3 =', n3
print 'g1 =', g1_fname
print 'g2 =', g2_fname
print 'g3 =', g3_fname
m = ['pli', 'imcoh', 'plv', 'wpli', 'pli2_unbiased', 'wpli2_debiased']
print m[cmethod]
예제 #4
0
nvVSper = []
nvVSrem = []
perVSrem = []
nvVSper_mwu = []
nvVSrem_mwu = []
perVSrem_mwu = []
anova = []
kruskal = []
inatt = []
hi = []

x = np.array(g1_data).transpose([1, 2, 0])
y = np.array(g2_data).transpose([1, 2, 0])
z = np.array(g3_data).transpose([1, 2, 0])
for t in thresh:
    anova.append(nbs.compute_nbs("anova", x, y, t, nperms, z))
    kruskal.append(nbs.compute_nbs("kw", x, y, t, nperms, z))
    nvVSper_mwu.append(nbs.compute_nbs("mwu", x, y, t, nperms))
    nvVSrem_mwu.append(nbs.compute_nbs("mwu", x, z, t, nperms))
    perVSrem_mwu.append(nbs.compute_nbs("mwu", y, z, t, nperms))
    nvVSper.append(nbs.compute_nbs("ttest", x, y, t, nperms))
    nvVSrem.append(nbs.compute_nbs("ttest", x, z, t, nperms))
    perVSrem.append(nbs.compute_nbs("ttest", y, z, t, nperms))
    inatt.append(nbs.compute_nbs("linreg", np.dstack([y, z]), np.array(g2_inatt + g3_inatt), t, nperms))
    hi.append(nbs.compute_nbs("linreg", np.dstack([y, z]), np.array(g2_hi + g3_hi), t, nperms))

n1 = len(g1_data[0])
n2 = len(g2_data[0])
n3 = len(g3_data[0])
print "size1 =", n1
print "size2 =", n2
예제 #5
0
# create correlations for each subject
il = np.tril_indices(2*len(rois), k=-1)
g1_data = []
g2_data = []
g3_data = []
for s in subjs:
    hemi_data = [np.genfromtxt('%s/%s_%s_%s.1D'%(data_dir,s,r,h)) for h in hemi for r in rois]
    corrs = np.corrcoef(hemi_data)
    subj_data = corrs
    headers = ['%s(%s)'%(r,h) for h in hemi for r in rois]
    conn_titles = ['%s - %s'%(headers[il[0][i]],headers[il[1][i]]) for i in range(len(il[0]))]
    if s in g1:
        g1_data.append(np.array(subj_data))
    elif s in g2:
        g2_data.append(np.array(subj_data))
    elif s in g3:
        g3_data.append(np.array(subj_data))

res=[]
g1_data = np.arctanh(g1_data).transpose([1,2,0])
g2_data = np.arctanh(g2_data).transpose([1,2,0])
g3_data = np.arctanh(g3_data).transpose([1,2,0])
print '=== nvVSper ==='
pval, adj, null = nbs.compute_nbs(stats,g1_data,g2_data,thresh,nperms,tail)
res.append([pval,adj])
print '=== nvVSrem ==='
pval, adj, null = nbs.compute_nbs(stats,g1_data,g3_data,thresh,nperms,tail)
res.append([pval,adj])
print '=== remVSper ==='
pval, adj, null = nbs.compute_nbs(stats,g2_data,g3_data,thresh,nperms,tail)
res.append([pval,adj])
예제 #6
0
        x_sx = copy.deepcopy(g1_sx)
        for i in delme:
            x_sx.pop(i)
    delme = np.unique(np.nonzero(np.isnan(y))[2])
    y = np.delete(y, delme, axis=2)
    if stats=='linreg':
        y_sx = copy.deepcopy(g2_sx)
        for i in delme:
            y_sx.pop(i)
    if len(g3)>0:
        z = np.array(g3_data[b]).transpose([1,2,0])
        delme = np.unique(np.nonzero(np.isnan(z))[2])
        z = np.delete(z, delme, axis=2)
        
    if stats in ['ttest','mwu']:
        pval, adj, null = nbs.compute_nbs(stats,x,y,thresh,nperms,tail) 
    elif stats=='linreg':
        adhd = np.dstack([x, y])
        sx = np.array(x_sx + y_sx)
        pval, adj, null = nbs.compute_nbs(stats,adhd,sx,thresh,nperms) 
    elif stats in ['anova','kw']:
        pval, adj, null = nbs.compute_nbs(stats,x,y,thresh,nperms,tail,z) 
    res.append([pval,adj])

n1 = len(g1_data[0])
n2 = len(g2_data[0])
print 'size1 =', n1
print 'size2 =', n2
print 'g1 =',g1_fname
print 'g2 =',g2_fname
print 'g3 =',g3_fname
예제 #7
0
nvVSper = []
nvVSrem = []
perVSrem = []
nvVSper_mwu = []
nvVSrem_mwu = []
perVSrem_mwu = []
anova = []
kruskal = []
inatt = []
hi = []

x = np.array(g1_data).transpose([1, 2, 0])
y = np.array(g2_data).transpose([1, 2, 0])
z = np.array(g3_data).transpose([1, 2, 0])
for t in thresh:
    anova.append(nbs.compute_nbs('anova', x, y, t, nperms, z))
    kruskal.append(nbs.compute_nbs('kw', x, y, t, nperms, z))
    nvVSper_mwu.append(nbs.compute_nbs('mwu', x, y, t, nperms))
    nvVSrem_mwu.append(nbs.compute_nbs('mwu', x, z, t, nperms))
    perVSrem_mwu.append(nbs.compute_nbs('mwu', y, z, t, nperms))
    nvVSper.append(nbs.compute_nbs('ttest', x, y, t, nperms))
    nvVSrem.append(nbs.compute_nbs('ttest', x, z, t, nperms))
    perVSrem.append(nbs.compute_nbs('ttest', y, z, t, nperms))
    inatt.append(
        nbs.compute_nbs('linreg', np.dstack([y, z]),
                        np.array(g2_inatt + g3_inatt), t, nperms))
    hi.append(
        nbs.compute_nbs('linreg', np.dstack([y, z]), np.array(g2_hi + g3_hi),
                        t, nperms))

n1 = len(g1_data[0])
예제 #8
0
    # if stats=='linreg':
    #     y_sx = copy.deepcopy(g2_sx)
    #     for i in delme:
    #         y_sx.pop(i)
    # if len(g3)>0:
    #     z = np.array(g3_data[b]).transpose([1,2,0])
    #     delme = np.unique(np.nonzero(np.isnan(z))[2])
    #     z = np.delete(z, delme, axis=2)
    for t in thresh:
        # anova[b].append(nbs.compute_nbs('anova',x,y,t,nperms,z))
        # kruskal[b].append(nbs.compute_nbs('kw',x,y,t,nperms,z))
        # nvVSper_mwu[b].append(nbs.compute_nbs('mwu',x,y,t,nperms))
        # nvVSrem_mwu[b].append(nbs.compute_nbs('mwu',x,z,t,nperms))
        # perVSrem_mwu[b].append(nbs.compute_nbs('mwu',y,z,t,nperms))
        # nvVSper[b].append(nbs.compute_nbs('ttest',x,y,t,nperms))
        nvVSrem[b].append(nbs.compute_nbs('ttest',x,z,t,nperms))
        # perVSrem[b].append(nbs.compute_nbs('ttest',y,z,t,nperms))
        # inatt[b].append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_inatt+g3_inatt),t,nperms))
        # hi[b].append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_hi+g3_hi),t,nperms))

n1 = len(g1_data[0])
n2 = len(g2_data[0])
n3 = len(g3_data[0])
print 'size1 =', n1
print 'size2 =', n2
print 'size3 =', n3
print 'g1 =',g1_fname
print 'g2 =',g2_fname
print 'g3 =',g3_fname
m = ['pli','imcoh','plv','wpli','pli2_unbiased','wpli2_debiased']
print m[cmethod]
예제 #9
0
#     corrs.append(subj_corrs)

nvVSper = []
nvVSrem = []
perVSrem = []
nvVSper_mwu = []
nvVSrem_mwu = []
perVSrem_mwu = []
anova = []
kruskal = []
inatt = []
hi = []

x = np.arctanh(np.array(corrs[0]).transpose([1,2,0]))
y = np.arctanh(np.array(corrs[1]).transpose([1,2,0]))
z = np.arctanh(np.array(corrs[2]).transpose([1,2,0]))
for t in thresh:
    # anova.append(nbs.compute_nbs('anova',x,y,t,nperms,z))
    # kruskal.append(nbs.compute_nbs('kw',x,y,t,nperms,z))
    # nvVSper_mwu.append(nbs.compute_nbs('mwu',x,y,t,nperms))
    # nvVSrem_mwu.append(nbs.compute_nbs('mwu',x,z,t,nperms))
    # perVSrem_mwu.append(nbs.compute_nbs('mwu',y,z,t,nperms))
    nvVSper.append(nbs.compute_nbs('ttest',x,y,t,nperms))
    nvVSrem.append(nbs.compute_nbs('ttest',x,z,t,nperms))
    perVSrem.append(nbs.compute_nbs('ttest',y,z,t,nperms))
    # inatt.append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_inatt+g3_inatt),t,nperms))
    # hi.append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_hi+g3_hi),t,nperms))

print [r[0] for r in nvVSper]
print [r[0] for r in nvVSrem]
print [r[0] for r in perVSrem]
예제 #10
0
#     corrs.append(subj_corrs)

nvVSper = []
nvVSrem = []
perVSrem = []
nvVSper_mwu = []
nvVSrem_mwu = []
perVSrem_mwu = []
anova = []
kruskal = []
inatt = []
hi = []

x = np.arctanh(np.array(corrs[0]).transpose([1, 2, 0]))
y = np.arctanh(np.array(corrs[1]).transpose([1, 2, 0]))
z = np.arctanh(np.array(corrs[2]).transpose([1, 2, 0]))
for t in thresh:
    # anova.append(nbs.compute_nbs('anova',x,y,t,nperms,z))
    # kruskal.append(nbs.compute_nbs('kw',x,y,t,nperms,z))
    # nvVSper_mwu.append(nbs.compute_nbs('mwu',x,y,t,nperms))
    # nvVSrem_mwu.append(nbs.compute_nbs('mwu',x,z,t,nperms))
    # perVSrem_mwu.append(nbs.compute_nbs('mwu',y,z,t,nperms))
    nvVSper.append(nbs.compute_nbs('ttest', x, y, t, nperms))
    nvVSrem.append(nbs.compute_nbs('ttest', x, z, t, nperms))
    perVSrem.append(nbs.compute_nbs('ttest', y, z, t, nperms))
    # inatt.append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_inatt+g3_inatt),t,nperms))
    # hi.append(nbs.compute_nbs('linreg',np.dstack([y, z]),np.array(g2_hi+g3_hi),t,nperms))

print[r[0] for r in nvVSper]
print[r[0] for r in nvVSrem]
print[r[0] for r in perVSrem]