-
Notifications
You must be signed in to change notification settings - Fork 3
/
testpatstim.hoc
79 lines (65 loc) · 1.47 KB
/
testpatstim.hoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{load_file("nrngui.hoc")}
{load_file("defvar.hoc")}
load_file("common.hoc")
celsius = 16
begintemplate Cell
public soma, syn
create soma
objref syn
proc init() {
soma {
nseg=1
diam = 5 L = 5
insert hh
syn = new ExpSyn(0.5)
}
}
endtemplate Cell
ncell = 10
objref cell, cells, nc, netcons, st, stims, nclist, nil, r
pnm = new ParallelNetManager(0)
pc = pnm.pc
tvec = new Vector()
idvec = new Vector()
cells = new List()
nclist = new List()
for (gid = pc.id; gid < ncell; gid += pc.nhost) {
r = new Random()
r.Random123(gid, 0, 0)
r.uniform(0,1)
pc.set_gid2node(gid, pc.id)
cell = new Cell()
cell.soma pc.cell(gid, new NetCon(&cell.soma.v(.5), nil))
//cell.syn.noiseFromRandom123(gid,2,3)
cells.append(cell)
// all cell syn have a source of 1000+gid%5
nc = pc.gid_connect(1000+gid%5, cell.syn)
nc.weight = .01 + r.repick()*.01
nc.delay = 1 + r.repick()
nclist.append(nc)
}
// pattern stimulation
objref tstim, gidstim, patstim
tstim = new Vector(2000) // large so do not put all on queue at once
gidstim = new Vector(2000)
gidstim.fill(2000)
for i=0, tstim.size-1 {
tstim.x[i] = int(i/100)*5
gidstim.x[i] = 1000+i%100
}
patstim = new PatternStim()
patstim.play(tstim, gidstim)
wopen("patstim.spk")
fprint("%d\n", tstim.size)
for i=0, tstim.size-1 {
fprint("%g %d\n", tstim.x[i], gidstim.x[i])
}
wopen()
pc.spike_record(-1, tvec, idvec)
cvode.cache_efficient(1)
pc.set_maxstep(10)
stdinit()
prun("")
spike2file("patstim")
pc.barrier()
quit()