def init_connection(pop1, pop2, target_name, weight, p, delay=None, allow_self_conn=True): """ Initialize a connection between two populations pop1 = population sending projections pop2 = populations receiving projections target_name = name of synapse type to project to weight = weight of connection p = probability of connection between any two neurons delay = delay allow_self_conn = allow neuron to project to itself """ if delay is not None: conn = DelayConnection(pop1, pop2, target_name, sparseness=p, weight=weight, delay=delay) else: conn = Connection(pop1, pop2, sparseness=p, weight=weight) # Remove self-connections if not allow_self_conn and len(pop1) == len(pop2): for j in xrange(len(pop1)): conn[j, j] = 0.0 conn[j, j] = 0.0 if delay is not None: conn.delay[j, j] = 0.0 conn.delay[j, j] = 0.0 return conn
def init_connection(pop1, pop2, target_name, weight, p, delay=None, allow_self_conn=True): """ Initialize a connection between two populations pop1 = population sending projections pop2 = populations receiving projections target_name = name of synapse type to project to weight = weight of connection p = probability of connection between any two neurons delay = delay allow_self_conn = allow neuron to project to itself """ if delay is not None: conn=DelayConnection(pop1, pop2, target_name, sparseness=p, weight=weight, delay=delay) else: conn=Connection(pop1, pop2, sparseness=p, weight=weight) # Remove self-connections if not allow_self_conn and len(pop1)==len(pop2): for j in xrange(len(pop1)): conn[j,j]=0.0 conn[j,j]=0.0 if delay is not None: conn.delay[j,j]=0.0 conn.delay[j,j]=0.0 return conn
def init_rand_weight_connection(pop1, pop2, target_name, min_weight, max_weight, p, delay, allow_self_conn=True): """ Initialize a connection between two populations pop1 = population sending projections pop2 = populations receiving projections target_name = name of synapse type to project to min_weight = min weight of connection max_weight = max weight of connection p = probability of connection between any two neurons delay = delay allow_self_conn = allow neuron to project to itself """ W = min_weight + np.random.rand(len(pop1), len(pop2)) * (max_weight - min_weight) conn = DelayConnection(pop1, pop2, target_name, sparseness=p, W=W, delay=delay) # Remove self-connections if not allow_self_conn and len(pop1) == len(pop2): for j in xrange(len(pop1)): conn[j, j] = 0.0 conn.delay[j, j] = 0.0 conn[j, j] = 0.0 conn.delay[j, j] = 0.0 return conn
def init_rand_weight_connection(pop1, pop2, target_name, min_weight, max_weight, p, delay, allow_self_conn=True): """ Initialize a connection between two populations pop1 = population sending projections pop2 = populations receiving projections target_name = name of synapse type to project to min_weight = min weight of connection max_weight = max weight of connection p = probability of connection between any two neurons delay = delay allow_self_conn = allow neuron to project to itself """ W=min_weight+np.random.rand(len(pop1),len(pop2))*(max_weight-min_weight) conn=DelayConnection(pop1, pop2, target_name, sparseness=p, W=W, delay=delay) # Remove self-connections if not allow_self_conn and len(pop1)==len(pop2): for j in xrange(len(pop1)): conn[j,j]=0.0 conn.delay[j,j]=0.0 conn[j,j]=0.0 conn.delay[j,j]=0.0 return conn