예제 #1
0
def make_symmetric(mat):
    n_mat = np.ndarray.copy(mat)
    for r in range(n_mat.shape[0]):
        for c in range(n_mat.shape[0]):
            n_mat[c, r] = n_mat[r, c]
    return n_mat


nodes = 10
num_dim = int((((nodes**2) - nodes) / 2))

seed_tract = 123
rng = np.random.RandomState(seed_tract)
t_mat_v = rng.uniform(low=1, high=50, size=(num_dim))
tract_mat = hf.p2matrix(t_mat_v, nodes)

# constant w_mat matches where tract_mat is 0
w_mat = np.ones((nodes, nodes))
zero_ind = tract_mat == 0
w_mat[zero_ind] = 0
np.fill_diagonal(w_mat, 0)

#cv matrix
seed2 = 200
rng = np.random.RandomState(seed2)
c_mat_v = rng.uniform(low=500, high=10000, size=(num_dim))
c_mat = hf.p2matrix(c_mat_v, nodes)
c_mat = np.reciprocal(c_mat)
np.fill_diagonal(c_mat, 0)
예제 #2
0
w_mat = np.ones((nodes, nodes))
zero_ind = tract_mat == 0
w_mat[zero_ind] = 0
np.fill_diagonal(w_mat, 0)

#cv matrix
tract_p = hf.matrix2p(tract_mat)
tract_p = np.array(tract_p)
num_dim = tract_p[tract_p > 0].shape[0]

seed2 = 200
num_dim_ = int((((nodes**2) - nodes) / 2))

rng = np.random.RandomState(seed2)
c_mat_v = rng.uniform(low=500, high=10000, size=(num_dim_))
c_mat = hf.p2matrix(c_mat_v, nodes)
c_mat = np.reciprocal(c_mat)
np.fill_diagonal(c_mat, 0)

#simulating network
#WILSON-COWAN PARAMS
"""Set seed for the wc_model_sim in the residuals fxn (so all potential 
solutions get tested with same noise variable)"""
wc_seed = 0
wc_params = {
    'c1': 1.6,
    'c2': -4.7,
    'c3': 3,
    'c4': -0.63,
    'I_e': 1.8,
    'I_i': -0.2,