def connect_neural_types(network, source_type, target_type, graph_model, model_param): ''' Function to connect excitatory and inhibitory population with a given graph model. @todo: make the modifications for only a set of edges Parameters ---------- network : :class:`Network` or :class:`SpatialNetwork` The network to connect. source_type : int The type of source neurons (``1`` for excitatory, ``-1 for inhibitory neurons). source_type : int The type of target neurons. graph_model : string The name of the connectivity model (among "erdos_renyi", "random_scale_free", "price_scale_free", and "newman_watts"). model_param : dict Dictionary containing the model parameters (the keys are the keywords of the associated generation function --- see above). ''' edges, source_ids, target_ids = None, [], [] di_param = di_default.copy() di_param.update(model_param) for group in network._population.itervalues(): if group.neuron_type == source_type: source_ids.extend(group._id_list) elif group.neuron_type == target_type: target_ids.extend(group._id_list) if source_type == target_type: edges = di_gen_func[graph_model](source_ids,source_ids,**di_param) network.add_edges(edges) else: edges = di_gen_func[graph_model](source_ids,target_ids,**di_param) network.add_edges(edges) #~ network.set_weights(edges) network.set_weights() #~ Connections.delays(network, elist=edges) Connections.delays(network) if issubclass(network.__class__, SpatialGraph): Connections.distances(network)