It was easy to implement recording and saving of a full run.
- Create a hoc file called cellrecord_fullrun.hoc that contains statements to accomplish these tasks:
- set up Vector recording of the key variables (in this case, just time and soma.v(0.5))
- call run() to launch a simulation
- write the results to a file
- Add a load_file("cellrecord_fullrun.hoc") statement to the end of a copy of initcell_basic.hoc, and save this as initcell_fullrun.hoc
Here is initcell_fullrun.hoc
load_file("nrngui.hoc") load_file("cellspec.hoc") // properties of model cell load_file("cellrig.hoc") // basic instrumentation and simulation control // required to launch a simulation and see results // i.e. just an IClamp, graph, and RunControl load_file("cellrecord_fullrun.hoc") // sets up Vector recording, // executes full run, and saves results to "complete.dat"
And here is cellrecord_fullrun.hoc
///// advanced instrumentation // capture data to Vectors objref tvec, vvec tvec = new Vector() vvec = new Vector() tvec.record(&t) vvec.record(&soma.v(0.5)) ///// advanced simulation control // execute a "complete" simulation and save results to a file run() // $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("%g\t%g\n", $o1.x[i], $o2.x[i]) tfil.close() } xytofile(tvec, vvec, "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 cellmodels]$ head complete.dat 241 0 -70 0.025 -70 0.05 -70 0.075 -70 0.1 -70 0.125 -70 0.15 -70 0.175 -70 0.2 -70 [ted@loki cellmodels]$ tail complete.dat 5.775 -62.414 5.8 -62.3831 5.825 -62.3522 5.85 -62.3214 5.875 -62.2907 5.9 -62.26 5.925 -62.2294 5.95 -62.199 5.975 -62.1685 6 -62.1382