Ejemplo n.º 1
0
        if roi not in empty_rois:
            n, conn = fetch_adjacency(adjpath=os.path.join(
                reldir, conf.datasets_dir, 'noncropped_traced_' + roi))
            for th in ths:
                print(th, roi)
                path = os.path.join(reldir, conf.results_dir, 'CX_study_th',
                                    f'th={th};roi={roi}.txt')
                if not os.path.exists(path):
                    temp = conn[conn['weight'] > th]
                    nlist, adj = conn2adj(temp)
                    if temp.shape[0] > 0:
                        print('adj size =', adj.shape, 'non-zero elements =',
                              temp.shape[0])

                        #fh
                        h = hnx(adj)

                        #fh random rewiring
                        #             N = adj.shape[0]
                        #             temp = []
                        #             for i in range(20):
                        #                 perm = np.random.permutation(N)
                        #                 temp += [hnx(adj[:,perm])]

                        #             h_randwire_mean,h_randwire_std = np.mean(temp),np.std(temp)

                        #fh random weight shuffling

                        #             temp = []
                        #             for i in range(20):
                        #                 adj_temp = adj.copy()
Ejemplo n.º 2
0
# h_results = {'h':[],'h_randwire':[],'h_randweight':[]}

#hpy = lambda x: np.random.randn()
reldir = '../'

for roi in CX_rois:
    try:
        print(roi)
        path = os.path.join(reldir,conf.results_dir,'CX_study','roi='+roi+'.txt')
        if roi not in empty_rois and not os.path.exists(path):
            n,conn = fetch_adjacency(adjpath=os.path.join(reldir,conf.datasets_dir,'noncropped_traced_'+roi))
            nlist,adj = conn2adj(conn)
            print('adj size =',adj.shape,'non-zero elements =',conn.shape[0])
            
            #fh
            h = hnx(adj)
            
            #fh random rewiring
            N = adj.shape[0]
            temp = []
            for i in range(20):
                perm = np.random.permutation(N)
                temp += [hnx(adj[:,perm])]

            h_randwire_mean,h_randwire_std = np.mean(temp),np.std(temp)

            #fh random weight shuffling

            temp = []
            for i in range(20):
                adj_temp = adj.copy()