Compartment¶
- class dendrify.compartment.Compartment(name, model='passive', length=None, diameter=None, cm=None, gl=None, cm_abs=None, gl_abs=None, r_axial=None, v_rest=None, scale_factor=1.0, spine_factor=1.0)[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'
.length (Quantity, optional) – A compartment’s length.
diameter (Quantity, optional) – A compartment’s diameter.
cm (Quantity, optional) – Specific capacitance (usually μF / cm^2).
gl (Quantity, optional) – Specific leakage conductance (usually μS / cm^2).
cm_abs (Quantity, optional) – Absolute capacitance (usually pF).
gl_abs (Quantity, optional) – Absolute leakage conductance (usually nS).
r_axial (Quantity, optional) – Axial resistance (usually Ohm * cm).
v_rest (Quantity, optional) – Resting membrane voltage.
scale_factor (float, optional) – A global area scale factor, by default
1.0
.spine_factor (float, optional) – A dendritic area scale factor to account for spines, by default
1.0
.
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)) >>> # specifying equations and absolute ephys properties: >>> compY = Compartment('nameZ', 'adaptiveIF', cm_abs=100*pF, gl_abs=20*nS)
Attributes:
Returns a compartment's surface area (open cylinder) based on its length and diameter.
Returns a compartment's absolute capacitance.
Checks if a compartment has been flagged as dimensionless.
Returns all differential equations that describe a single compartment and the mechanisms that have been added to it.
A compartment's absolute leakage conductance.
Returns all the parameters that have been generated for a single compartment.
Methods:
Connects two compartments (electrical coupling).
Calculates the normalization factor for synaptic conductance with t_rise and t_decay kinetics.
Adds a stochastic noise current.
Adds synaptic currents equations and parameters.
- property area¶
Returns a compartment’s surface area (open cylinder) based on its length and diameter.
- Return type:
- connect(other, g='half_cylinders')[source]¶
Connects two compartments (electrical coupling).
- 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 dimensionless¶
Checks if a compartment has been flagged as dimensionless.
- Return type:
bool
- property equations¶
Returns all differential equations that describe a single compartment and the mechanisms that have been added to it.
- Return type:
str
- static g_norm_factor(t_rise, t_decay)[source]¶
Calculates the normalization factor for synaptic conductance with t_rise and t_decay kinetics.
Parameters: t_rise (Quantity): The rise time of the function. t_decay (Quantity): The decay time of the function.
Returns: float: The normalization factor for the g function.
- noise(tau=20. * msecond, sigma=1. * pamp, mean=0. * amp)[source]¶
Adds a stochastic noise current. For more information see the Noise section: of Models and neuron groups
- property parameters¶
Returns all the parameters that have been generated for a single compartment.
- Return type:
dict
- synapse(channel, tag, 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'
.tag (str) – A unique name to distinguish synapses of the same type.
g (
Quantity
) – Maximum synaptic conductancet_rise (
Quantity
) – Rise time constantt_decay (
Quantity
) – Decay time constantscale_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', tag='X', g=1*nS, t_decay=5*ms) >>> # same channel, different conductance & source: >>> comp.synapse('AMPA', tag='Y', g=2*nS, t_decay=5*ms) >>> # different channel with both rise & decay kinetics: >>> comp.synapse('NMDA', tag='X' g=1*nS, t_rise=5*ms, t_decay=50*ms)