The following code sample displays a shape-shape plot by playing vectors into the voltage of the sections. It is better to voltage clamp the sections but this will probably work for you. The shp.ses file was created by saving the shape shape plot as a session file and is included after the long dashed line. You might want to lower 1e6 for a slower processor, raise for a faster processor. Start with "nrngui shapeshape.hoc" File shapeshape.hoc:
Code: Select all
create soma
create dend
soma connect dend(0), 1
objref v1, v2
num_of_time_pts = tstop/dt+1 // if tstop was 1 ms and dt=1ms, you have two pts t=0, 1
v1 = new Vector(num_of_time_pts)
v2 = new Vector(num_of_time_pts)
volt1=-120
volt2=40
// make one section go up, the other go down
v1.indgen(volt1, volt2 , (volt2-volt1)/(num_of_time_pts-1))
v2.indgen(-volt2, -volt1 , -(volt1-volt2)/(num_of_time_pts-1)).mul(-1)
v1.play(&soma.v(0.5), dt)
v2.play(&dend.v(0.5), dt)
access soma
load_file("shp.ses")
PlotShape[0].exec_menu("Shape Plot")
x=0 // needed initialization
init()
while (t<=tstop) {
step()
flushPlot()
for i=1,1e6 { x=x+1-1 } // add delay to see graph
}
------------------------------------------------------------------------ shp.ses:
Code: Select all
{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[3]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List() scene_list_ = new List()}
{pwman_place(0,0,0)}
{
save_window_ = new PlotShape(0)
save_window_.size(-221.75,421.75,-321.237,321.237)
save_window_.variable("v")
scene_vector_[2] = save_window_
{save_window_.view(-221.75, -321.237, 643.5, 642.474, 251, 173, 200.64, 200.32)}
fast_flush_list.append(save_window_)
save_window_.save_name("fast_flush_list.")
}
{
xpanel("RunControl", 0)
v_init = -65
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","run()")
xbutton("Stop","stoprun=1")
runStopAt = 5
xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 )
runStopIn = 1
xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 )
xbutton("Single Step","steprun()")
t = 1.55
xvalue("t","t", 2 )
tstop = 5
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
dt = 0.025
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
screen_update_invl = 0.05
xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 )
realtime = 0
xvalue("Real Time","realtime", 0,"", 0, 1 )
xpanel(768,134)
}
objectvar scene_vector_[1]
{doNotify()}