// 
load_file("nrngui.hoc")
create dummy
access dummy
eps=1e-90




objref IF[2], timer, delaytimer, nc_primeIF[4], nc_eventIF[4], nc_actDelay, nc_setIF,nil

for i=0,1 {
    IF[i]=new IntFire4r(0.5)
    IF[i].taum=30
    IF[i].taui1=2
    IF[i].taui2=9
    IF[i].taue=3
}

proc setIF(){
    print "setIF, time:", t
    $o1.e=$2
    $o1.i1=$3
    $o1.i2=$4
    $o1.m=$5
}



timer = new NetStim(0.5)
timer.interval=eps
timer.number=1
timer.start=0
timer.noise=0

delaytimer= new NetStim(0.5)
delaytimer.interval=10
delaytimer.number=1
delaytimer.start=1e9
delaytimer.noise=0




nc_primeIF[0]= new NetCon(timer,IF[0],0,0,eps)
nc_primeIF[1]= new NetCon(timer,IF[0],0,eps,eps)
nc_primeIF[2]= new NetCon(timer,IF[1],0,0,eps)
nc_primeIF[3]= new NetCon(timer,IF[1],0,eps,eps)

// Event lines for synaptic stimulation
nc_eventIF[0]= new NetCon(nil,IF[0],0,0,1)
nc_eventIF[1]= new NetCon(nil,IF[0],0,0,-0.9)
nc_eventIF[2]= new NetCon(nil,IF[1],0,0,1)
nc_eventIF[3]= new NetCon(nil,IF[1],0,0,-0.9)

nc_actDelay= new NetCon(timer,delaytimer,0,eps,1)
nc_setIF= new NetCon(delaytimer,nil,0,0,1)

nrncontrolmenu()
tstop=400
 
objectvar save_window_, rvp_
objectvar scene_vector_[3]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
objectvar Vmgraph[2], Imgraph[2],ISynGraph[2]
{ocbox_list_ = new List()  scene_list_ = new List()}
{
    save_window_ = new Graph(0)
    save_window_.size(0,tstop,-1,1)
    scene_vector_[2] = save_window_
    {save_window_.view(0,-1 , tstop, 2, 200, 320, 300.6, 200.8)}
    graphList[2].append(save_window_)
    save_window_.save_name("graphList[2].")
    save_window_.exec_menu("Keep Lines")
    save_window_.addexpr("IF[1].E()+IF[1].I()-IF[1].M()/IF[1].taum", 9, 1, 0.8, 0.9, 2)
    Imgraph=save_window_
}


{
    save_window_ = new Graph(0)
    save_window_.size(0,tstop,-1,1)
    scene_vector_[2] = save_window_
    {save_window_.view(0,-1 , tstop, 2, 600, 320, 300.6, 200.8)}
    graphList[2].append(save_window_)
    save_window_.save_name("graphList[2].")
    save_window_.exec_menu("Keep Lines")
    save_window_.addexpr("IF[1].E()+IF[1].I()", 9, 1, 0.8, 0.9, 2)
    ISynGraph[0]=save_window_
}

{
    save_window_ = new Graph(0)
    save_window_.size(0,tstop,-1,1)
    scene_vector_[2] = save_window_
    {save_window_.view(0, -1, tstop, 2, 1000, 320, 300.6, 200.8)}
    graphList[2].append(save_window_)
    save_window_.save_name("graphList[2].")
    save_window_.exec_menu("Keep Lines")
    save_window_.addexpr("IF[1].M()", 9, 1, 0.8, 0.9, 2)
    Vmgraph[0]=save_window_
}


objectvar scene_vector_[1]
{doNotify()}



// for myI=-10,10 { nc_setIF.record("setIF(0.3,-0.1,-0.1,0.1*myI)") run()}