ConnectionResult#

class braintools.conn.ConnectionResult(pre_indices, post_indices, pre_size, post_size, pre_positions=None, post_positions=None, pre_compartments=None, post_compartments=None, weights=None, delays=None, model_type='point', metadata=None)#

Universal container for connectivity results across all neuron model types.

This class provides a unified interface for representing connections while maintaining type-specific information and capabilities.

Parameters:
  • pre_indices (ndarray) – Presynaptic element indices (neurons, populations, or compartments).

  • post_indices (ndarray) – Postsynaptic element indices (neurons, populations, or compartments).

  • pre_size (int | Sequence[int] | None) – Size of the presynaptic population (number of elements or shape).

  • post_size (int | Sequence[int] | None) – Size of the postsynaptic population (number of elements or shape).

  • weights (ndarray | Quantity | None) – Connection weights with appropriate units for the model type.

  • delays (ndarray | Quantity | None) – Connection delays with time units (e.g., ms).

  • model_type (str) – Type of neuron model (‘point’, ‘population_rate’, ‘multi_compartment’).

  • pre_positions (ndarray | None) – Positions of presynaptic elements (for distance calculations).

  • post_positions (ndarray | None) – Positions of postsynaptic elements (for distance calculations).

  • pre_compartments (ndarray | None) – Presynaptic compartment indices (for multi-compartment models).

  • post_compartments (ndarray | None) – Postsynaptic compartment indices (for multi-compartment models).

  • metadata (Dict[str, Any] | None) – Model-specific metadata and parameters.

delay2csr()[source]#

Convert delays to sparse connectivity matrix in CSR format.

delay2matrix()[source]#

Convert delays to dense connectivity matrix.

get_distances()[source]#

Calculate distances between connected elements.

Return type:

Quantity | None

property n_connections: int#

Number of connections.

property positions: Tuple[ndarray, ndarray] | None#

Backward compatibility property for positions.

property shape: Tuple[int, int]#

Shape of the connectivity (pre_size, post_size).

weight2csr()[source]#

Convert to sparse connectivity matrix in CSR format.

weight2dense()[source]#

Convert to dense connectivity matrix.