// 

load_file("sj3-cortex.hoc")
load_file("wiring_proc.hoc")
load_file("noise.hoc") 
UnoiseV(-0.3,0.3)
UnoiseII(-0.3,0.3)
UnoiseIPL5(-0.3,0.3)
UnoiseIPL2(-0.3,0.3)
strdef FN

// ****************Load wiring configuration file here:
load_file("wiring-config_suprathresh.hoc")
// ****************Output file name here:
FN="suprathresh.dat"

//Total time for one run
tstop=175
// time increment
dt=0.025
// Number of runs
NRUN = 100
///////////////////////////////////////////////////////////////////////////////////////////////
// Setup the NetStims
NetStimG[0].MeanInterval = 1
NetStimG[0].SD = 0.5
NetStimG[0].MeanStart = 25
NetStimG[0].StartSD = 2.5
NetStimG[0].number = 1
NetStimG[0].noise = 1
NetStimG[0].interval = 0

// Setup the NetStims
NetStimG[1].MeanInterval = 1
NetStimG[1].SD = 1
NetStimG[1].MeanStart = 70
NetStimG[1].StartSD = 6
NetStimG[1].number = 1
NetStimG[1].noise = 1
NetStimG[1].interval = 0
//// Setup the NetStims
NetStimG[2].MeanInterval = 1
NetStimG[2].SD = 1
NetStimG[2].MeanStart = 135
NetStimG[2].StartSD = 7
NetStimG[2].number = 1
NetStimG[2].noise = 1
NetStimG[2].interval = 0
//

////
proc runonce(){
finitialize(-65)
fcurrent()

while (t<tstop){
          fadvance()
// below put a '%f' for every data type defined
          fprint( "%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f \n", \
 t, \
 L2_dipole(), \
 L5_dipole(), \
 dL2+dL5, \
dset(PL2[1].all), \
dset(PL2[1].apical), \
 dset(PL2[1].basal), \
 dset(PL2[5].all), \
 dset(PL2[5].apical), \
 dset(PL2[5].basal), \
 dset(PL2[9].all), \
 dset(PL2[9].apical), \
 dset(PL2[9].basal), \
 dset(PL5[1].all), \
 dset(PL5[1].apical), \
 dset(PL5[1].basal), \
 dset(PL5[5].all), \
 dset(PL5[5].apical), \
 dset(PL5[5].basal), \
 dset(PL5[9].all), \
 dset(PL5[9].apical), \
 dset(PL5[9].basal), \
 PL2[1].soma.v(0.5), \
PL2[5].soma.v(0.5), \
PL2[9].soma.v(0.5), \
 PL5[1].soma.v(0.5), \
PL5[5].soma.v(0.5), \
 PL5[9].soma.v(0.5)  )  // end print statement
}
} //end runonce()


proc runit(){ local i
wopen(FN)
for i=0, NRUN-1{ runonce() print(i)}
wopen()
}

runit()