It was very easy to implement recording and saving of a complete simulation of the network.
- Create a hoc file called netrecord_fullrun.hoc that contains statements to accomplish these tasks:
- launch a simulation (netrig.hoc already takes care of recording spike times and cell IDs to a pair of Vectors)
- write the results to a file
- Add a load_file("netrecord_fullrun.hoc") statement to the end of a copy of initnet_basic.hoc, and save this as initnet_fullrun.hoc
Here is initnet_fullrun.hoc
///// advanced instrumentation
// spike times and cell IDs are already being recorded
///// advanced simulation control
// execute a "complete" simulation and save results to a file
myrun()
// $o1, $o2 Vectors of x & y values, respectively
// $s3 file name string
proc xytofile() { local i localobj tfil
print "writing to ", $s3
tfil = new File()
tfil.wopen($s3)
tfil.printf("%d\n",$o1.size())
for i=0,$o1.size()-1 tfil.printf("%11.4f\t%d\n", $o1.x[i], $o2.x[i])
tfil.close()
}
xytofile(spikes, idvec, "complete.dat")
Executing initcell_fullrun.hoc generates a file called complete.dat. Here are brief excerpts from the beginning and end of complete.dat
[ted@loki nets]$ head complete.dat
66
36.8179 0
110.7235 0
262.7290 0
363.5065 0
469.1450 0
547.9730 0
671.5125 0
932.3377 0
1113.6783 0
[ted@loki nets]$ tail complete.dat
7478.5505 0
7574.9096 0
7674.5655 0
7766.3821 0
8044.0113 0
8294.9724 0
8564.5261 0
8653.1829 0
8814.5357 0
8918.0683 0