4. Reconstitute and verify the "complete" simulation results

Reconstituting the results of a complete simulation from the segmentxx.dat files

This is done by init_reconst.hoc, which contains two procedures:

  • proc reconst(), which reads the data from each segmentxx.dat file in turn, and appends them to a pair of Vectors
  • proc xytofile(), which is identical to the procedure with the same name in initcell_fullrun.hoc and initcell_segrun.hoc

Here is init_reconst.hoc

///// read NSEGS segmentnn.dat files and reconsititute a complete simulation from them


strdef tmpstr // for constructed file names

objref testtvec, testvvec
testtvec = new Vector()
testvvec = new Vector()

// read $1 files called $s200.dat..$s2$1-1.dat
// and concatenate their data contents to generate a "complete" pair of vectors
proc reconst() { local i, j, numpts  localobj fil
  testtvec = new Vector()
  testvvec = new Vector()
  for i=0,$1-1 {
    // open $s2i.dat file
    sprint(tmpstr, "%s%2.2d.dat", $s2, i)
    print "reading ", tmpstr
    // read data from segment$i.dat file and append to testtvec and testvvec
    fil = new File()
    numpts = fil.scanvar()
    for j=0,numpts-1 {

reconst(NSEGS, "segment")

// $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()
  for i=0,$o1.size()-1 tfil.printf("%g\t%g\n", $o1.x[i], $o2.x[i])

// finally, write testtvec and testvvec to a file
xytofile(testtvec, testvvec, "reconst.dat")

print "exit NEURON, then compare complete.dat and reconst.dat"

Verifying that the reconstituted and original results are identical

At the UNIX/Linux command line

ls -l reconst.dat complete.dat

reveals that both files are 3194 bytes long, and

cmp reconst.dat complete.dat

returns no error message, so their contents are identical