Segmentation

Before running simulations, we need to set the spatial discretization of the model. The spatial discretization determines the number of segments in a section. The number of segments is calculated based on the frequency-dependent length constant and the spatial discretization coefficient. Spatial discretization also depends on the membrane capacitance and axial resistance of the model. We can do this by setting the values globally for the entire cell.

>>> model.set_parameter('cm', value=1.0)
>>> model.set_parameter('Ra', value=100.0)

Alternatively, we can set the values for specific groups of sections. For example, to set the membrane capacitance and axial resistance for all sections in the model as it was done in the previous tutorial.

The set_segmentation method is used to set the spatial discretization. The spatial discretization coefficient determines the number of segments in a section. The number of segments is calculated based on the frequency-dependent length constant and the spatial discretization coefficient.

>>> model.set_segmentation(d_lambda=0.1, f=100)

We can access the segmentation graph using the seg_tree attribute.

>>> len(model.seg_tree) # number of segments
256

How does it work?

The segmentation process is based on the frequency-dependent length constant and the spatial discretization coefficient. The frequency-dependent length constant is calculated as follows:

\[\lambda_f = \frac{1}{2} \cdot \sqrt{\dfrac{d}{\pi f R_a c_m}}\]

where

  • \(\lambda_f\) - frequency-dependent length constant

  • \(d\) - diameter of the segment

  • \(f\) - frequency

  • \(R_a\) - axial resistance

  • \(c_m\) - membrane capacitance

\[\text{nseg} = \left\lfloor \dfrac{L}{d\_\lambda \cdot \lambda_f} + 0.9 \right\rfloor / 2 \cdot 2 + 1\]

where

  • \(\text{nseg}\) - number of segments

  • \(L\) - length of the section

  • \(d\_\lambda\) - coefficient that determines the spatial discretization