sic_connection#

class brainpy.state.sic_connection(weight=1.0, delay_steps=1, name=None)#

NEST-compatible sic_connection synapse model for astrocyte-to-neuron slow inward current (SIC) coupling.

This class implements connection-level semantics of NEST’s sic_connection model (models/sic_connection.{h,cpp}), which transmits slow inward current coefficients from astrocytes to neurons via SICEvent secondary events. The connection stores a scalar weight that multiplies the SIC coefficient stream and supports delayed delivery.

1. Biological Context

Astrocytes can modulate neuronal excitability through release of gliotransmitters, triggering slow inward currents (SICs) in nearby neurons. These currents typically arise from extrasynaptic NMDA receptors activated by glutamate released from astrocytes, producing depolarizing currents that persist for hundreds of milliseconds to seconds. This connection model represents the functional coupling between astrocyte dynamics and neuronal membrane conductance.

2. Supported Model Pairings

In standard NEST model sets:

  • Source models (emit SICEvent): astrocyte_lr_1994

  • Target models (handle SICEvent): aeif_cond_alpha_astro

Methods supports_connection() and check_connection() validate model compatibility at the model-name level.

3. Mathematical Formulation

The connection transmits a coefficient array \(c = [c_0, c_1, \ldots, c_{n-1}]\) representing SIC amplitude values scheduled for future time steps. Each coefficient is scaled by the connection weight \(w\) and delivered with delay \(d\):

\[I_{\text{SIC}}(t + d + i) = w \cdot c_i, \qquad i = 0, 1, \ldots, n-1\]

where \(t\) is the current simulation time, \(d\) is the connection delay, and \(i\) indexes the coefficient array.

4. Delay Mapping and Buffer Indexing

NEST’s target-side SIC handling in aeif_cond_alpha_astro::handle(SICEvent&) uses:

\[\text{offset} = d - d_{\text{min}}, \qquad \text{slot}_i = \text{offset} + i\]

where \(d\) is the event delay in steps, \(d_{\text{min}}\) is the minimum network delay, and \(i\) is the coefficient index.

Local step-based APIs in this package interpret delay_steps as a zero-indexed offset (delay_steps - 1). Therefore, for an absolute NEST delay \(d\) and minimum delay \(d_{\text{min}}\), this class maps to local delay:

\[d_{\text{local}} = (d - d_{\text{min}}) + 1\]

This ensures proper alignment with NEST’s buffer indexing. Methods to_aeif_sic_event() and coeffarray_to_step_events() apply this mapping.

5. Event Structure

The connection produces event dictionaries with:

  • coeffs (array or scalar): SIC coefficient value(s)

  • weight (float): Connection weight × multiplicity

  • delay_steps (int): Delay offset for buffer indexing

  • multiplicity (float): Event count (always 1.0 after weight multiplication)

Parameters:
  • weight (float, array-like, optional) – Synaptic weight multiplying SIC coefficients. Must be scalar. Default: 1.0.

  • delay_steps (int, array-like, optional) – Absolute event delay in simulation steps (NEST-style). Must be scalar integer >= 1. Default: 1.

  • name (str, optional) – Model instance name for identification. Default: None.

Parameter Mapping

Parameter

NEST Name

Unit

Description

weight

weight

unitless

Coefficient scaling factor

delay_steps

delay

steps

Absolute transmission delay

weight#

Validated scalar weight.

Type:

float

delay_steps#

Validated delay in steps (≥ 1).

Type:

int

name#

Optional instance identifier.

Type:

str or None

HAS_DELAY#

Class attribute, always True (supports delayed transmission).

Type:

bool

SUPPORTS_WFR#

Class attribute, always False (waveform relaxation not supported).

Type:

bool

SUPPORTED_SOURCES#

Valid source model names ('astrocyte_lr_1994').

Type:

tuple of str

SUPPORTED_TARGETS#

Valid target model names ('aeif_cond_alpha_astro').

Type:

tuple of str

Raises:

ValueError – If weight or delay_steps are not scalar, or if delay_steps < 1.

Notes

  • This class represents connection semantics only. SIC coefficient generation is handled by the source model (e.g., astrocyte_lr_1994).

  • Connection objects are stateless; all state (membrane conductances, SIC time courses) is maintained by source and target neuron models.

  • The multiplicity parameter in event methods allows scaling weights for multi-synapse connections but is always normalized to 1.0 in final events.

