graphs in extracelllular stimulation

Anything that doesn't fit elsewhere.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

graphs in extracelllular stimulation

Post by shwetakgp »

dear ted ,
i have a made a model of extracellular stimualtion on a simple cell with Na,k and leakage channels.It runs but i think the behaviour of graphs is not as it should be.could you check??? .It would be kind of you to give it a look.should i mail it to you??
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: graphs in extracelllular stimulation

Post by ted »

That's the only way I'm going to see what you're talking about. I see something in my Inbox today that appears to be from you, with this subject line SHWETAKGP EXTRACELLULARSTIM.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

dear ted,
i am really sorry but i mailed you that file days before and i made a lot of changes after that.I am sending you the final file now.
please check it if you will find it okey then i will show it to my supervisor so it would be a big favour if you give it a look.
once again apologies for the inconvenience
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

my model is working properly but at t= 10, if i make the amplitude of extrenal stimulation pulse= 0,It still shows an action potential
how could i incorporate an electrode with cylindrical dimensions?
how can i make a biphasic multipulse waveform?
i was thinking that maybe i could add more vectors like this-more vectors like in this- // index 0 1 2 3 4 5
// stim vec 0, 0, 1, 1, 0 0
// time vec 0, DEL, DEL, DEL+DUR, DEL+DUR, DEL+DUR+1
// really 0, $1, $1, $1+$2, $1+$2, $1+$2+1
// first the stim vector
stim_amp.resize(6)
stim_amp.fill(0)
stim_amp.x[2]=1
stim_amp.x[3]=1
stim_amp.mul($3)
// now the time vector
stim_time.resize(6)
stim_time.x[1]=$1
stim_time.x[2]=$1
stim_time.x[3]=$1+$2
stim_time.x[4]=$1+$2
stim_time.x[5]=$1+$2+1
any help is appreciated
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: graphs in extracelllular stimulation

Post by ted »

shwetakgp wrote:i am really sorry but i mailed you that file days before and i made a lot of changes after that.I am sending you the final file now.
Sorry the earlier file was languishing in my inbox. I checked out your most recent version and replied a few minutes ago. You're well along on the right track; just a few things need to be fixed. After that you should be able to demonstrate direct excitation and also anode-break excitation.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

thank you ted for your reply i want the channels i created through cell builder to be used. should i disable hh and pas mechanisms for axon and soma?
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

thanks ted now it is working fine. could you answer the aobve queries if you find time..
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: graphs in extracelllular stimulation

Post by ted »

shwetakgp wrote:my model is working properly but at t= 10, if i make the amplitude of extrenal stimulation pulse= 0,It still shows an action potential
Because you included a "leak" current that has a reversal potential of 54.3 mV. That provides a strong depolarizing drive.
how could i incorporate an electrode with cylindrical dimensions?
Make the rx_xtra values equal to the transfer resistances between your electrode and the middle of each segment of your model cell. How you figure out what those values should be is up to you.
how can i make a biphasic multipulse waveform?
i was thinking that maybe i could add more vectors like this-more vectors like in this- // index 0 1 2 3 4 5
// stim vec 0, 0, 1, 1, 0 0
// time vec 0, DEL, DEL, DEL+DUR, DEL+DUR, DEL+DUR+1
// really 0, $1, $1, $1+$2, $1+$2, $1+$2+1
// first the stim vector
stim_amp.resize(6)
stim_amp.fill(0)
stim_amp.x[2]=1
stim_amp.x[3]=1
stim_amp.mul($3)
// now the time vector
stim_time.resize(6)
stim_time.x[1]=$1
stim_time.x[2]=$1
stim_time.x[3]=$1+$2
stim_time.x[4]=$1+$2
stim_time.x[5]=$1+$2+1
That would work, although it would be tedious if you have to generate more than a few pulses. Another possibility is to use NEURON's event delivery system to control the stimulus current. Something like this might do the trick:

Code: Select all

DUR = 0.1  // ms, duration of each pulse
AMP = 0.1  // nA
START = 5  // ms, time of first pulse
INTERVAL = 25  // ms, interval between pulse starts
// assumes DUR < INTERVAL

objref fih
fih = new FInitializeHandler("initi()")

STIMON = 0

proc initi() {
  STIMON = 0
  cvode.event(START, "seti()")
// print "launched event that will turn on pulse at ", START
}

proc seti() {
// print "t = ", t
  if (STIMON==0) {
    STIMON = 1
    axon is_xtra = AMP // assumes your model includes a section called axon
      // if not, substitute the name of some section that does exist
    cvode.event(t + DUR, "seti()")
// print "launched event to turn pulse off"
  } else {
    STIMON = 0
    axon is_xtra = 0
    cvode.event(t + INTERVAL, "seti()")
// print "launched event to turn next pulse on"
  }
  // we've changed a parameter abruptly
  // so we really should re-initialize cvode
  if (cvode.active()) {
    cvode.re_init()
  } else {
    fcurrent()
  }
}
This could be refined by including a counter that keeps track of how many pulses have been generated, so that you can stop it after a certain number of pulses.

I suggest you test your waveform code with a simple program that uses Vector play() to drive a variable that you can plot vs. time.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: graphs in extracelllular stimulation

Post by ted »

