bluecellulab.simulation.modifications

Module for applying SONATA condition modifications to cells.

Implements all five SONATA modification types: - ttx: Block Na channels via TTXDynamicsSwitch - configure_all_sections: Apply section_configure to all sections - section_list: Apply section_configure to a named section list - section: Apply section_configure to specific named sections - compartment_set: Apply section_configure to segments in a compartment set

The section_configure parser follows neurodamus’s ast.parse() + restricted exec() pattern (neurodamus/modification_manager.py).

Functions

apply_modifications(cells, modifications, ...)

Apply a list of modifications to instantiated cells.

parse_section_configure(config_str[, ...])

Parse a section_configure string, returning sanitized code and referenced attrs.

bluecellulab.simulation.modifications.apply_modifications(cells, modifications, circuit_access)[source]

Apply a list of modifications to instantiated cells.

Parameters:
  • cells (dict) – Dict mapping CellId to Cell objects.

  • modifications (list[ModificationBase]) – List of Modification dataclass instances.

  • circuit_access – CircuitAccess instance for resolving node_sets.

Return type:

None

bluecellulab.simulation.modifications.parse_section_configure(config_str, placeholder='%s')[source]

Parse a section_configure string, returning sanitized code and referenced attrs.

Parameters:
  • config_str (str) – The raw section_configure string (e.g. “%s.gbar = 0”).

  • placeholder (str) – The placeholder to replace with ‘sec’ (default: “%s”).

Return type:

tuple[str, set[str]]

Returns:

Tuple of (sanitized_config_str, set_of_referenced_attribute_names).

Raises:

ValueError – If the config string contains non-assignment statements or references attributes not on the placeholder.