References

Examples

Basic connection setup:

>>> import brainpy.state as bp
>>> conn = bp.sic_connection(weight=0.5, delay_steps=2)
>>> conn.get_status()
{'weight': 0.5, 'delay_steps': 2, 'delay': 2, ...}

Create SIC event for target neuron:

>>> coeffs = [0.1, 0.3, 0.5, 0.3, 0.1]  # Time-varying SIC profile
>>> event = conn.to_aeif_sic_event(
...     coeffarray=coeffs,
...     min_delay_steps=1,
...     multiplicity=1.0
... )
>>> event['weight']  # Scaled by connection weight
0.5
>>> event['delay_steps']  # Local delay: (2 - 1) + 1 = 2
2

Decompose coefficient array into per-step events:

>>> events = conn.coeffarray_to_step_events(
...     coeffarray=[0.1, 0.2, 0.3],
...     min_delay_steps=1
... )
>>> len(events)
3
>>> events[0]['delay_steps']  # First coefficient at delay 2
2
>>> events[2]['delay_steps']  # Third coefficient at delay 4
4

Validate model compatibility:

>>> bp.sic_connection.supports_connection(
...     'astrocyte_lr_1994', 'aeif_cond_alpha_astro'
... )
True
>>> bp.sic_connection.check_connection(
...     'astrocyte_lr_1994', 'iaf_psc_alpha'
... )
ValueError: Unsupported sic_connection pair...
classmethod check_connection(source_model, target_model)[source]#

Validate source-target model pair and raise error if incompatible.

Parameters:
  • source_model (Any) – Source model (string name, class, or instance).

  • target_model (Any) – Target model (string name, class, or instance).

Returns:

Always returns True if validation passes.

Return type:

bool

Raises:

ValueError – If the model pair is not supported (see supports_connection()). Error message includes actual and expected model names.

Examples

>>> bp.sic_connection.check_connection(
...     'astrocyte_lr_1994', 'aeif_cond_alpha_astro'
... )
True
>>> bp.sic_connection.check_connection(
...     'iaf_psc_alpha', 'aeif_cond_alpha_astro'
... )
ValueError: Unsupported sic_connection pair...
coeffarray_to_step_events(coeffarray, min_delay_steps=1, multiplicity=1.0, delay_steps=None)[source]#

Map lag-indexed SIC coefficients to one event per future time step.

Decomposes an n-element coefficient array into n separate events, each scheduled for a distinct future step. Coefficient i is delivered at local_delay + i steps in the future.

Parameters:
  • coeffarray (array-like) – 1D array of SIC coefficients, length n. Coefficient i corresponds to time step current_time + delay + i.

  • min_delay_steps (int, array-like, optional) – Minimum network delay for delay mapping. Default: 1.

  • multiplicity (float, array-like, optional) – Weight scaling factor. Default: 1.0.

  • delay_steps (int, array-like, optional) – Override connection delay. Default: None (use self.delay_steps).

Returns:

List of n event dictionaries, one per coefficient. Each contains:

  • 'coeffs' (float): Single coefficient value.

  • 'weight' (float): Connection weight × multiplicity.

  • 'delay_steps' (int): Local delay = base_delay + i for index i.

  • 'multiplicity' (float): Always 1.0.

Return type:

list[dict[str, Any]]

Raises:

ValueError – If coeffarray is empty or parameter validation fails.

Notes

This method is useful for event-driven simulations where SIC coefficients need to be delivered as discrete time-stamped events rather than as a bundled array. The base delay is computed as (delay - min_delay) + 1, and each coefficient adds its index to this base.

Examples

>>> conn = bp.sic_connection(weight=0.5, delay_steps=2)
>>> events = conn.coeffarray_to_step_events(
...     coeffarray=[0.1, 0.3, 0.5],
...     min_delay_steps=1
... )
>>> len(events)
3
>>> events[0]['coeffs']
0.1
>>> events[0]['delay_steps']  # (2 - 1) + 1 + 0
2
>>> events[2]['delay_steps']  # (2 - 1) + 1 + 2
4
get(key='status')[source]#

Retrieve connection parameter or full status dictionary.

