CoreNeuron icon indicating copy to clipboard operation
CoreNeuron copied to clipboard

Questions on details of i_membrane (LFP calculation)

Open iomaganaris opened this issue 3 years ago • 3 comments

Similar to the calculation of fast_imem in NEURON we added the same functionality for reporting i_membrane in CoreNEURON. There are still some details about this current that need clarification. According to @nrnhines :

Membrane current is capacity current + density channel current + synaptic current. 
What that leaves out is axial current entering and leaving the segment from adjacent 
segments and electrode current (e.g voltage clamp or current clamp) The sum 
of all those is 0.0

Regarding this, Sirio from BBP tried to figure out how i_membrane calculation in CoreNEURON corresponds to NEURON and to find out which currents sum up to 0 here. The following graph sums up his findings. image-2020-06-26-13-27-21-963 i_membrane report in CoreNEURON is the same as the i_membrane report in NEURON (using the fast_imem calculation) while the summation report of i_membrane+IClamp in NEURON is not summing up to 0. The question that rises here is what other current should be summed up to reach to 0.

Trying to reproduce this simulation I also figured out that i_membrane+IClamp summation report in NEURON is almost the same as the i_membrane compartment report, apart from the first segment of a cell, where the IClamp current in non zero.

i_membrane compartment report in NEURON (fast_imem)

Data at timestep 99 0.0140638 -0.00108328 -0.00110343 -0.000881509 -0.000802516 -0.000708767 -0.000645 -0.000485749 -0.000446145 -0.000378441 -0.000315356 0.00119649 0.000896356 0.000415572 0.000426732 0.00040748 0.000399997 0.000394846 0.000391382 0.000438628 0.000471253 0.000290593 0.000428981 0.000354215 0.000650497 0.000476759 0.000345329 0.000321212 0.000252964 0.000566931 0.000482578 0.000399393 0.000393223 0.00038937 0.000387398 0.000317225 0.000264121 0.000225824 0.000562277 0.000555662 0.000550073 0.000452601 0.000410692 0.000405133 0.000401738 0.000399994 0.000358742 0.000302987 0.000157317 0.000207441 0.000334098 0.00140512 0.00033919 0.000601886 0.00059498 0.000589216 8.40189e-05 0.00024965 0.000345437 0.000212885 0.000266979 0.000265417 0.000264574 0.00050691 0.000478338 0.000393115 0.000388446 0.000337048 0.000332955 0.000330355 0.000255314 0.000103523 0.000341993 0.000339996 0.000540576 0.000373752 0.0003196 0.000281111 0.00032552 0.000299636 0.000414235 0.000461924 0.000378548 0.000384528 0.000311476 0.000650915 0.000537839 0.00039266 0.000389677 0.000388118 4.56088e-05 0.0010617 0.000318318 0.000259727 0.000255704 0.00031161 0.000284807 0.000257989 0.000591343 0.000383967 0.000363218 0.000321715 0.00050981 0.000414613 0.000406658 0.000401574 0.000398986 0.00186876 0.00127133 0.000842847 0.000341702 0.0012447 0.00116714 0.000745604 0.0006268 0.000801857 0.000602423 0.00059211 0.000582229 0.000568747 0.000241508 0.000235662 0.000229941 0.00040104 0.00030987 0.000306308 0.000303179 0.000300487 0.000318455 0.000254276 0.000251731 0.000249422 0.000242293 0.000235759 0.000182953 0.000200865 0.000265924 0.000262809 0.000259938 0.000257313 0.000229356 0.000252328 0.00025042 0.000197045 0.00015474 0.000293697 0.000290086 0.000286752 0.000283734 0.000416993 0.000559898 0.000557697 0.00111621 0.000399639 0.000347439 0.000342363 4.22746e-05 0.000329235 0.000363974 0.000334511 0.000239462 0.000238572 0.000237847 0.000490827 0.000359979 0.000284622 0.00028209 0.000279784 0.000277706 0.00027586 0.000274255 0.000272897 0.000271793 0.0004574 5.80178e-05 0.000132679 0.000716727 0.00047859 0.000221778 0.000394567 0.000262209 0.000208094 0.000506314 0.000342122 0.000337898 0.000334743 0.000332388 0.000356791 0.000316091 0.000293907 0.000244429 0.00031073 0.000256935 0.000254087 0.000318017 0.000316102 0.000314746 0.000313815 0.000313219 0.000434513 0.000633797 0.000401022 0.000397773 0.000464436 0.000332259 0.000327973 0.000262639 0.000246384

i_membrane+IClamp summation report in NEURON

