Membrane currents

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
wvangeit
Posts: 21
Joined: Wed Jun 11, 2008 2:14 am

Membrane currents

Post by wvangeit »

I want to write a function in my python code, that automatically writes every time step all the membrane currents in a segment to a file.
I have all the code for this, the only piece I'm missing is a way to automatically find out all the fields that are available in a segment (the _ref_ attributes), is there a solution for this ? (Is there actually a function in hoc for this, I couldn't find any ? Because then I could also send the names from hoc to python)

And a slightly related question. At the moment I'm using variable time step, but I need output files in fixed time step. Is there a way, using functions from neuron, to get an interpolated output vector using the fixed time step ?
I know that it's possible with the tvec to force neuron to write to a vector at fixed time steps, but this slows down the simulation, so I would prefer in an interpolation method.

Thx,

Werner Van Geit
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Membrane currents

Post by ted »

wvangeit wrote:I want to write a function in my python code, that automatically writes every time step all the membrane currents in a segment to a file.
Do you expect to collect so much data that you can't use the Vector class's record() method to capture the data, then write it to file after the end of the simulation?
I have all the code for this, the only piece I'm missing is a way to automatically find out all the fields that are available in a segment (the _ref_ attributes), is there a solution for this ? (Is there actually a function in hoc for this, I couldn't find any ? Because then I could also send the names from hoc to python)
hoc's psection() will tell you what mechanisms have been inserted into a section. This will include the names of all point processes that are attached, but not their locations, so if there is a point process of interest you will have to discover its location in order to decide which segment it belongs to; this can be done with get_loc (see http://www.neuron.yale.edu/neuron/stati ... ml#get_loc for an example of usage). For any of these mechanisms, the only way to discover the names of hoc-accessible currents is by examining its NMODL source code. Look for
USEION x . . . WRITE ix
and
NONSPECIFIC_CURRENT i
statements in the NEURON block.

Remember to use suffix syntax for currents generated by density mechanisms and dot syntax for currents generated by point processes. Also remember that point process currents are in absolute units (uA) but density mechanism currents are in mA/cm2, so the latter should be multiplied by segment area; scaling will be necessary because hoc's area(x) reports the area of the segment that contains location x in units of um2.
I know that it's possible with the tvec to force neuron to write to a vector at fixed time steps, but this slows down the simulation
That's surprising. Interpolation is mere algebra, which is much faster than numerical integration. I wonder if the slowing isn't really caused by the fact that you're trying to write each new set of interpolated data when they are interpolated. it should be faster to simply capture the interpolated values to Vectors with the Vector class's record method, and defer writing output until the end of the simulation.
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: Membrane currents

Post by hines »

names are obtainable from
http://www.neuron.yale.edu/neuron/stati ... htype.html
http://www.neuron.yale.edu/neuron/stati ... hstan.html
but whether an ASSIGNED is a current can only safely be gleaned from the mod file
except for the ion models such as na_ion, etc.

With variable step methods it is fastest to Vector.record without specifying time points
(also Vector.record(&t)) so as to not force time step boundaries and then
interpolate after the run with
http://www.neuron.yale.edu/neuron/stati ... nterpolate
Of course the final Vector is only second order correct whereas the forcing particular time points with the
dt or tvec arg gives full cvode accuracy since cvode interpolates using its current order.
wvangeit
Posts: 21
Joined: Wed Jun 11, 2008 2:14 am

Re: Membrane currents

Post by wvangeit »

Thx,
Sorry that I didn't notice the interpolate function in the documentation.

Werner
Post Reply