shwetakgp wrote:i want the channels i created through cell builder to be used. should i disable hh and pas mechanisms for axon and soma?
Are you asking "should I just use the built-in hh mechanism, or should I use the channels that I built with the Channel Builder?" The choice is up to you. Decide which set of channels you want and use those.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

i tried with the vector play method but i cnt figure out what should be after the value of stim_time after this stim_time.x[6]=$1+$2+1. i cnt understand why 1 has been added in this statement. I tried simply by del+dur+dur but it when i run it the window disappears
and i cnt understand the use of finitialise handler ... first thing it was said that it Installs an initialization handler statement to be called during a call to finitialize . The default type is 1. The statement will be executed at the top level of the interpreter or else in the context of the optional obj arg.
what does that initialization handler statement mean
Make the rx_xtra values equal to the transfer resistances between your electrode and the middle of each segment of your model cell. How you figure out what those values should be is up to you.
i didnt understand as to how it will serve my purpose as i enquired about a way to simulate a cylindrical electrode or disc electrode
and about the code for multiple pulse is there any way i can simulate a ac current type rectangular waveform.how about using this

Code: Select all

  stim_amp.resize(10)
  stim_amp.x[0]= 0
  stim_amp.x[1]= 0
  stim_amp.x[2]=1
  stim_amp.x[3]=1
  stim_amp.x[4]= -1
  stim_amp.x[5]= -1
  stim_amp.x[6]= 1
  stim_amp.x[7]= 1
  stim_amp.x[8]= 0
  stim_amp.x[9]= 0
  stim_amp.mul($3)
 
if okey then i cnt figure out the time vectors

when we are stimualting a cell with extracellular electrode should the response of axon be almost identical to soma?
i know its a lot of questions but any help would be great favour
Last edited by shwetakgp on Wed Jul 10, 2013 6:22 pm, edited 2 times in total.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: graphs in extracelllular stimulation

Post by ted »

shwetakgp wrote:i tried with the vector play method
With anything more than a very simple waveform, that's very tedious. You're just going to have to

Code: Select all

REPEAT
  revise your code
  try it
UNTIL you get the waveform you want
i cnt understand why 1 has been added in this statement. I tried simply by del+dur+dur but it when i run it the window disappears
That's why. Re-read the Programmer's Reference documentation of the Vector class's play method, and pay particular attention to these sentences:
As of version 6.2, when a value is greater than the range of the t vector, linear extrapolation of the last two points is used instead of a constant last value. If a constant outside the range is desired, make sure the last two points have the same y value and have different t values
i cnt understand the use of finitialise handler
The code I sent sets up a state machine that controls the time course of is_xtra. Much less tedious than having to construct a repetitive waveform by hand. A state machine must be initialized at the start of a simulation. That's what the FInitializeHandler is for.
Make the rx_xtra values equal to the transfer resistances between your electrode and the middle of each segment of your model cell. How you figure out what those values should be is up to you.
i didnt understand as to how it will serve my purpose
It's only absolutely essential to your purpose. In a conductive medium the potential at any point is the weighted sum of the currents applied by one or more electrodes. In the case of monopole or dipole electrodes, there is only a single current. xtra provides a way to couple the amplitude of this current to extracellular potential at multiple points in a conductive medium. It can also be used with multipolar stimulation as long as there is a fixed proportionality among the currents delivered by the various electrodes, so that a single "magnitude" suffices to describe their net effect.

But you have to know what the weights are. xtra isn't going to figure them out for you.
about the code for multiple pulse is there any way i can simulate a ac current type rectangular waveform
Already showed you how to do that with a state machine in my previous post. Whatever approach you decide to take, you're going to want to examine the resulting waveform to make sure you're getting what you want. For vector play, you could do this:

Code: Select all

 . . . statements that specify the waveform . . .
x = 0
stim_amp.play(&x, stim_times, 1) // for interpolated vector play into x
objref g
g = new Graph()
g.addexpr("x")
graphList[0].append(g) // so g is updated at each time step
run()
g.exec_menu("View = plot")
when we are stimualting a cell with extracellular electrode should the response of axon be almost identical to soma?
I'd be surprised.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

thanks ted,
correct me if i am wrong .finitializeHandler controls initi() which which initalizes seti() at START and seti() sets the time course of the current through and its waveform
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: graphs in extracelllular stimulation

Post by ted »

fih ensures that initi() is called during initialization. initi() sets a boolean variable that signifies "stimulus current is off" and launches an event that returns at t==START. Delivery of that event causes seti() to be called. Every call of seti() toggles the stimulus current on or off, and launches another event that when delivered will call seti().

In retrospect I think that proc initi() should be

Code: Select all

proc initi() {
  STIMON = 0
  axon is_xtra = 0 // ensure that stimulus current is off at the start of the simulation
  cvode.event(START, "seti()")
// print "launched event that will turn on pulse at ", START
}
to ensure that the stimulus is off when the simulation begins.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

thanks ted ,
i got the stimulus with 5 pulses with a simple vector class's play method.
shwetakgp
Posts: 36
Joined: Sun Jun 16, 2013 1:21 am

Re: graphs in extracelllular stimulation

Post by shwetakgp »

To make a disc electrode i thought that i should start with a point and take a current density sigma. taking the point, i can assume a disc of radius r.
for calculating the current i could integrate it taking a ring of thickness dr as the element of integration. Then multiplying the area found by the current density could give me the current provided by the disc. let me know if this is feasible
Post Reply