Parameters:

key (str, optional) – Parameter name to retrieve. If 'status' (default), returns full status dictionary from get_status(). Otherwise, must be a valid status key (e.g., 'weight', 'delay', 'delay_steps').

Returns:

If key == 'status': full status dictionary. Otherwise: value of the requested parameter.

Return type:

Any

Raises:

KeyError – If key is not 'status' and not present in the status dictionary.

Examples

>>> conn = bp.sic_connection(weight=0.8, delay_steps=2)
>>> conn.get('weight')
0.8
>>> conn.get('status')['delay']
2
get_status()[source]#

Return complete connection state and metadata.

Returns:

Dictionary containing:

  • 'weight' (float): Connection weight.

  • 'delay_steps' (int): Delay in simulation steps.

  • 'delay' (int): Alias for delay_steps (NEST compatibility).

  • 'size_of' (int): Memory footprint in bytes (Python object overhead).

  • 'has_delay', 'supports_wfr', 'supported_sources', 'supported_targets': Connection properties (see properties()).

Return type:

dict[str, Any]

Notes

This method mirrors NEST’s GetStatus API, providing a snapshot of all connection parameters and capabilities. The delay key is an alias for delay_steps to maintain NEST naming conventions.

prepare_secondary_event(coeffarray, delay_steps=None)[source]#

Create a NEST-style SICEvent payload with coefficient array.

Parameters:
  • coeffarray (array-like) – 1D array of SIC coefficients for future time steps. Must be non-empty. Shape: (n_steps,).

  • delay_steps (int, array-like, optional) – Override connection delay. If None, uses self.delay_steps. Default: None.

Returns:

NEST-compatible event dictionary:

  • 'coeffarray' (ndarray): Validated float64 coefficient array, shape (n_steps,).

  • 'weight' (float): Connection weight.

  • 'delay_steps' (int): Absolute delay in simulation steps.

Return type:

dict[str, Any]

Raises:

ValueError – If coeffarray is empty, or if delay_steps validation fails.

Notes

This method produces raw NEST-style events. For local step-based consumption, use to_aeif_sic_event() or coeffarray_to_step_events() which apply delay mapping.

Examples

>>> conn = bp.sic_connection(weight=0.5, delay_steps=2)
>>> event = conn.prepare_secondary_event([0.1, 0.3, 0.5])
>>> event['coeffarray']
array([0.1, 0.3, 0.5])
>>> event['delay_steps']
2
property properties: dict[str, Any]#

Return connection capability flags and supported model types.

Returns:

Dictionary with keys:

  • 'has_delay' (bool): Always True for sic_connection.

  • 'supports_wfr' (bool): Always False (waveform relaxation not implemented).

  • 'supported_sources' (tuple[str, …]): Model names that can emit SICEvent.

  • 'supported_targets' (tuple[str, …]): Model names that can receive SICEvent.

Return type:

dict[str, Any]

Notes

This property provides introspection for connection compatibility checking and simulation infrastructure setup (e.g., delay buffer allocation).

set_delay(delay)[source]#

Update connection delay (alias for set_delay_steps()).

Parameters:

delay (int or array-like) – New delay in simulation steps. Must be scalar integer >= 1.

Raises:

ValueError – If delay is not scalar integer or < 1.

set_delay_steps(delay_steps)[source]#

Update connection delay in simulation steps.

Parameters:

delay_steps (int or array-like) – New delay in steps. Must be scalar integer >= 1.

Raises:

ValueError – If delay_steps is not scalar integer or < 1.

Examples

>>> conn = bp.sic_connection(delay_steps=1)
>>> conn.set_delay_steps(5)
>>> conn.delay_steps
5
set_status(status=None, **kwargs)[source]#

Update connection parameters (NEST SetStatus API).

Parameters:
  • status (dict[str, Any], optional) – Dictionary of parameters to update. Valid keys: 'weight', 'delay', 'delay_steps'. Default: None.

  • **kwargs – Additional keyword arguments merged with status dict.

Raises:

ValueError – If both 'delay' and 'delay_steps' are provided with different values, or if parameter values fail validation (non-scalar, delay < 1, etc.).

Notes

  • If both 'delay' and 'delay_steps' are present, they must be identical (they are aliases in NEST).

  • Validation is delegated to set_weight() and set_delay_steps().

  • Unknown keys are silently ignored (NEST-compatible behavior).

