Page 1 of 1

frequency and event

Posted: Wed Feb 07, 2007 9:46 pm
by chinhou
Dear friends,

I like to know, can we determine frequency in firing pattern of the cell with NEURON?
I guess we should use "event". but i confused in my code.

do you have any idea, how we can determine frequency of firing pattern?
in other words, we have a soma, which connected to some dendretic segment, we inject a depolarized current, can we determine frequency of response?

Still i'm learning NEURON! don't laugh if it is simple question!!!!!

Posted: Thu Feb 08, 2007 10:08 pm
by ted
1. Attach a NetCon with a NULLobject target to the cell's spike trigger zone. Example:
Assuming that soma(0.5) is close to the spike trigger zone,

Code: Select all

objref nc, nil
soma nc = new NetCon(&v(0.5), nil)
2. Use the NetCon class's record() method to record spike times to a Vector.

Code: Select all

objref tsp
tsp = new Vector()
nc.record(tsp)
After a simulation run, the elements of tsp will be the times at which the cell spiked

3. Use the Vector class's deriv() method (with dx of 1) to convert this to a Vector of interspike
intervals.

Code: Select all

objref isivec
isivec = tsp.c // isivec is a copy of tsp, the spike time Vector
isivec.deriv(1) // isivec contains the interspike intervals
4. Invert the interspike intervals and you have a Vector that contains the "instantaneous firing
frequency" of the cell.

Code: Select all

objref freq
freq = new Vector(isivec.size())
for i = 0,freq.size()-1 freq.x[i] = 1/isivec.x[i]

Posted: Fri Feb 09, 2007 9:40 am
by chinhou
Thank you very much Ted,

It seems for me it is more complicated from what i guess!
However, i run the following code

Code: Select all

load_file("nrngui.hoc")

create soma
access soma

soma nseg = 1
soma diam = 18.8
soma L = 18.8
soma Ra = 123.0

soma insert hh

objectvar stim

soma stim = new IClamp(0.5)

stim.del = 100
stim.dur = 100
stim.amp = 0.1

tstop = 300

objref nc, nil
soma nc = new NetCon(&v(0.5), nil)

objref tsp
tsp = new Vector()
nc.record(tsp)

run()

objref isivec
isivec = tsp.c // isivec is a copy of tsp, the spike time Vector
isivec.deriv(1) // isivec contains the interspike intervals

objref freq
freq = new Vector(isivec.size())
for i = 0,freq.size()-1 freq.x[i] = 1/isivec.x[i]


and the result of

oc>freq.printf()
0.0644122 0.0649351 0.0655201 0.0655201 0.0655201
0.0655201 0.0654664


as you said this is "instantaneous firing frequency".

So, what we can say about frequency of response to the injected current?

Is it " freq.mean()" or " freq.size()/stim.dur" or "?"

Thanks again!

Posted: Fri Feb 09, 2007 10:09 am
by ted
First, a comment.

Since time is in ms, instantaneous frequency in Hz is given by
for i = 0,freq.size()-1 freq.x = 1000/isivec.x
So, what we can say about frequency of response to the injected current?

Is it " freq.mean()"

It's up to you to decide whether instantaneous frequency or mean frequency is the
appropriate measure.
or " freq.size()/stim.dur"

Frequency is "how often something happens per unit time." Where does stimulus duration
appear in the definition of frequency?

Posted: Fri Feb 09, 2007 11:25 am
by chinhou
Thanks Ted for fast reply!

for me " freq.size()/stim.dur" means number of spike that i see in duration of current injection. because below and above stim.dur we don't have spike.
right?


Thanks for your kindly advise.

Posted: Fri Feb 09, 2007 11:49 am
by ted
The average firing frequency is
(number of spikes - 1) / (time of last spike - time of first spike)
Stimulus duration has nothing to do with it.

Posted: Fri Feb 09, 2007 1:22 pm
by chinhou
Dear Ted,

Thank you very much for all your support!

I have sent a message for you and wait for your answer,please!