Cable cell mechanisms¶
When decorating a cable cell, we use a mechanism
type to describe a
mechanism that is to be painted or placed on the cable cell.
- class mechanism¶
Mechanisms describe physical processes, distributed over the membrane of the cell. Density mechanisms are associated with regions of the cell, whose dynamics are a function of the cell state and their own state where they are present. Point mechanisms are defined at discrete locations on the cell, which receive events from the network. A third, specific type of density mechanism, which describes ionic reversal potential behaviour, can be specified for cells or the whole model.
The
mechanism
type is a simple wrapper around a mechanismmechanism.name
and a dictionary of named parameters.Mechanisms have two types of parameters:
global parameters: a scalar value that is the same for all instances of a mechanism.
range parameters: the value of range parameters is defined for each instance of the mechanism on a cell. For density mechanisms, this means one value for each control volume on which it is present.
The method for setting a parameter depends on its type. If global parameters change, we are effectively defining a new type of mechanism, so global parameter information is encoded in the name. Range parameters are set using a dictionary of name-value pairs.
import arbor # hh dynamics with default parameters. hh = arbor.mechanism('hh') # A passive leaky channel with custom parameters pas = arbor.mechanism('pas/e=-55.0', {'g': 0.02}) # Reversal potential using Nernst equation with GLOBAL parameter values # for Faraday's constant and the target ion species, set with a '/' followed # by comma-separated list of parameter after the base mechanism name. rev = arbor.mechanism('nernst/F=96485,x=ca')
Mechanisms can be painted to a region. Different mechanisms can be painted on top of each other.
import arbor # Create pas mechanism with default parameter values (set in NOMDL file). m1 = arbor.mechanism('pas') # Create default mechainsm with custom conductance (range). m2 = arbor.mechanism('pas', {'g', 0.1}) # Create a new pas mechanism with that changes reversal potential (global). m3 = arbor.mechanism('pas/e=-45') # Create an instance of the same mechanism, that also sets conductance (range). m4 = arbor.mechanism('pas/e=-45', {'g', 0.1}) # This is an equivalent to m4, using set method to specify range parameters. m5 = arbor.mechanism('pas/e=-45') m5.set('g', 0.1) # Decorate the 'soma' with (multiple) mechanisms decor.paint('"soma"', m1) decor.paint('"soma"', m2) # Error: can't place the same mechanism on overlapping regions decor.paint('"soma"', m3) # This is ok: m3 is a new, derived mechanism by virtue of # having a different name, i.e. 'pas/e=-45' vs. 'pas'.
- mechanism(name, params)¶
constructor for mechanism with name and range parameter overrides params, for example:
arbor.mechanism(name='pas', params={'g': 0.01})
.- Parameters
name (str) – name of mechanism.
params (dict[str, double]) – A dictionary of parameter values, with parameter name as key.
- mechanism(name)
constructor for mechanism. The name can be either the name of a mechanism in the catalogue, e.g.
arbor.mechanism('pas')
, or an implicitly derived mechanism, e.g.arbor.mechanism('nernst/k')
.
- set(name, value)¶
Set new value for a parameter.
- Parameters
name (str) – name of the parameter.
value (float) – value of the parameter.
- name: str¶
The name of the mechanism.
- values¶
- :type: dict
A dictionary of key-value pairs for the parameters.
- class mechanism_info¶
Meta data about the fields and ion dependencies of a mechanism. The data is presented as read-only attributes.
import arbor cat = arbor.default_catalogue() # Get mechanism_info for the 'expsyn' mechanism. mech = cat['expsyn'] # Query the mechanism_info for information about parameters. print(mech.parameters.keys()) # dict_keys(['e', 'tau']) print(mech.parameters['tau'].units) # 'ms' print(mech.parameters['tau'].default) # 2.0
- globals: dict[str, mechanism_field]¶
Global fields have one value common to an instance of a mechanism, are constant in time and set at instantiation.
- parameters: dict[str, mechanism_field]¶
Parameter fields may vary across the extent of a mechanism, but are constant in time and set at instantiation.
- state: dict[str, mechanism_field]¶
State fields vary in time and across the extent of a mechanism, and potentially can be sampled at run-time.
- ions: dict[str, ion_dependency]¶
Ion dependencies.
- linear: bool¶
True if a synapse mechanism has linear current contributions so that multiple instances on the same control volume can be coalesced.
- class ion_dependency¶
Meta data about a mechanism’s dependence on an ion species, presented as read-only attributes.
import arbor cat = arbor.default_catalogue() # Get ion_dependency for the 'hh' mechanism. ions = cat['hh'].ions # Query the ion_dependency. print(ions.keys()) # dict_keys(['k', 'na']) print(ions['k'].write_rev_pot) # False print(ions['k'].read_rev_pot) # True
- write_int_con: bool¶
If the mechanism contributes to the internal concentration of the ion species.
- write_ext_con: bool¶
If the mechanism contributes to the external concentration of the ion species.
- write_rev_pot: bool¶
If the mechanism calculates the reversal potential of the ion species.
- read_rev_pot: bool¶
If the mechanism depends on the reversal potential of the ion species.
- class mechanism_field¶
Meta data about a specific field of a mechanism, presented as read-only attributes.
- units: string¶
The units of the field.
- default: float¶
The default value of the field.
- min: float¶
The minimum permissible value of the field.
- max: float¶
The maximum permissible value of the field.
The mechanism_info
type above presents read-only information about a mechanism that is available in a catalogue.
Mechanism catalogues¶
- class catalogue¶
A mechanism catalogue is a collection of mechanisms that maintains:
Collection of mechanism metadata indexed by name.
A further hierarchy of derived mechanisms, that allow specialization of global parameters, ion bindings, and implementations.
- __contains__(name)¶
Test if mechanism with name is in the catalogue.
Note: This enables the following idiom
import arbor if 'hh' in arbor.default_catalogue(): print("Found HH mechanism.")
- Parameters
name (str) – name of mechanism.
- Returns
bool
- is_derived(name)¶
Is name a derived mechanism or can it be implicitly derived?
- Parameters
name (str) – name of mechanism.
- Returns
bool
- __getitem__(name)¶
Look up mechanism meta data with name.
import arbor cat = arbor.default_catalogue() # Print default value and units for gnabar parameter of hh. print(cat['hh'].parameters['gnabar'])
- Parameters
name (str) – name of mechanism.
- Returns
mechanism metadata
- Return type
- __iter___()¶
Return a list names of all the mechanisms in the catalogue.
Note: This enables the following idiom
import arbor for name in arbor.default_catalogue(): print(name)
- Returns
py_mech_cat_iterator
- derive(name, parent, globals={}, ions={})¶
Derive a new mechanism with name from the mechanism parent.
If no parameters or ion renaming are specified with globals or ions, the method will attempt to implicitly derive a new mechanism from parent by parsing global and ions from the parent string.
import arbor cat = arbor.default_catalogue() # Use the value of the Faraday constant as published by CODATA in 1986, # and bind to pottasium ion species. cat.derive('krev', 'nernst', globals={'F': 96485.309}, ions={'x': 'k'}) # Derive a reversal potential mechanism for sodium from the one we defined # for potasium, which will inherit the redefined Faraday constant. cat.derive('narev', 'krev', ions={'k': 'na'}) # Alternatively, we can derive a mechanism with global parameters and ion renaming # specified in the parent name string. cat.derive('krev_imp', 'nernst/F=96485.309,k') cat.derive('carev', 'krev_imp/ca')
- Parameters
name (str) – name of new derived mechanism.
parent (str) – name of parent mechanism.
globals (dict[str, float]) – a dictionary mapping global parameter names to their values, if any.
ions (dict[str, str]) – a dictionary renaming ion species, if any.