Data at timestep 99 -0.0779561 -0.00108329 -0.00110343 -0.000881509 -0.000802518 -0.000708765 -0.000644999 -0.000485747 -0.000446144 -0.000378442 -0.000315355 0.00119649 0.000896356 0.000415571 0.000426732 0.00040748 0.000399997 0.000394847 0.000391382 0.000438628 0.000471253 0.000290593 0.000428981 0.000354215 0.000650497 0.000476759 0.000345329 0.000321212 0.000252964 0.000566931 0.000482577 0.000399392 0.000393223 0.000389369 0.000387397 0.000317225 0.000264121 0.000225824 0.000562277 0.000555662 0.000550072 0.000452602 0.000410692 0.000405133 0.000401739 0.000399995 0.000358742 0.000302987 0.000157317 0.000207441 0.000334098 0.00140512 0.00033919 0.000601886 0.00059498 0.000589216 8.40188e-05 0.00024965 0.000345437 0.000212885 0.000266979 0.000265417 0.000264574 0.000506909 0.000478338 0.000393115 0.000388446 0.000337048 0.000332955 0.000330355 0.000255314 0.000103524 0.000341993 0.000339996 0.000540576 0.000373752 0.0003196 0.00028111 0.000325521 0.000299637 0.000414235 0.000461924 0.000378548 0.000384528 0.000311477 0.000650915 0.00053784 0.00039266 0.000389677 0.000388118 4.56092e-05 0.0010617 0.000318318 0.000259728 0.000255704 0.00031161 0.000284806 0.000257989 0.000591343 0.000383967 0.000363219 0.000321714 0.00050981 0.000414612 0.000406657 0.000401573 0.000398986 0.00186876 0.00127133 0.000842846 0.000341702 0.0012447 0.00116714 0.000745603 0.0006268 0.000801857 0.000602423 0.00059211 0.000582229 0.000568747 0.000241508 0.000235662 0.000229941 0.000401039 0.000309871 0.000306309 0.00030318 0.000300487 0.000318455 0.000254276 0.00025173 0.000249422 0.000242292 0.00023576 0.000182953 0.000200865 0.000265924 0.000262809 0.000259938 0.000257313 0.000229356 0.000252328 0.00025042 0.000197045 0.00015474 0.000293697 0.000290086 0.000286752 0.000283734 0.000416994 0.000559897 0.000557697 0.00111621 0.000399639 0.000347439 0.000342363 4.22744e-05 0.000329235 0.000363974 0.000334511 0.000239462 0.000238572 0.000237847 0.000490827 0.000359979 0.000284622 0.00028209 0.000279785 0.000277706 0.00027586 0.000274255 0.000272897 0.000271794 0.0004574 5.80175e-05 0.00013268 0.000716726 0.00047859 0.000221778 0.000394567 0.000262209 0.000208094 0.000506314 0.000342122 0.000337898 0.000334743 0.000332387 0.000356791 0.000316091 0.000293907 0.000244429 0.00031073 0.000256935 0.000254087 0.000318016 0.000316102 0.000314746 0.000313814 0.000313219 0.000434513 0.000633797 0.000401022 0.000397773 0.000464436 0.000332259 0.000327973 0.000262638 0.000246384

Furthermore, for the LFP calculation specifically there is the question whether the IClamp current should be used in the calculation or simply the i_membrane current is only needed, given that there is some stimulus current. In case that the IClamp should be added to the calculation of LFP, then this means that the reporting of the IClamp current should be implemented in CoreNEURON, so that the two currents can be added after the simulation and then used as input to calculate the LFP.

cc: @jamesgking @pramodk @bdelmarm

iomaganaris avatar Sep 01 '20 11:09 iomaganaris

On another topic regarding LFP, can one extract, in Neuron, segment coordinates (in a reference frame cell specific) in the same way as one can extract positions of the section arc? Thanks.

bdelmarm avatar Sep 02 '20 09:09 bdelmarm

The details really depend on the details. We need an example model to examine. In NEURON the attempt to match i_membrane_ with a manual addition of all the expected currents from the RANGE variables is straightforward only with the variable time step method where everything is defined at the same value of t. With the fixed step method, different current categories may have to be adjusted from their presented values at t-dt/2 (when secondorder=2) or an even more complicated mixed processing (secondorder=0 or 1) that is too tedious to go into here. If the questions are interpreted at a more superficial level, it helps to see the electrical equivalent circuit of the mode on which one can point to the membrane current, axial currents,and electrode currents.

nrnhines avatar Sep 03 '20 20:09 nrnhines

can one extract, in Neuron, segment coordinates

That has been written many times and it is an oversight that it is not a built-in method for nrn.Segment called xyz that would return the coordinate tuple. For now one must compute it from the 3d information of a Section and the segment x*L value.. ie the linear interpolation of the 3-d points along the centroid that span the center of the segment.

nrnhines avatar Sep 03 '20 20:09 nrnhines