Page 1 of 1

fstim command

Posted: Sat May 27, 2006 6:40 am
by peppe83
Hi, i'm italian boy and I'm a new user of Neuron...so...in these days i'm working with a model take by neuronDB. In this model there is a command fstim, but it isn't used in neuron and there isn't a 'help'. Is fstim equivalent to netstim command? And, in this example: fstim(0, 0.4, 5, 450, 0.1), what do these parameters represent?...thank you...

fstim documentation

Posted: Sat May 27, 2006 7:42 pm
by ted
From the source code:

Code: Select all

fstim(maxnum)
 allocates space for maxnum synapses. Space for
 previously existing synapses is released. All synapses initialized to
 0 maximum conductance.

fstim(i, loc, delay, duration, stim)
 The ith current stimulus is injected at parameter `loc'
 different current stimuli do not concatenate but can ride on top of
 each other. delay refers to onset of stimulus relative to t=0
 delay and duration are in msec.
 stim in namps.
  
fstimi(i)
 returns stimulus current for ith stimulus at the value of the
 global time t.

Posted: Sun May 28, 2006 4:18 am
by peppe83
Thank you very much...but, can i do to replace fstim with netstim?

Posted: Sun May 28, 2006 10:34 am
by ted
No. fstim injects a series of rectangular current pulses. NetStim is an
event generator, not a current pulse generator. An IClamp can be
substituted for an fstim that delivers a single current pulse. If it is
necessary to deliver a series of current pulses, the best way is to use
an event handler to control the output of the IClamp (let me know if that's
what you need to do, and I'll show you how).

Posted: Sun May 28, 2006 1:52 pm
by peppe83
so, i want to replace fstim with a command, not deprecated, in this function (CA1 Pyramidal Neuron: slow Na+ inactivation (Migliore 1996)):

Code: Select all

proc run4bd() {
	tstop=800
	access apical[7]
        nstim=3
        fstim(nstim)
        fstim(0, 0.4, 5, 450, 0.1)
        fstim(1, 0.4, 455, 250, -0.5)
        fstim(2, 0.4, 705, 70, 0.1)
	g.erase_all()
	g.size(0,tstop,-120,0)
	g.addvar("apical[dist].v(0.4)",3,1,2*tstop,0,2)
	g.xaxis(1)
	g.begin()
	printf ("running...")
	run()
	printf("done \n")
}

Posted: Sun May 28, 2006 10:55 pm
by ted
I'm not sure why you want to replace these fstim calls. If it ain't broke,
don't fix it. It's even easy to understand what they are doing. If you have
to fix something, there are other things in this code that I would suggest
fixing first.

Code: Select all

proc run4bd() {
   tstop=800  // execution stops at t=800 ms
   access apical[7]  // apical[7] is the currently accessed function
        nstim=3
        // throw away any existing fstim specification
        // and set up a new one that will deliver 3 current pulses
        fstim(nstim)
        // all are located at 0.4 on apical [7]
        fstim(0, 0.4, 5, 450, 0.1)  // first pulse is 0.1 nA from 5 to 455 ms
        fstim(1, 0.4, 455, 250, -0.5)  // second is -0.5 nA from 455 to 705 ms
        fstim(2, 0.4, 705, 70, 0.1)  // third is 0.1 nA from 705 to 775 ms
   g.erase_all()
   g.size(0,tstop,-120,0)
   // This looks like a bug.
   // Each time run4bd() is called, apical[dist].v(0.4) is added to g's plotlist. 
   // If run4bd is called several times, the simulation will execute more 
   // slowly each time. But maybe the person who wrote this code 
   // designed the rest of the program in such a way that run4bd will only 
   // be called once, or just a very few times.
   g.addvar("apical[dist].v(0.4)",3,1,2*tstop,0,2)
   g.xaxis(1)
   g.begin()
   printf ("running...")
   run()
   printf("done \n")
}
Just don't use fstim if you're writing a new program. To do something like
this, you could just use three IClamps. Or you could use a single IClamp
and take advantage of the Vector class's play() method
http://www.neuron.yale.edu/neuron/stati ... .html#play
For example, if you are using fixed time step integration, this should work:

Code: Select all

objref ivec, tvec, stim
apical[7] stim = new IClamp(0.4)
ivec=new Vector(9)
tvec=ivec.c
tvec.x[0]=0   ivec.x[0]=0
tvec.x[1]=5   ivec.x[1]=0
tvec.x[2]=5   ivec.x[2]=0.1
tvec.x[3]=455 ivec.x[3]=0.1
tvec.x[4]=455 ivec.x[4]=-0.5
tvec.x[5]=705 ivec.x[5]=-0.5
tvec.x[6]=705 ivec.x[6]=0.1
tvec.x[7]=775 ivec.x[7]=0.1
tvec.x[8]=775 ivec.x[8]=0
ivec.play(&stim.i, tvec)

tstop=800  // execution stops at t=800 ms

g.size(0,tstop,-120,0)
g.addvar("apical[dist].v(0.4)",3,1,2*tstop,0,2)
g.xaxis(1)
g.begin()

proc run4bd() {
   g.erase_all()
   printf ("running...")
   run()
   printf("done \n")
}
If you want to use variable time step integration, the
vsrc.play(&var or stmt, tvec, indices_of_discontinuities_vector)
form of Vector play() should be used (for this example, the
indices_of_discontinuities_vector would have 4 elements, whose values
are 1, 2, 3, 4).

Posted: Mon May 29, 2006 3:23 am
by peppe83
Thank you very much Ted. You have resolved the doubts that I had. Thank again.