Hi,
I have a question about how the surface area of a compartmental model is computed.
My understanding from the docstring of a Cylinder is that the Length argument specifies its total length, independent of how many compartments (n) it has.
Yet the input resistance of a cylinder appears to change when the number of compartments changes in a way that cannot be explained by the increased accuracy of the spatial discretization.
I suppose I’m getting the concept of the “compartments” wrong - I’m thinking of it as the equivalent of “nseg” in the NEURON simulation environment.
Here is an example to reproduce the issue:
import numpy as np
import brian2 as b2 # Sorry I'm obsessed with separating namespaces
gL = 1e-4*b2.siemens/b2.cm**2 # Leak conductance
EL = -80*b2.mV
tbase = 50.0*b2.ms
tpulse = 200.0*b2.ms
duration = 400.0*b2.ms
Iamp = 10e-12*b2.amp # Current injection amplitude (10 pA)
nseg = 11 # Number of compartments in the dendrite; change this to see the effects on input resistance
# A simple passive membrane
eqs = '''
Im = gL*(EL-v) : amp/meter**2
I : amp (point current)
'''
morpho = b2.Soma(diameter=20*b2.um)
morpho.dendrite = b2.Cylinder(length=1000*b2.um, diameter=10*b2.um, n=nseg)
# Axial resistance is negligibly low - effectively this is a single compartment
neuron = b2.SpatialNeuron(morphology=morpho, model=eqs, Cm=1*b2.uF/b2.cm**2, Ri=1e-3*b2.ohm*b2.cm)
neuron.v = EL
neuron.I = 0*b2.amp
# Monitors
mon = b2.StateMonitor(neuron, 'v', record=True)
b2.run(tbase)
neuron.I = Iamp
b2.run(tpulse)
neuron.I = 0*b2.nA
b2.run(duration-tpulse-tbase)
# Compute input resistance from simulation values
vbase = mon.v[0][mon.t<tbase][-1]
vmax = mon.v[0][mon.t<tbase+tpulse][-1]
delta_v = vmax-vbase
rin_sim = delta_v / Iamp
# Compute total membrane area according to brian2, and compare with theory
total_area_sim = np.sum(morpho.area) + np.sum(morpho.dendrite.area)
total_area_theory = \
4.0*np.pi*(morpho.diameter/2.0)**2 + \
np.pi*morpho.dendrite.diameter[0]*np.sum(morpho.dendrite.length)
# Compute theoretical input resistance
rin_theory = 1.0/(gL * total_area_sim)
print("Total surface area (brian2): ", total_area_sim)
print("Total surface area (theory): ", total_area_theory)
print("Input resistance (brian2): ", rin_sim)
print("Input resistance (theory): ", rin_theory)
Output for nseg=11:
Total surface area (brian2): 0.03267256 mm^2
Total surface area (theory): [0.03267256] mm^2
Input resistance (brian2): 0.36725744 Gohm
Input resistance (theory): 30.60671983 Mohm
I.e. the input resistance is nseg+2 times higher than what I would have expected.
I’m running brian2 v2.4.2 with Python 3.8.
What am I getting wrong here?
Thank you for your help.
Christoph