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 initnet_fullrun.hoc and initnet_segrun.hoc

Here is init_reconst.hoc

///// read the segmentnn.dat files
///// and reconsititute the results of a complete simulation from them


strdef tmpstr // for constructed file names

objref spikes, idvec
spikes = new Vector()
idvec = 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
  spikes = new Vector()
  idvec = 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("%11.4f\t%d\n", $o1.x[i], $o2.x[i])

// finally, write spikes and idvec to a file
xytofile(spikes, idvec, "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 927 bytes long, and

cmp reconst.dat complete.dat

returns no error message, so their contents are identical