Question about using LFPsim from modelDB(#190140)
Moderator: tom_morse

 Posts: 79
 Joined: Mon May 19, 2014 10:39 pm
Question about using LFPsim from modelDB(#190140)
I'm trying to implement the LFPsim tool which can record the LFP from the single neuron into my own neuron model. LFPsim is just developed and published by Parasuram et al., 2016 http://journal.frontiersin.org/article/ ... 0065/full#, and can be downloaded from modelDB https://senselab.med.yale.edu/modeldb/s ... 140#tabs1.
I'm aware of Ted have one model example recording LFP also http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip, so before I tested LFPsim on my own model, I tested it on Ted's example and compare the results. I expect the LFPsim should give me same results, but there seems to be a significant differences：I set the electrodes in LFPsim at the same locations as in Ted's example which is (XE=50,YE=0,ZE=0), but the readings from LFP trace (for example, Point Source Approximation in LFPsim) shows opposite polarity, i.e. when LFP in Ted's example being negative, LFPsim shows positive, or the other way around. Couldn't figure this out for couple of days.
I know that in Ted's example, calculation like the contribution of i_membrane to LFP was done by BEFORE AFTER SOLVE block in mod file, whereas LFPsim doesn't use any of these. Does this cause the polarity differences in LFP results?
I'm aware of Ted have one model example recording LFP also http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip, so before I tested LFPsim on my own model, I tested it on Ted's example and compare the results. I expect the LFPsim should give me same results, but there seems to be a significant differences：I set the electrodes in LFPsim at the same locations as in Ted's example which is (XE=50,YE=0,ZE=0), but the readings from LFP trace (for example, Point Source Approximation in LFPsim) shows opposite polarity, i.e. when LFP in Ted's example being negative, LFPsim shows positive, or the other way around. Couldn't figure this out for couple of days.
I know that in Ted's example, calculation like the contribution of i_membrane to LFP was done by BEFORE AFTER SOLVE block in mod file, whereas LFPsim doesn't use any of these. Does this cause the polarity differences in LFP results?

 Site Admin
 Posts: 5334
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Question about using LFPsim from modelDB(#190140)
Not quite right. Membrane current density is calculated during fadvance(). xtra.mod merely converts current density in mA/cm2 to absolute current in nA. This has nothing to do with the polarity difference you observed.breakwave922 wrote:in Ted's example, calculation like the contribution of i_membrane to LFP was done by BEFORE AFTER SOLVE block in mod file
Suggest you do a simple test with a model axon 1 um diameter x 2000 um long, Ra 100 ohmcm, cm 1 uf/cm2, nseg 71, with the hh mechanism. Trigger a spike at the 0 end and observe extracellular potential at a point that is 100 um from the axon and lies in the plane that is perpendicular to the middle of the axon. You should see a triphasic response that consists of an initial small, brief positivity followed by a large negativity after which there is a small but longer lasting positivity. If LFPsim shows a triphasic response that has opposite polarity, then you'll have to scour their documentation to discover whyor maybe just ask the developers of LFPsim.
I should mention that some experimentalists plot extracellular potential with negative up and positive down. I do not know the origins of that convention or its rationale.

 Posts: 79
 Joined: Mon May 19, 2014 10:39 pm
Re: Question about using LFPsim from modelDB(#190140)
Ted,
Thanks a lot for the reply.
I was able to record the LFP with the same properties you expected when checking the simple test example.
In this simple test model, I have another questions: the distance r from each segment to electrode is supposed to be calculated according to segment's and electrode's coordinates, so the r for each segment varies when segment changes. This is how I got the expected LFP waveform. However, if I set all the r to a same value for all segments, the computed LFP is just the scale version of current injection, with scale factor depending on the set value of r, i.e. the LFP waveform is just like rectangular function, reflecting current on and off time. From my understanding, from checking the point source approximation equation (PSA) for LFP which is LFP=sum((i_membrane(j)/(4*pi*sigma*rj))), where j denotes for different segments or sections, if rj is the same, this equation can be expressed as (4*pi*sigma*rj)*(sum(i_membrane(j))) and it is equal to (4*pi*sigma*ri)*Iinject, because the summedup i_membrane from all segments or sections is Iinject. However, in the real case, rj cannot be the same for all locations, then we have the right LFP waveform. Is my understanding correct?
I also checked the pilot LFP computing example,http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip, and if I set r to be constant for all segments/sections, in calcrxc.hoc, the recorded vrec's (LFP) waveform is just the scale version of current injections.
Please correct me if I'm wrong.
Thanks a lot for the reply.
I was able to record the LFP with the same properties you expected when checking the simple test example.
In this simple test model, I have another questions: the distance r from each segment to electrode is supposed to be calculated according to segment's and electrode's coordinates, so the r for each segment varies when segment changes. This is how I got the expected LFP waveform. However, if I set all the r to a same value for all segments, the computed LFP is just the scale version of current injection, with scale factor depending on the set value of r, i.e. the LFP waveform is just like rectangular function, reflecting current on and off time. From my understanding, from checking the point source approximation equation (PSA) for LFP which is LFP=sum((i_membrane(j)/(4*pi*sigma*rj))), where j denotes for different segments or sections, if rj is the same, this equation can be expressed as (4*pi*sigma*rj)*(sum(i_membrane(j))) and it is equal to (4*pi*sigma*ri)*Iinject, because the summedup i_membrane from all segments or sections is Iinject. However, in the real case, rj cannot be the same for all locations, then we have the right LFP waveform. Is my understanding correct?
I also checked the pilot LFP computing example,http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip, and if I set r to be constant for all segments/sections, in calcrxc.hoc, the recorded vrec's (LFP) waveform is just the scale version of current injections.
Please correct me if I'm wrong.

 Site Admin
 Posts: 5334
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Question about using LFPsim from modelDB(#190140)
I'm not sure what your sentence means. Are you saying that LFPsim produced a waveform that has the properties I described?breakwave922 wrote:I was able to record the LFP with the same properties you expected when checking the simple test example.
That is to be expected. It has nothing to do with your original observation.if I set all the r to a same value for all segments, the computed LFP is just the scale version of current injection, with scale factor depending on the set value of r
"rj cannot be the same . . ." is true. The calculated LFP is "correct" if the rj values are correct.in the real case, rj cannot be the same for all locations, then we have the right LFP waveform.

 Posts: 79
 Joined: Mon May 19, 2014 10:39 pm
Re: Question about using LFPsim from modelDB(#190140)
No, LFPsim produced differently. I already contact the developer to discuss. What I meant is, I developed a code based on the techniques from http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip, and got the expected results, but when I used LFPsim to check on this simple model, I had totally different result.ted wrote:I'm not sure what your sentence means. Are you saying that LFPsim produced a waveform that has the properties I described?breakwave922 wrote:I was able to record the LFP with the same properties you expected when checking the simple test example.
Imagine we have twocompartment cell model with single segment in each compartment, and each compartment has the same length and diameter, if we set the electrode and observe the extracellular potential at any point lies in the plane that is perpendicular to the middle of the cell, will the recorded LFP be just the scaled version of current injection, due to the fact that the distance from the testing point to each compartment is the same in this particular case?ted wrote:"rj cannot be the same . . ." is true. The calculated LFP is "correct" if the rj values are correct.breakwave922 wrote:in the real case, rj cannot be the same for all locations, then we have the right LFP waveform.
I know it's not true that I set the distance to the same values by force to multicompartment cell, but in this twocompartment cell case, the same distance is what we will have from calculation in this middle plane for testing.

 Site Admin
 Posts: 5334
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Question about using LFPsim from modelDB(#190140)
Only if each compartment has the same membrane current. This will happen only ifImagine we have twocompartment cell model with single segment in each compartment, and each compartment has the same length and diameter, if we set the electrode and observe the extracellular potential at any point lies in the plane that is perpendicular to the middle of the cell, will the recorded LFP be just the scaled version of current injection
1. the current is injected at the node that connects the 1 end of the parent compartment to the 0 end of the child compartment,
or
2. identical currents are injected into both compartments simultaneously

 Posts: 79
 Joined: Mon May 19, 2014 10:39 pm
Re: Question about using LFPsim from modelDB(#190140)
Ted, thanks for the response.ted wrote:Only if each compartment has the same membrane current. This will happen only ifImagine we have twocompartment cell model with single segment in each compartment, and each compartment has the same length and diameter, if we set the electrode and observe the extracellular potential at any point lies in the plane that is perpendicular to the middle of the cell, will the recorded LFP be just the scaled version of current injection
1. the current is injected at the node that connects the 1 end of the parent compartment to the 0 end of the child compartment,
or
2. identical currents are injected into both compartments simultaneously
About the second requirement, "identical currents are injected into both compartments simultaneously", do you mean the electrode current injection into both compartments, or it just means the transmembrane currents (i_membrane from extracellular mechanism) into both compartments?
Regarding the LFP computing on twocompartment cell model, I have a twocompartment model, where soma has nseg=1, L=15, diam=15, and dend has nseg=1, L=150, diam=10; Na,K, and leak channels are present in both soma and dend with different conductance densities.
When I recorded the LFP at any point in the middle plane of the cell (so, to each compartment, the distance r is always the same), I always got the scaled version of current injection, regardless of current injection's position onto the cell, either onto soma or dend.
In this twocompartment case, do "each compartment has the same membrane current" and "identical currents are injected into both compartments simultaneously"mean because the axial current flows into one compartment has the same magnitude as the axial current flow out of another compartment but with opposite sign, which would result in the zero sumup membrane currents; then, given the same distance to each compartment in the middle plane, the computed LFP in this plane will just be the scaled version of external current injection?

 Site Admin
 Posts: 5334
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Question about using LFPsim from modelDB(#190140)
Sorry, my reply from 8/2 is incorrect. Given a multicompartmental model, it is easy to show that
if there is any point P that satisfies the condition
"all transfer resistances between P and the model's compartments are identical"
then the field potential observed at P will equal Rx*Iinj
where Rx is the transfer impedance between P and any compartment
and
Iinj is the current injected into the cell (e.g. by an electrode). Furthermore, there are no restrictions regarding compartment size. Also, if more than one electrode is attached to the cell, the field potential observed at P will equal Rx * SUMMA Iinj
where SUMMA Iinj is the sum of all injected currents.
The most direct proof involves application of Kirchhoff's current law and proceeds by induction, starting with a single compartment model, then a two compartment model, then a model with an arbitrary number of compartments.
if there is any point P that satisfies the condition
"all transfer resistances between P and the model's compartments are identical"
then the field potential observed at P will equal Rx*Iinj
where Rx is the transfer impedance between P and any compartment
and
Iinj is the current injected into the cell (e.g. by an electrode). Furthermore, there are no restrictions regarding compartment size. Also, if more than one electrode is attached to the cell, the field potential observed at P will equal Rx * SUMMA Iinj
where SUMMA Iinj is the sum of all injected currents.
The most direct proof involves application of Kirchhoff's current law and proceeds by induction, starting with a single compartment model, then a two compartment model, then a model with an arbitrary number of compartments.

 Posts: 79
 Joined: Mon May 19, 2014 10:39 pm
Re: Question about using LFPsim from modelDB(#190140)
ted wrote: Given a multicompartmental model, it is easy to show that
if there is any point P that satisfies the condition
"all transfer resistances between P and the model's compartments are identical"
then the field potential observed at P will equal Rx*Iinj
where Rx is the transfer impedance between P and any compartment
and
Iinj is the current injected into the cell (e.g. by an electrode). Furthermore, there are no restrictions regarding compartment size.
Ted, Thanks. This is exactly what I was thinking of. From Kirchhoff's current law, it's easy to prove this in computational models.
I still want to discuss with you whether this is reflecting the real case. If we test the LFP on one real cell, and assume we could find some point in the real space, where all transfer resistances to all cell's compartments locations are identical, do you think then the LFP would equal to Rx*Iinj? For example, if we put the LFP electrode very very far from the cell body, then the transfer resistances will be almost identical regardless of the compartment size, then the LFP is just Rx*Iinj?
Or, in one particular case where testing LFP on twocompartment cell, we don't need to put the electrode far away to satisfy the condition. For twocompartment cell, it's easy to find the location satisfies the requirement, like, if we test the LFP at any point in the middle perpendicular plane of the cell, will then the LFP be just equal to Rx*Iinj? Means, the LFP testing data in this plane would not have any frequency or neuronal activity information.
Maybe it's hard to find two compartment cell, but I'm just curious about this.