-
Notifications
You must be signed in to change notification settings - Fork 1
/
anal_rt_thal.css
74 lines (56 loc) · 1.47 KB
/
anal_rt_thal.css
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
#!/usr/local/bin/css -f
void Anal(String fnm) {
fstream istrm;
istrm.open(fnm, ios::in);
fstream ostrm;
ostrm.open(fnm + ".gort", ios::out);
int epc;
int rt_go[3200];
int cycle;
int cycle_max = 200;
float thal, m1;
int i, l;
int settle;
int cycle_col, thal_col;
while(!istrm.eof() && istrm.good()) {
String_Array& col = ReadLine(istrm);
if(istrm.eof() || istrm.bad()) break;
if(col[0].contains("_H:")) {
if (col[7].contains("cycle")) {
cycle_col =7; // columns for cycle and thalamus are different
thal_col = 12; // in c1 and c4 log files; adjust here
}
else {cycle_col = 8; thal_col = 13;}
continue;
}
cycle = col[cycle_col];
thal = col[thal_col];
if (cycle==0) {
settle=0;
rt_go[i]= cycle_max; //initialize the rt to be maximum
}
if (settle==0) { // check if net has settled on resp yet
if (thal>.25) { // check if average thal act is > .25, which means that a single unit > .5
rt_go[i]=cycle; // if so, then set the rt to be this cycle
settle =1; // network has settled on response
}
}
if (cycle== (cycle_max -1)) i++;
}
for (i=0;i<1600;i++) {
if ((rt_go[i]!=0)&&(rt_go[i]!=cycle_max))
ostrm << "_D:" << "\t" << i << "\t" << rt_go[i] << "\n";
}
istrm.close();
ostrm.close();
cout << fnm << ".gort:\n";
system("more " + fnm + ".gort");
cout << "\n";
}
void Main() {
int i;
for(i=1;i<argc;i++) {
Anal(argv[i]);
}
}
Main();