Time step issue with normrand() in the mod file
Posted: Mon Feb 06, 2012 11:23 am
Hi, Ted,
I used normrand() in the mod file to generate a noisy current injection:
In my hoc file, I also used the NetStim object to generate random spike trains to my network neurons. Now to my surprise, I discovered that the random spike trains change when I change the time step dt, even if I used the same seed for the NetStim. When I removed the normrand() function in the mod file, this won't happen. Since the random process changes with dt, it is hard for to me know whether the dt I am using is small enough for my simulation. Any way I can fix the random process from NetStim if I am using normrand() in the mod file?
Thank you!
Best,
Guoshi
I used normrand() in the mod file to generate a noisy current injection:
Code: Select all
NEURON {
POINT_PROCESS IClampNoise
RANGE i,del,dur,f0,f1,r,torn,std,bias
ELECTRODE_CURRENT i
}
UNITS {
(nA) = (nanoamp)
}
PARAMETER {
del = 50 (ms)
dur = 200 (ms)
torn= 500 (ms)
std = 0.2 (nA)
f0 = 0.2 (nA)
f1 = 0.8 (nA)
r = 60
bias = 0 (nA)
pi = 3.1415926
}
ASSIGNED {
ival (nA)
i (nA)
amp (nA)
noise (nA)
on (1)
}
INITIAL {
i = 0
on = 0
net_send(del, 1)
}
BEFORE BREAKPOINT {
if (on) {
noise = normrand(0,std*1(/nA))*1(nA)
amp = f0 + 0.5*(f1-f0)*(tanh((t-torn)/(r/3)/(1(ms))-3)+1)
ival = amp + noise + bias
} else {
ival = 0
}
}
BREAKPOINT {
i = ival
}
NET_RECEIVE (w) {
if (flag == 1) {
if (on == 0) {
: turn it on
on = 1
: prepare to turn it off
net_send(dur, 1)
} else {
: turn it off
on = 0
}
}
}
Thank you!
Best,
Guoshi