-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathprintfile.hoc
More file actions
170 lines (148 loc) · 5.42 KB
/
printfile.hoc
File metadata and controls
170 lines (148 loc) · 5.42 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//********************** PRINT FILES *************************
// ModelDB file along with publication:
// Yim MY, Hanuschkin A, Wolfart J (2015) Hippocampus 25:297-308.
// http://onlinelibrary.wiley.com/doi/10.1002/hipo.22373/abstract
// Man Yi Yim / 2015
// Print out the output spikes, membrane potential and network connections in the main code into files
// This code contains the following proc's
// proc saveNet()
// proc sMatrix_init()
// proc sMatrix()
// proc SpkMx()
// proc SpkMx_template()
// proc write_customstate()
// proc write_stimIn()
// Read out the ID of pre or precell (by Ted Carnevale)
// argument is a NetCon
obfunc myprecell() { localobj nil
// nil points to NULLobject
if ($o1.precell() == nil) {
return $o1.pre()
} else {
return $o1.precell()
}
}
//***Network connections***
strdef DGNC_name_
objref dfile
dfile = new File()
proc saveNet(){ local i
print "write out Net cons file ..."
sprint (DGNC_name_,"%s-%d-%d%s.%s", "DGNC", PP_box_startid_, PP_box_nr_, idname, suffix)
dfile.wopen(DGNC_name_)
for i=0, nclist.count-1 {
dfile.printf("%s\t%s\n", myprecell(nclist.object(i)), nclist.object(i).postcell)}
// vbc2gc.x[i], vmc2gc.x[i], vhc2gc.x[i], vgc2gc.x[i])} ??
dfile.close()
}
//***Header of the voltage file***
strdef strmat
objref efile
efile = new File()
strdef DGVt_name_
proc sMatrix_init(){ // here the header info for sMatrix is written out...
n_to_print = 500
print "Output memb voltage traces of every ", ngcell/n_to_print, " GC and all other cells to file"
sprint (DGVt_name_,"%s-%d-%d%s.%s", "DGVt", PP_box_startid_, PP_box_nr_, idname, suffix)
efile.wopen(DGVt_name_)
efile.printf("# t\t")
efile.printf("\n")
efile.close(DGVt_name_)
}
proc sMatrix(){ local j
efile.aopen(DGVt_name_)
efile.printf("%f\t", t)
for i = 0, n_to_print-1 {
efile.printf("%f\t", cells.object[int(i*ngcell/n_to_print)].soma.v(0.5))}
efile.printf("\n")
efile.close(DGVt_name_)
}
proc SpkMx() { local i, j
strdef DGsp_name_
sprint (DGsp_name_,"%s-%d-%d%s.%s", "DGsp", PP_box_startid_, PP_box_nr_, idname, suffix)
print "Create: ", DGsp_name_ // output filename
dfile.wopen(DGsp_name_)
k = 0
while (k < VmT.size) {
for j = 0, (ngcell+nbcell+nmcell+nhcell-1) {
if(Spike[j].x[k] != 0) {
dfile.printf("%f\t%d\n", VmT.x[k], j) // write out time of spike and cell id!
// Spike_times[j].append(VmT.x[k]) // generate vector of spike times for each cell. Moved to seperate function
}
}
k +=1
}
dfile.close(DGsp_name_)
}
proc SpkMx_template() { local i, j
strdef DGsp_name_
sprint (DGsp_name_,"%s-%d-%d%s.%s", "GCsp", PP_box_startid_, PP_box_nr_, idname, suffix)
print "Create: ",DGsp_name_ // output filename
dfile.wopen(DGsp_name_)
k = 0
while(k < VmT.size) {
for j = 0, ngcell-1 {
if(Spike[j].x[k] != 0) {
dfile.printf("%f\t%d\n", VmT.x[k], j) // write out time of spike and cell id!
}
}
k +=1
}
dfile.close(DGsp_name_)
}
proc write_customstate() { local i, j
strdef f_name_
sprint (f_name_,"%s-%d-%d%s.%s", "NetworkState_OUT_", PP_box_startid_, PP_box_nr_, idname, suffix)
print "Create: ",f_name_ // output filename
dfile.wopen(f_name_)
for i = 0, ngcell -1 {
forsec Gcell[i].all { // iterate over all sections of this cell
for (x,0) { // iterate over internal nodes
dfile.printf("%f\n", v) // write out time of spike and cell id!
}
}
}
for i = 0, nbcell -1 {
forsec Bcell[i].all { // iterate over all sections of this cell
for (x,0) { // iterate over internal nodes
dfile.printf("%f\n", v) // write out time of spike and cell id!
}
}
}
for i = 0, nmcell -1 {
forsec Mcell[i].all { // iterate over all sections of this cell
for (x,0) { // iterate over internal nodes
dfile.printf("%f\n", v) // write out time of spike and cell id!
}
}
}
for i = 0, nhcell -1 {
forsec Hcell[i].all { // iterate over all sections of this cell
for (x,0) { // iterate over internal nodes
dfile.printf("%f\n", v) // write out time of spike and cell id!
}
}
}
dfile.close(f_name_)
}
proc write_stimIn() {
strdef f_name_
sprint (f_name_,"%s-%d-%d%s.%s", "StimIn", PP_box_startid_, PP_box_nr_, idname, suffix)
print "Create: ",f_name_ // output filename
dfile.wopen(f_name_)
for i=0,npp-1 {
for j=0,vec_stim[i].size()-1 {
dfile.printf("%f\t%d\n",vec_stim[i].x[j],i)
}
}
// write out noise input...
if (print_stim_noise == 1){
if (debug_ == 2) {print "write out noise input..." }
for i=0,npp-1 {
for j=0,vec_stim_noise[i].size()-1 {
dfile.printf("%f\t%d\n",vec_stim_noise[i].x[j],i+npp)
}
}
}
dfile.close(f_name_)
}