Examples

>>> conn = bp.sic_connection(weight=1.0, delay_steps=1)
>>> conn.set_status(weight=2.5, delay=3)
>>> conn.get_status()['weight']
2.5
>>> conn.get_status()['delay_steps']
3
set_weight(weight)[source]#

Update connection weight.

Parameters:

weight (float or array-like) – New synaptic weight. Must be scalar after conversion.

Raises:

ValueError – If weight is not scalar.

Examples

>>> conn = bp.sic_connection()
>>> conn.set_weight(2.5)
>>> conn.weight
2.5
classmethod supports_connection(source_model, target_model)[source]#

Check if source-target model pair is compatible with sic_connection.

Parameters:
  • source_model (Any) – Source model (string name, class, or instance). Must be in SUPPORTED_SOURCES ('astrocyte_lr_1994').

  • target_model (Any) – Target model (string name, class, or instance). Must be in SUPPORTED_TARGETS ('aeif_cond_alpha_astro').

Returns:

True if both models are in their respective supported lists, False otherwise.

Return type:

bool

Examples

>>> bp.sic_connection.supports_connection(
...     'astrocyte_lr_1994', 'aeif_cond_alpha_astro'
... )
True
>>> bp.sic_connection.supports_connection(
...     'iaf_psc_alpha', 'aeif_cond_alpha_astro'
... )
False
to_aeif_sic_event(coeffarray, min_delay_steps=1, multiplicity=1.0, delay_steps=None)[source]#

Create SIC event payload consumable by aeif_cond_alpha_astro.update.

Applies delay mapping from NEST absolute delay to local step-based offset: local_delay = (delay - min_delay) + 1.

Parameters:
  • coeffarray (array-like) – 1D array of SIC coefficients. Shape: (n_steps,).

  • min_delay_steps (int, array-like, optional) – Minimum network delay (NEST-style). Used for delay offset calculation. Default: 1.

  • multiplicity (float, array-like, optional) – Scaling factor for connection weight (e.g., for multi-synapse connections). Default: 1.0.

  • delay_steps (int, array-like, optional) – Override connection delay. If None, uses self.delay_steps. Default: None.

Returns:

Local event dictionary:

  • 'coeffs' (ndarray): Coefficient array, shape (n_steps,).

  • 'weight' (float): Connection weight × multiplicity.

  • 'delay_steps' (int): Local delay offset = (delay - min_delay) + 1.

  • 'multiplicity' (float): Always 1.0 (absorbed into weight).

Return type:

dict[str, Any]

Raises:

ValueError – If coeffarray is empty, if delay_steps < min_delay_steps, or if any parameter is not scalar where required.

Notes

This method is the primary interface for integrating sic_connection events into step-based neuron update loops. The delay mapping ensures compatibility with NEST’s buffer indexing semantics.

Examples

>>> conn = bp.sic_connection(weight=0.5, delay_steps=3)
>>> event = conn.to_aeif_sic_event(
...     coeffarray=[0.1, 0.2],
...     min_delay_steps=1,
...     multiplicity=2.0
... )
>>> event['weight']  # 0.5 * 2.0
1.0
>>> event['delay_steps']  # (3 - 1) + 1
3
to_sic_event(coeff, min_delay_steps=1, multiplicity=1.0, delay_steps=None)[source]#

Create single-coefficient SIC event for local step-based APIs.

This is an alias for to_aeif_sic_event() supporting both single-value and array-valued coefficients.

Parameters:
  • coeff (float, array-like) – SIC coefficient value(s). Can be scalar or array.

  • min_delay_steps (int, array-like, optional) – Minimum network delay. Default: 1.

  • multiplicity (float, array-like, optional) – Weight scaling factor. Default: 1.0.

  • delay_steps (int, array-like, optional) – Override delay. Default: None (use self.delay_steps).

Returns:

See to_aeif_sic_event() return value.

Return type:

dict[str, Any]

Examples

>>> conn = bp.sic_connection(weight=0.8, delay_steps=2)
>>> event = conn.to_sic_event(coeff=0.5, min_delay_steps=1)
>>> event['coeffs']
array([0.5])
>>> event['delay_steps']
2