#!/usr/local/bin/css -f
void Anal(String fnm) {
fstream istrm;
istrm.open(fnm, ios::in);
fstream ostrm;
ostrm.open(fnm + ".gort20", ios::out);
int epc;
int rt_go[3200];
int cycle;
float thal, m1;
int i;
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]=200; // initialize rt to be max
}
if ((i!=0)&&((i%50 ==38)||(i%50==39))) {
// only get rts's on 20th epoch for each net, 2 trials per epoch makes i=38,39
if (settle==0) { // check if net has settled on response 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==199) i++; // new epoch
}
for (i=0;i<1600;i++) { if ((rt_go[i]!=0)&&(rt_go[i]!=200)) // only show rt's for actual responses
ostrm << "_D:" << "\t" << i << "\t" << rt_go[i] << "\n";
}
//ostrm << right;
istrm.close();
ostrm.close();
cout << fnm << ".gort20:\n";
system("more " + fnm + ".gort20");
cout << "\n";
}
void Main() {
int i;
for(i=1;i<argc;i++) {
Anal(argv[i]);
}
}
Main();