Hi Ted,
I am providing the scripts of each file I used. The scripts are as follows:
1) Pregen.mod (SpikeGenerator mod file).
2) adex.hoc (template creation of spikegenerator)
3) cells_test.hoc (creating the cells)
4) modifycheckmoss.hoc (main file for changing the file parameters during run)
Code: Select all
: $Id: pregen.mod,v 1.3 2000/05/16 11:16:56 hines Exp $
: comments at end
NEURON {
POINT_PROCESS SpikeGenerator
RANGE y
RANGE fast_invl, slow_invl, burst_len, start, end,delay
RANGE noise
}
PARAMETER {
fast_invl = 10 (ms) : time between spikes in a burst (msec)
slow_invl = 0 (ms) : burst period (msec)
: actually, above is interburst period in conformity with original version
: see
burst_len = 10 : burst length (# spikes)
start = 50 (ms) : start of first interburst interval
end = 1e10 (ms) : time to stop bursting
noise = 0 : amount of randomeaness (0.0 - 1.0)
delay = 4
}
ASSIGNED {
y
burst
event (ms)
burst_off (ms)
burst_on (ms)
toff (ms)
on
}
:PROCEDURE seed(x) {
:set_seed(x)
:}
INITIAL {
on = 1
toff = 1e9
y = -90
burst = 0
event = start - slow_invl
:
event_time()
while (on == 1 && event < 0) {
event_time()
}
if (on == 1) {
net_send(event, 1)
}
}
FUNCTION interval(mean (ms)) (ms) {
if (mean <= 0.) {
mean = .01 (ms) : I would worry if it were 0.
: since mean is a local variable, if the number it is set
: to is dimensionless, mean will be dimensionless.
}
if (noise == 0) {
interval = mean
}else{
interval = (1. - noise)*mean + noise*(mean*exprand(1)+delay) : (delay+noise*mean*exprand(1))
}
}
PROCEDURE event_time() {
if (slow_invl == 0 || (burst != 0. && burst_len > 1)) {
event = event + interval(fast_invl)
if (event > burst_on + burst_off) {
burst = 0.
}
}else{
burst = 1.
: if slow_invl from beginning of burst to beginning of burst
: event = event + interval(slow_invl - (burst_len-1)*fast_invl)
: use following if slow_invl is interburst interval
event = event + interval(slow_invl)
burst_on = event
burst_off = interval((burst_len - 1)*fast_invl)-1e-6
}
if (event > end) {
on = 0
}
}
NET_RECEIVE (w) {
:printf("Pregen receive t=%g flag=%g\n", t, flag)
if (flag == 1 && on == 1) {
y = 20
net_event(t)
event_time()
net_send(event - t, 1)
net_send(.1, 2)
}
if (flag == 2) {
y = -90
}
}
COMMENT
Presynaptic spike generator
---------------------------
This mechanism has been written to be able to use synapses in a single
neuron receiving various types of presynaptic trains. This is a "fake"
presynaptic compartment containing a fast spike generator. The trains
of spikes can be either periodic or noisy (Poisson-distributed), and
either tonic or bursting.
Parameters;
noise: between 0 (no noise-periodic) and 1 (fully noisy)
fast_invl: fast interval, mean time between spikes (ms)
slow_invl: slow interval, mean burst silent period (ms), 0=tonic train
burst_len: mean burst length (nb. spikes)
Written by Z. Mainen, modified by A. Destexhe, The Salk Institute
Modified by Michael Hines for use with CVode
Modified by Michael Hines to use logical event style with NET_RECEIVE
ENDCOMMENT
Code: Select all
begintemplate spikeGen
public dummyspikegen, synspikegen, nclist3, spkrecord, x, y, z, position
create dummyspikegen
public synspikegen, connect2target, sumconnect, mfgocconnect
objref synspikegen, nclist3, spkrecord
proc init() {
topol()
create dummyspikegen
dummyspikegen {
diam=1.2
spkrecord=new Vector()
nclist3=new List()
synspikegen=new SpikeGenerator(0.5)
synspikegen.start=20//rand_start.uniform(20, 1000)
synspikegen.burst_len=1
synspikegen.fast_invl=2
synspikegen.slow_invl=1e10
synspikegen.end=0
x=y=z=0
sumconnect=0
mfgocconnect=0
}
}
proc topol() {
dummyspikegen {pt3dclear() pt3dadd(0, 0, 0, 1.2) pt3dadd(0, 0, 0, 1.2)}
}
proc position() {local i
dummyspikegen for i=0, n3d()-1 {
pt3dchange(i, $1-x+x3d(i), $2-y+y3d(i), $3-z+z3d(i), diam3d(i))
}
x=$1 y=$2 z=$3
}
obfunc connect2target() {localobj nc
dummyspikegen nc=new NetCon(&synspikegen.y, $o1)
nc.threshold=10
if(numarg()==2) {$o2=nc}
return nc
}
endtemplate spikeGen
Code: Select all
//{xopen("calc_cells_volume.hoc")}
xopen("adex.hoc")
nmossy=612
objref mossycells
{
mossycells=new List()
}
func moscellAppend() {
mossycells.append($o1)
return mossycells.count()-1
}
objref mf_start_rand
mf_start_rand=new Random()
func round() {
if ($1>0) {
return int($1+0.5)
}else {
return int($1-0.5)
}
}
proc mkcells() {local k localobj cell, nc, nil
for k=0, nmossy-1 {
cell=new spikeGen(0.5)
cell.synspikegen.start=round(mf_start_rand.uniform(20, 700))
printf("The object here is so, so and so...\n")
moscellAppend(cell)
}
}
mkcells()
Code: Select all
xopen("cells_test.hoc")
v_init=-70
objref moss_idvec, moss_tvec
moss_tvec=new Vector()
moss_idvec=new Vector()
proc spikerecord() {localobj nil, nc_moss
for j=0, mossycells.count-1 {
nc_moss=mossycells.object(j).connect2target(nil)
nc_moss.record(moss_tvec, moss_idvec, j)
}
}
spikerecord()
tstop=1000
objref g, g1, g2, g3, g4, g5, g6, g7
newPlotV()
g5=graphItem
g5.erase_all()
g5.addvar("mossycells.object(0).synspikegen.y")
printf("\n\n Simulating Cells....\n\n")
objref granulefil
granulefil=new File()
dt=0.025
objref cvode
cvode=new CVode()
cvode.atol(0.001)
cvode_active(1)
cvode.use_local_dt(1)
cvode.use_daspk(1)
half_mos=int(mossycells.count/2)
for i=0, half_mos-1 {
//mossycells.object(i).synspikegen.end=1e5
mossycells.object(i).synspikegen.fast_invl=33.33
mossycells.object(i).synspikegen.slow_invl=33.33
}
proc run() {//half mossy fibers with transient and rest half with sustained component - POT Simulation
stdinit()
for j=half_mos, mossycells.count-1 {
mossycells.object(j).synspikegen.end=1e5
mossycells.object(j).synspikegen.fast_invl=5
mossycells.object(j).synspikegen.slow_invl=5
}
continuerun(5)
for j=half_mos, mossycells.count-1 {
mossycells.object(j).synspikegen.end=1e5
mossycells.object(j).synspikegen.fast_invl=200
mossycells.object(j).synspikegen.slow_invl=200
}
continuerun(tstop)
}
run()
I hope I made it clear. If not, kindly let me know.
Thank you.