vladimirov wrote:Could anyone give a hint how to efficiently calculate LFP of a multicompartment cell?
The extracellular mechanism reports total transmembrane current--you can read about it in the Programmer's Reference. Of course there are many steps between that and a complete implementation. For an approach implemented entirely with hoc see
Extracellular stimulation and recording in the
Hot tips area of The NEURON Forum. The "line source" approach was used by
Gold, C., Henze, D., Koch, C. and Buzsaki, G..
On the origin of the extracellular action potential waveform: a modeling study.
Journal of Neurophysiology 95:3113-3128, 2006 (source code available from ModelDB
http://modeldb.yale.edu/).
You may also want to check out the URLs listed in the Forum post you cited, to see if others have made their code available.
How to sum up all currents in a cable segment in a computationally efficient and esthetically acceptable way?
Calculate the weighted sum of membrane currents by iterating over all segments of all sections (forall for (x,0) does this), at each point applying the appropriate weight (actually a transfer resistance) and adding the result to the sum.
After I know total current in each segment at each time step, how can I record it during the simulation?
Use the Vector class's record method. If you really want all that data, right after model setup do the following (expressed here in a mix of pseudocode and hoc):
- Code: Select all
objref dvecs
dvecs = new List() // will hold all of the Vectors to which data will be recorded
forall for (x,0) {
tmpvec = new Vector()
tmpvec.record(&i_membrane(x)) // records i_membrane of currently accessed segment
// of currently accessed section
dvecs.append(tmpvec)
}
objref tmpvec // prevent careless programmer damage to last element in the List
At this point, every simulation run will cause a fresh recording of membrane current throughout the model; specifically, dvec.o(i) will be the Vector that holds the recording of the time course of i_membrane at the ith internal node of the model cell. After a run, just open a file and write all the data to that file (or do whatever else you want with it).
Should I add customary proc advance(), as suggested by Ted Carnevale in another post?
?? Not at all necessary if you just want to record all membrane currents. The thread you cited was about calculating the field in the course of simulation.