miv_simulator.connections#

Classes and procedures related to neuronal connectivity generation.

Functions

choose_synapse_projection(ranstream_syn, ...)

Given a synapse projection, SWC synapse location, and synapse type, chooses a projection from the given projection dictionary based on 1) whether the projection properties match the given synapse properties and 2) random choice between all the projections that satisfy the given criteria.

generate_synaptic_connections(rank, gid, ...)

Given a set of synapses for a particular gid, projection configuration, projection and connection probability dictionaries, generates a set of possible connections for each synapse.

generate_uv_distance_connections(comm, ...)

Generates connectivity based on U, V distance-weighted probabilities.

Classes

ConnectionProb(destination_population, ...)

An object of this class will instantiate functions that describe the connection probabilities for each presynaptic population.

class miv_simulator.connections.ConnectionProb(destination_population, soma_coords, soma_distances, extents)[source]#

Bases: object

An object of this class will instantiate functions that describe the connection probabilities for each presynaptic population. These functions can then be used to get the distribution of connection probabilities across all possible source neurons, given the soma coordinates of a destination (post-synaptic) neuron.

filter_by_distance(destination_gid, source_population, source_layer)[source]#

Given the id of a target neuron, returns the distances along u and v and the gids of source neurons whose axons potentially contact the target neuron.

Parameters:
  • destination_gid (int) – int

  • source_population (str) – string

Return type:

Tuple[float, float, ndarray, ndarray, ndarray, ndarray, ndarray]

Returns:

tuple of array of int

get_prob(destination_gid, source, source_layers)[source]#

Given the soma coordinates of a destination neuron and a population source, return an array of connection probabilities and an array of corresponding source gids.

Parameters:
  • destination_gid (int) – int

  • source (str) – string

Return type:

Dict[int, Tuple[ndarray, ndarray, ndarray, ndarray]]

Returns:

array of float, array of int

miv_simulator.connections.choose_synapse_projection(ranstream_syn, syn_layer, swc_type, syn_type, population_dict, projection_synapse_dict, log=False)[source]#

Given a synapse projection, SWC synapse location, and synapse type, chooses a projection from the given projection dictionary based on 1) whether the projection properties match the given synapse properties and 2) random choice between all the projections that satisfy the given criteria.

Parameters:
  • ranstream_syn (RandomState) – random state object

  • syn_layer (int8) – synapse layer

  • swc_type (uint8) – SWC location for synapse (soma, axon, apical, basal)

  • syn_type (uint8) – synapse type (excitatory, inhibitory, neuromodulatory)

  • population_dict (Dict[str, int]) – mapping of population names to population indices

  • projection_synapse_dict (Dict[str, Tuple[int, List[int], List[int], List[float], int]]) – mapping of projection names to a tuple of the form: <type, layers, swc sections, proportions>

Return type:

str

miv_simulator.connections.generate_synaptic_connections(rank, gid, ranstream_syn, ranstream_con, cluster_seed, destination_gid, synapse_dict, population_dict, projection_synapse_dict, projection_prob_dict, connection_dict, random_choice=<function random_choice_w_replacement>, debug_flag=False)[source]#

Given a set of synapses for a particular gid, projection configuration, projection and connection probability dictionaries, generates a set of possible connections for each synapse. The procedure first assigns each synapse to a projection, using the given proportions of each synapse type, and then chooses source gids for each synapse using the given projection probability dictionary.

Parameters:
  • ranstream_syn (RandomState) – random stream for the synapse partitioning step

  • ranstream_con (RandomState) – random stream for the choosing source gids step

  • destination_gid (int) – destination gid

  • synapse_dict (Dict[str, ndarray]) – synapse configurations, a dictionary with fields: 1) syn_ids (synapse ids) 2) syn_types (excitatory, inhibitory, etc)., 3) swc_types (SWC types(s) of synapse location in the neuronal morphological structure 3) syn_layers (synapse layer placement)

  • population_dict (Dict[str, int]) – mapping of population names to population indices

  • projection_synapse_dict (Dict[str, Tuple[int, List[int], List[int], List[float], int]]) – mapping of projection names to a tuple of the form: <syn_layer, swc_type, syn_type, syn_proportion>

  • projection_prob_dict (Dict[str, Dict[int, Tuple[ndarray, ndarray, ndarray, ndarray]]]) – mapping of presynaptic population names to sets of source probabilities and source gids

  • connection_dict (DefaultDict[Any, Any]) – output connection dictionary

  • random_choice (Callable) – random choice procedure (default uses np.ranstream.multinomial)

Return type:

int

miv_simulator.connections.generate_uv_distance_connections(comm, population_dict, connection_config, connection_prob, forest_path, synapse_seed, connectivity_seed, cluster_seed, synapse_namespace, connectivity_namespace, connectivity_path, io_size, chunk_size, value_chunk_size, cache_size, write_size=1, dry_run=False, debug=False)[source]#

Generates connectivity based on U, V distance-weighted probabilities.

Parameters:
  • comm (Intracomm) – mpi4py MPI communicator

  • connection_config (Dict[str, Dict[str, SynapseConfig]]) – connection configuration object (instance of env.ConnectionConfig)

  • connection_prob (ConnectionProb) – ConnectionProb instance

  • forest_path (str) – location of file with neuronal trees and synapse information

  • synapse_seed (int) – random seed for synapse partitioning

  • connectivity_seed (int) – random seed for connectivity generation

  • cluster_seed (int) – random seed for determining connectivity clustering for repeated connections from the same source

  • synapse_namespace (str) – namespace of synapse properties

  • connectivity_namespace (str) – namespace of connectivity attributes

  • io_size (int) – number of I/O ranks to use for parallel connectivity append

  • chunk_size (int) – HDF5 chunk size for connectivity file (pointer and index datasets)

  • value_chunk_size (int) – HDF5 chunk size for connectivity file (value datasets)

  • cache_size (int) – how many cells to read ahead

  • write_size (int) – how many cells to write out at the same time

Return type:

None