current-voltage relationship
-
pzhang
current-voltage relationship
I'm trying to plot the current-voltage (I vs. V) relationship of a channel/combination of channels. Is this possible in NEURON? It seems like the only plots available are time-dependent. Is there a way to choose what the x-axis is?
Thanks
Thanks
-
ted
- Site Admin
- Posts: 6395
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Absolutely, but first you have to define what you mean by current-voltage relationship.I'm trying to plot the current-voltage (I vs. V) relationship of a channel/combination of channels. Is this possible in NEURON?
Do you mean the steady-state relationship, or do you want the y axis values to be the
current measured at a particular time after a voltage jump from a particular holding potential?
Your answer will dictate the method that is used to generate the graph.
-
pzhang
-
ted
- Site Admin
- Posts: 6395
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Using a Grapher to plot steady-state IV relationhip
The way to do this is to create a model that contains the mechanism you're interested in,I am interested in the steady-state relationship.
then execute this loop (which I have written in human-readable pseudocode):
Code: Select all
v = vstart
while (v<=vend) {
hold the model at v until all mechanisms reach steady state
measure the desired current
plot the current vs. v
increase v by (vend - vstart)/numsteps
}Create a single compartment model and insert the mechanism.
Make sure that parameters have the desired values, e.g. channel density and reversal potential.
Bring up a Grapher
NEURON Main Menu / Graph / Grapher
This graphical tool can be used to implement the loop I wrote above.
If you click on its Plot button, it does the following (more pseudocode!):
Code: Select all
set "Independent Var" equal to "Indep Begin"
while ("Independent Var" <= "Indep End") {
execute the "Generator" statement
for every variable y in the Graph's plot list, plot a new point at coordinates
(X-expr, y)
increase "Independent Var" by ("Indep End" - "Indep Begin") / "Steps"
}Example: if you want v to go from -100 to 50 mV, Indep Begin should be -100, and
Indep End should be 50.
"Steps" is what I called numsteps above. This is 1 less than the number of points at
which you want to plot the current. For example, if v runs from -100 to 50 you'd want
Steps to be 150.
The Grapher comes up with t as its independent variable.
Click on the Grapher's "Independent Var" button and change this to v.
Notice that the X-expr (the x coordinate of the points that the Grapher will plot)
automatically changes to v. This is just what we want. Leave it alone.
Next, make sure that, at each new value of v, the Grapher will force the mechanism to its
steady state at that value of v. The way to do this is to use the standard run system's
finitialize(). So click on the Grapher's "Generator" button. This pops up a window that
asks for a Generator statement. Click in the window's edit field and type the following:
Code: Select all
finitialize(v) fcurrent()Calling finitialize(v) makes all voltage-gated mechanisms reach steady-state at that value
of membrane potential. Calling fcurrent() makes sure that all assigned variables, such as
currents, are computed from the new values of v and gating variables.
All that remains is to add the name of the current to the Graph's plot list. To do this, use
the Graph's Plot what? tool (click on the menu square, select Plot what?, then type the
name of the variable in the edit field, or browse the list of mechanisms and variables
until you have assembled the variable name). For example, to see the hh mechanism's
ina, double click on soma in the left column, then click on ina(0.5) in the middle column.
Or you could simply have typed ina(0.5) in the Plot what? tool's edit field. Click on the
Accept button, and the Plot what? tool will vanish and the current's name will appear
on the Grapher's canvas.
Now click on the Grapher's Plot button.
Use File / save session to save the whole thing to a ses file, for future re-use.
You can plot several different variables in a single Grapher, and you can have as many
different Graphers as you like, each one with its own plot list. They won't interfere with
each other. You can plot gating variables, ionic conductances, currents, or anything you
like.
-
ted
- Site Admin
- Posts: 6395
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
An IV plot with current measured at a particular time
This is an outline of how to plot the IV relationship for a current measured at a particular
time after a voltage jump from a particular holding potential.
This is what you're trying to do, written in pseudocode.
So here's how:
Set up the model, and attach an SEClamp to it. Make sure that the SEClamp's rs is small
so you get good voltage control. Also make sure that dur1 is at least as long as the time
at which you plan to measure the current. Might as well just make it 1e9 (i.e. a billion
milliseconds).
Bring up a RunControl.
Set Init (mv) (this is really v_init) to the desired holding potential.
Set Tstop to the desired time at which current measurements will be made (this is really
tstop).
Bring up a Grapher and use Indep Begin, Indep End, and Steps to set the range of
potentials that you want to explore, and the number of "steps" it should take. For a
single compartment model with hh, you might let these be -100, 50, and 150.
Assuming that the complete name of the SEClamp is SEClamp[0], change the name of
the Independent Var to SEClamp[0].amp1. This means that the Grapher will iterate the
clamp's command potential over the range "Indep Begin" to "Indep End" in "Steps" steps.
Change the X-expr to v. This means that the x coordinate of every plotted point will be
the actual membrane potential, not the clamp's command potential.
Make the Generator statement be this:
So for each new command potential, the Generator statement tells NEURON to run a
new simulation.
Use the Graph's Plot what? tool to specify the name of the variable that is to be plotted,
e.g. ina(0.5) if the model has the hh mechanism.
I just did this, with a model that has hh. I had SEClamp[0].amp1 sweep from -100 to 100
mV in 200 steps. I turned on Keep Lines in the Grapher, set Tstop to 1 ms, and clicked
on the Grapher's Plot button. Then increased Tstop to 2 ms and clicked on Plot again.
Repeated with Tstop equal to 3, 4, and 5 ms. ina collapses pretty quickly at depolarized
membrane potentials, doesn't it? And look at how small it is in the steady state (compare
with the Grapher described in my previous message).
time after a voltage jump from a particular holding potential.
This is what you're trying to do, written in pseudocode.
Code: Select all
Vcmd = vstart
while (Vcmd <= vend) {
initialize the model to the desired holding potential v_init
launch a simulation with membrane potential clamped to Vcmd
at t = tstop measure the current
plot the current vs. v
increase Vcmd by (vend - vstart)/numsteps
}Set up the model, and attach an SEClamp to it. Make sure that the SEClamp's rs is small
so you get good voltage control. Also make sure that dur1 is at least as long as the time
at which you plan to measure the current. Might as well just make it 1e9 (i.e. a billion
milliseconds).
Bring up a RunControl.
Set Init (mv) (this is really v_init) to the desired holding potential.
Set Tstop to the desired time at which current measurements will be made (this is really
tstop).
Bring up a Grapher and use Indep Begin, Indep End, and Steps to set the range of
potentials that you want to explore, and the number of "steps" it should take. For a
single compartment model with hh, you might let these be -100, 50, and 150.
Assuming that the complete name of the SEClamp is SEClamp[0], change the name of
the Independent Var to SEClamp[0].amp1. This means that the Grapher will iterate the
clamp's command potential over the range "Indep Begin" to "Indep End" in "Steps" steps.
Change the X-expr to v. This means that the x coordinate of every plotted point will be
the actual membrane potential, not the clamp's command potential.
Make the Generator statement be this:
Code: Select all
run()new simulation.
Use the Graph's Plot what? tool to specify the name of the variable that is to be plotted,
e.g. ina(0.5) if the model has the hh mechanism.
I just did this, with a model that has hh. I had SEClamp[0].amp1 sweep from -100 to 100
mV in 200 steps. I turned on Keep Lines in the Grapher, set Tstop to 1 ms, and clicked
on the Grapher's Plot button. Then increased Tstop to 2 ms and clicked on Plot again.
Repeated with Tstop equal to 3, 4, and 5 ms. ina collapses pretty quickly at depolarized
membrane potentials, doesn't it? And look at how small it is in the steady state (compare
with the Grapher described in my previous message).
-
pzhang
I was just wondering how does finitialize(v) fcurrent() calculates the steady state current. Looking over the documentation, finitialize calls on the INITIAL block of the mechanism, and sets t=0. Why does it set t =0? and what if the added mechanism, (a new channel) does not have an INITIAL block in the mod file? or am I just not understanding it at all...
thanks
thanks
-
ted
- Site Admin
- Posts: 6395
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Because at the start of a simulation one typically wants t to be 0.pzhang wrote:Why does it set t =0?
Try it and see what happens. Copy hh.mod (from c:\nrn59\src\nrnoc\hh.mod) into anwhat if the added mechanism, (a new channel) does not have an INITIAL block in the mod file?
empty directory, change its SUFFIX to hhx, and delete its INITIAL block. Run mknrndll.
Make a single compartment model that contains the hhx mechanism. Set up graphs
that plot the ionic conductances and m, n, and h. Turn on Keep Lines in the graphs.
Add an IClamp that applies a 0.1 nA x 0.1 ms stimulus starting at t = 1 ms. Run the first
simulation and observe the results. Run another simulation. Run a third.
My bet is you'll see this:
The first time a simulation is run, the mechanism's STATE and ASSIGNED variables will
start at 0 or whatever garbage values left over from whatever data occupied those
locations in the computer's memory.
On subsequent simulation runs, these variables will have the values that were left over
from the end of the previous simulation.
-
thats_karlo
Hi,
I found this post very helpful for me! I didn't know about Grapher. Before this post, i was using the following method:
so, with this code, i start with conditioning cell in stim.amp[0] level for T_0
. I set T_0 to 1000 ms and T_1 to 200 ms. With this way i calculate IV currve for my ionic current,(or any other varibale),
is it a correct method?
Does it equall to Grapher option, if after defining a voltage clamp in my hoc file
and then set parametrs in Grapher to
Indep Begin =stim.amp[1], Indep End=final_step, Independent Var =stim.amp[1] and Generator to run() and from Plot what? my ionic current(here, soma.ina)
or i have some misundrestandigs!
Thanks in advance
Kalro
I found this post very helpful for me! I didn't know about Grapher. Before this post, i was using the following method:
Code: Select all
//define section, geometry and (inset hh insert pas)biophysics parametres
// define voltage clamp parametrs
objref stim
soma stim =new SEVClamp(0.5)
stim.amp[0]=I_0
stim.dur[0]=T_0
stim.amp[1]=I_1
stim.dur[1]=T_1
stim.amp[2]=I_2
stim.dur[2]=T_2
stim.rs=1e-5 // actually =10 ohm
v_init=stim.amp[0]
objref rect, recI
rect = new Vector()
recI.record(&soma.ina(0.5))
rect.record(&t)
// record maximum amplitude of current and volatge step
step=10
final_step=20
for (i=stim.amp[1];i<=final_step;i=i+step){
stim.amp[1]=i
run()
// find maximum amplitude after jump(j), Indeed recI.min(j,end)
// print max amplitude of current and stim.amp[1]
}
. I set T_0 to 1000 ms and T_1 to 200 ms. With this way i calculate IV currve for my ionic current,(or any other varibale),
is it a correct method?
Does it equall to Grapher option, if after defining a voltage clamp in my hoc file
Code: Select all
objref stim
soma stim =new SEVClamp(0.5)
stim.rs=1e-5
Indep Begin =stim.amp[1], Indep End=final_step, Independent Var =stim.amp[1] and Generator to run() and from Plot what? my ionic current(here, soma.ina)
or i have some misundrestandigs!
Thanks in advance
Kalro
-
thats_karlo
Yes, the code is working. just i like to compare results.
in my code, in put cell in conditioning for long time (T_0=1000msec), what about Grapher?
Dose Grapher know, when we have jump in volatge step? ( T_1 in the code.)
Doese Grapher have a good precesion? should we take care about "dt" and "nseg"?
thanks again!
in my code, in put cell in conditioning for long time (T_0=1000msec), what about Grapher?
Dose Grapher know, when we have jump in volatge step? ( T_1 in the code.)
Doese Grapher have a good precesion? should we take care about "dt" and "nseg"?
thanks again!
-
ted
- Site Admin
- Posts: 6395
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
The Grapher is thoroughly documented in the Programmer's Reference--seethats_karlo wrote:in my code, in put cell in conditioning for long time (T_0=1000msec), what about Grapher?
Dose Grapher know, when we have jump in volatge step? ( T_1 in the code.)
Doese Grapher have a good precesion? should we take care about "dt" and "nseg"?
thanks again!
http://www.neuron.yale.edu/neuron/stati ... ml#Grapher
It only controls simulation execution. It uses the same computational engine and standard
run system that would be used by hoc code. It is not a model specification tool. Choice of
dt and nseg are entirely up to the user. If you specify nseg that is too small, or dt that is
too big, for good spatiotemporal accuracy, then it will faithfully grind out inaccurate
solutions--exactly like you would get by controlling simulation execution via hoc code.