Compartment#
- class dendrify.compartment.Compartment(name, model='passive', **kwargs)[source]#
Bases:
object
A class that automatically generates and handles all differential equations and parameters needed to describe a single compartment and any currents (synaptic, dendritic, noise) passing through it.
- Parameters:
name (str) – A unique name used to tag compartment-specific equations and parameters. It is also used to distinguish the various compartments belonging to the same
NeuronModel
.model (str, optional) – A keyword for accessing Dendrify’s library models. Custom models can also be provided but they should be in the same formattable structure as the library models. Available options:
'passive'
(default),'adaptiveIF'
,'leakyIF'
,'adex'
.kwargs (
Quantity
, optional) – Kwargs are used to specify important electrophysiological properties, such as the specific capacitance or resistance. For more information see:EphysProperties
.
Examples
>>> # specifying equations only: >>> compX = Compartment('nameX', 'leakyIF') >>> # specifying equations and ephys properties: >>> compY = Compartment('nameY', 'adaptiveIF', length=100*um, diameter=1*um, >>> cm=1*uF/(cm**2), gl=50*uS/(cm**2))
Attributes:
A compartment's surface area (open cylinder) based on its length and diameter.
A compartment's absolute capacitance based on its specific capacitance (cm) and surface area.
All differential equations that have been generated for a single compartment.
A compartment's absolute leakage conductance based on its specific leakage conductance (gl) and surface area.
All parameters that have been generated for a single compartment.
Methods:
Allows the connection (electrical coupling) of two compartments.
Adds a stochastic noise current.
Adds synaptic currents equations and parameters.
- property area#
A compartment’s surface area (open cylinder) based on its length and diameter.
- Return type:
- property capacitance#
A compartment’s absolute capacitance based on its specific capacitance (cm) and surface area.
- Return type:
- connect(other, g='half_cylinders')[source]#
Allows the connection (electrical coupling) of two compartments.
- Parameters:
other (Compartment) – Another compartment.
g (str or
Quantity
, optional) – The coupling conductance. It can be set explicitly or calculated automatically (provided all necessary parameters exist). Available options:'half_cylinders'
(default),'cylinder_<compartment name>'
.
Warning
The automatic approaches require that both compartments to be connected have specified length, diameter and axial resistance.
Examples
>>> compX, compY = Compartment('x', **kwargs), Compartment('y', **kwargs) >>> # explicit approach: >>> compX.connect(compY, g=10*nS) >>> # half cylinders (default): >>> compX.connect(compY) >>> # cylinder of one compartment: >>> compX.connect(compY, g='cylinder_x')
- property equations#
All differential equations that have been generated for a single compartment.
- Return type:
str
- property g_leakage#
A compartment’s absolute leakage conductance based on its specific leakage conductance (gl) and surface area.
- Return type:
- noise(tau=20. * msecond, sigma=3. * pamp, mean=0. * amp)[source]#
Adds a stochastic noise current. For more information see the Noise section: of Models and neuron groups
- property parameters#
All parameters that have been generated for a single compartment.
- Return type:
dict
- synapse(channel=None, pre=None, g=None, t_rise=None, t_decay=None, scale_g=False)[source]#
Adds synaptic currents equations and parameters. When only the decay time constant
t_decay
is provided, the synaptic model assumes an instantaneous rise of the synaptic conductance followed by an exponential decay. When both the riset_rise
and decayt_decay
constants are provided, synapses are modelled as a sum of two exponentials. For more information see: Modeling Synapses by Arnd Roth & Mark C. W. van Rossum- Parameters:
channel (str) – Synaptic channel type. Available options:
'AMPA'
,'NMDA'
,'GABA'
, by defaultNone
pre (str) – A unique name to distinguish synapses of the same type coming from different input sources, by default
None
g (
Quantity
) – Maximum synaptic conductance, by defaultNone
t_rise (
Quantity
) – Rise time constant, by defaultNone
t_decay (
Quantity
) – Decay time constant, by defaultNone
scale_g (bool, optional) – Option to add a normalization factor to scale the maximum conductance at 1 when synapses are modelled as a difference of exponentials (have both rise and decay kinetics), by default
False
.
Examples
>>> comp = Compartment('comp') >>> # adding an AMPA synapse with instant rise & exponential decay: >>> comp.synapse('AMPA', g=1*nS, t_decay=5*ms, pre='X') >>> # same channel, different conductance & source: >>> comp.synapse('AMPA', g=2*nS, t_decay=5*ms, pre='Y') >>> # different channel with both rise & decay kinetics: >>> comp.synapse('NMDA', g=1*nS, t_rise=5*ms, t_decay=50*ms, pre='X')