/usr/share/nrn/demo/sync/spkplot.hoc is in neuron 7.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | begintemplate SpikePlot1
public cells, vecs, g, update
public map, save_data, b, unmap
public flush, begin, plot, size, view_count, fastflush, simgraph
external addplot, tstop, graphList, graphItem
objref cells, vecs[1], nc, g, this, y, tobj, b, outlist, nil
strdef tstr, modestr
proc init() {
fwindow = 100
binwidth = .1
modestr = "Spikes "
mode=1
y = new Vector(1000)
cells = $o1
if (numarg() == 1) {
map()
}
}
proc map() {
build()
sprint(tstr, "%s for %s", this, cells)
if (numarg() > 1) {
b.map(tstr, $2,$3,$4,$5)
}else{
b.map(tstr)
}
update()
flush()
}
proc unmap() {local i
b.unmap()
g = nil
i = graphList[1].index(this)
if (i >= 0) {
graphList[1].remove(i)
}
graphItem = nil
}
proc build() {
b = new VBox(3)
b.priority(600)
b.save("")
b.ref(this)
b.dismiss_action("unmap()")
b.intercept(1)
xpanel("")
xmenu("Plot")
xbutton("Update", "update() flush()")
xradiobutton("Spikes", "pmode(1)", mode==1)
xradiobutton("Frequency", "pmode(2)", mode==2)
xradiobutton("Histogram", "pmode(3)", mode==3)
xmenu()
xvarlabel(modestr)
xpvalue("Freq Window (ms)", &fwindow, 1, "flush()")
xpvalue("Hist Bin (ms)", &binwidth, 1, "flush()")
xpanel()
g = new Graph()
b.intercept(0)
addplot(this, 1)
begin()
pmode(mode)
}
proc pmode() {
mode = $1
if (mode == 1) {
modestr = "Spikes "
}else if (mode == 2) {
modestr = "Frequency"
}else if (mode == 3) {
modestr = "Histogram"
}
flush()
}
proc update() {local i localobj vec
n = cells.count
if (n == 0) return
objref vecs[n]
for i=0, n-1 {
vecs[i] = new Vector(0)
tobj = cells.object(i)
tobj.connect2target(nil, nc)
sprint(tstr, "%s", tobj)
vec=nc.get_recordvec()
if(vec==nil){
nc.record(vecs[i])
}else{
vecs[i]=vec
}
vecs[i].label(tstr)
}
objref nc, tobj
}
proc begin() {
}
func view_count() {
if (g == nil) {
return 0
}
return g.view_count()
}
proc plot() {
}
proc simgraph() {
}
func size() {
if (numarg() == 4) {
g.size($1,$2,0,cells.count+1)
return 1.
}else{
return g.size($1)
}
}
proc fastflush() {}
proc flush() {local i
g.erase_all
g.vfixed(1)
g.label(.9,1)
if (mode == 1) {
for (i=n-1; i >= 0; i -= 1) {
y.resize(vecs[i].size).fill(i+1)
y.label(vecs[i].label)
y.mark(g, vecs[i], "|", 8, 1, 1)
y.line(g, vecs[i], 1, 0)
}
}else if (mode == 2) {
for (i=n-1; i >= 0; i -= 1) {
y = vecs[i].sumgauss(0, tstop, tstop/100, fwindow)
y.label(vecs[i].label)
y.mul(1000).line(g, y.c.indgen(0, tstop/100), 1,1)
}
}else if (mode == 3) {
for (i=n-1; i >= 0; i -= 1) if (vecs[i].size > 1){
y = vecs[i].c.deriv(1,1)
high = y.max
y = y.sumgauss(0, high, high/50, binwidth)
y.label(vecs[i].label)
y.line(g, y.c.indgen(0, high/50), 1,1)
}
}
g.flush()
}
endtemplate SpikePlot1
|