forked from ModelDBRepository/183300
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_fncs.hoc
144 lines (126 loc) · 4.89 KB
/
graph_fncs.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
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
objref tmpx, tmpy
tmpx = new Vector()
tmpy = new Vector()
//graph the vectors of interest//
proc graph_light(){
num_of_points = light1_events.size()
points_per_burst = ThetaStim[2].number // for light stimulation of mitral 1
// print "note that light1_events contains:"
{light1_events.printf()}
for (i=0; i<num_of_points; i = i+ points_per_burst) {
tmpx = new Vector()
tmpx.append(light1_events.x[i],light1_events.x[i+points_per_burst-1])
tmpy = new Vector()
tmpy.append(-90,-90)
tmpy.line(v_graph, tmpx, 4, 1)
// print "attempted to graph a light stimulus bar"
// print "y coords:"
{tmpy.printf()}
// print "x coords:"
{tmpx.printf()}
// print "i = ", i, ", i+points_per_burst-1 = ", i+points_per_burst-1
}
}
proc graph_breath1(){
num_of_points = OSN1_events.size()
points_per_burst = ThetaStim[0].number // for light stimulation of mitral 1
// print "note that OSN1_events contains:"
{OSN1_events.printf()}
for (i=0; i<num_of_points; i = i+ points_per_burst) {
tmpx = new Vector()
tmpx.append(OSN1_events.x[i],OSN1_events.x[i+points_per_burst-1])
tmpy = new Vector()
tmpy.append(-85,-85)
tmpy.line(v_graph, tmpx, 5, 1)
// print "attempted to graph a light stimulus bar"
// print "y coords:"
{tmpy.printf()}
// print "x coords:"
{tmpx.printf()}
// print "i = ", i, ", i+points_per_burst-1 = ", i+points_per_burst-1
}
}
proc graph_breath2(){
num_of_points = OSN2_events.size()
points_per_burst = ThetaStim[1].number // for light stimulation of mitral 1
// print "note that OSN1_events contains:"
{OSN1_events.printf()}
for (i=0; i<num_of_points; i = i+ points_per_burst) {
tmpx = new Vector()
tmpx.append(OSN1_events.x[i],OSN1_events.x[i+points_per_burst-1])
tmpy = new Vector()
tmpy.append(-87.5,-87.5)
tmpy.line(v_graph, tmpx, 7, 1)
// print "attempted to graph a light stimulus bar"
// print "y coords:"
{tmpy.printf()}
// print "x coords:"
{tmpx.printf()}
// print "i = ", i, ", i+points_per_burst-1 = ", i+points_per_burst-1
}
}
proc regraph_stims() {
graph_light()
graph_breath1()
graph_breath2()
}
strdef tmpstr
objref tmpfile
tmpfile = new File()
proc write_vec() { // $s1 is filename, $o2 is vector to write
tmpstr = $s1
/// print "In write_vec here comes pwd and ls before writing file: ",tmpstr
/// system("pwd")
/// system("ls")
tmpfile.wopen(tmpstr)
for i=0, $o2.size()-1 {
tmpfile.printf("%g\n",$o2.x[i])
}
tmpfile.close()
}
strdef filename
proc write_selected_vecs() {
write_vec("OSN1_events.dat", OSN1_events)
write_vec("OSN2_events.dat", OSN2_events)
write_vec("light_events.dat", light1_events)
write_vec("gc1_events1.dat", gc1_events1)
write_vec("gc1_events2.dat", gc1_events2)
write_vec("gc2_events1.dat", gc2_events1)
write_vec("gc2_events2.dat", gc2_events2)
write_vec("t.dat",t_vec)
write_vec("m1_soma_v.dat", m1_v_vec)
write_vec("m2_soma_v.dat", m2_v_vec)
}
objref tmpy_vec, null
tmpy_vec = new Vector()
proc graph_poisson() { // graph representative poisson rates and spikes
if (breath_poisson_rate_for_mc1 == null) {
breath_poisson_rate_for_mc1 = gen_poisson(tstop, breathing_period, breath_gauss_center, breath_half_width, breath_peak_rate)
}
if (light_poisson_rate_for_mc1 == null) {
light_poisson_rate_for_mc1 = gen_poisson(tstop, light_period, light_gauss_center, light_half_width, light1_peak_rate)
}
if (light_poisson_rate_for_mc2 == null) {
light_poisson_rate_for_mc2 = gen_poisson(tstop, light_period, light_gauss_center, light_half_width, light2_peak_rate)
}
breath_poisson_rate_for_mc1.c.div(breath_peak_rate).mul(20).line(Graph[0], t_vec,2 , 2) //2 is red
light_poisson_rate_for_mc1.c.div(light1_peak_rate).mul(20).line(Graph[0], t_vec,7 , 2) // 7 is purple
light_poisson_rate_for_mc2.c.div(light2_peak_rate).mul(20).line(Graph[0], t_vec,4 , 2) // 4 is green
// note in below marks O, S are filled circles and squares, o, s are open circles, squares
// mc1 breath events
tmpy_vec = new Vector(breath_events_for_mc1.size())
tmpy_vec.fill(20) // arbitrary height for synaptic events on voltage graph
tmpy_vec.mark(Graph[0], breath_events_for_mc1, "O", 8, 2, 2) // 2 is red ( ..., size, color, brush)
// mc2 breath events
tmpy_vec = new Vector(breath_events_for_mc2.size())
tmpy_vec.fill(19.75) // arbitrary height for synaptic events on voltage graph
tmpy_vec.mark(Graph[0], breath_events_for_mc2, "o", 8, 5, 2) // 5 is orangish
// mc1 light events
tmpy_vec = new Vector(light_events_for_mc1.size())
tmpy_vec.fill(19.25) // arbitrary height for synaptic events on voltage graph
tmpy_vec.mark(Graph[0], light_events_for_mc1, "S", 8, 7, 2) // 7 is blue
// mc2 light events
tmpy_vec = new Vector(light_events_for_mc2.size())
tmpy_vec.fill(19.00) // arbitrary height for synaptic events on voltage graph
tmpy_vec.mark(Graph[0], light_events_for_mc2, "s", 8, 3, 2) // 3 is blue
}