My goal (and current dilemma) is to plot both the biophysical APs and NetStim Pulses. Eventually, I'd like to combine these plots onto one graph.
The graphing of biophysical APs was created using the gui and saved in session.ses. In order to plot the NetStims pulses I incorporated https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=1037.
Prior to calling plotraster() my AP graph plots properly. Post-plotraster() the AP graph becomes 'marks'.
I have attached my init.hoc, netdefs.hoc, and session.ses code, though I believe my issues are confined to init.hoc. Specifically, I believe the line
Code: Select all
idvec.mark(g2, timevec, "|")
Thank you,
Rich
init.hoc
Code: Select all
// Developed from The NEURON Book, Chapter 12.
load_file("nrngui.hoc") // loads the tools to access the model parameters through the GUI interface
//load_template("model_Default_Cells.hoc") //This command is very slow under mswindows. Therefore it is often useful to explicitly load with the statement:
xopen("model_Default_Cells.hoc") // Load neural model
xopen("netdefs.hoc") // cells, nclist, & netcon code
//load_file("makenet.hoc") // specifies network
//load_file("rig.hoc") // to adjust parameters and run simulation
//Network instantiation
/* S0 */ cell_append(new S_NetStim(), -51, 120, 0)
/* S1*/ cell_append(new S_NetStim(), -51, 120, 0)
/* D2 */ cell_append(new Default_Cell(), 30, 123, 0)
/* D3 */ cell_append(new Default_Cell(), 30, 123, 0)
//connect cells.object($1) soma.v to cells.object($2) @ cells.object($2).synlist.object($3) w/ a weight = $4 & delay = $5
/* S0 -> D2.E0 */ nc_append(0, 2, 0, 0.015,1)
/* S1 -> D2.E1 */ nc_append(1, 2, 1, 0.015,1)
/* S1 -> D3.E0 */ nc_append(1, 3, 0, 0.015,1)
/* S1 -> D3.E1 */ nc_append(1, 3, 1, 0.015,1)
/* D2-> D3.I4 */ nc_append(2, 3, 3, 0.01,1)
//End Network instantiation
//Mark spikes in rastor plot
// From https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=1037
objref timevec, idvec, recncs, tobj, nil
timevec = new Vector()
idvec = new Vector()
recncs = new List()
cells.object(2).soma tobj = new NetCon(&v(0.5), nil)
tobj.record(timevec, idvec, 2) // so all the spike rasters lie above the x axis
recncs.append(tobj)
cells.object(3).soma tobj = new NetCon(&v(0.5), nil)
tobj.record(timevec, idvec, 3) // so all the spike rasters lie above the x axis
recncs.append(tobj)
objref tobj // so we don't accidentally mess up the last NetCon
objref g2
proc plotraster() {
g2 = new Graph()
g2.size(0,300,-6,6)
g2.view(0, -80, 500, 120, 362, 25, 487.3, 289.9)
idvec.mark(g2, timevec, "|")
}
proc myrun() {
run()
plotraster()
}
//End Mark spikes in rastor plot
xopen("session.ses")
tstop = 300 //Run the simulation for 300 timesteps (ms)
secondorder=0 // This is a global variable which specifies the time integration method.
dt=1e10 //The integration interval for fadvance ().
myrun()
Code: Select all
{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[5]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List() scene_list_ = new List()}
{pwman_place(0,0,0)}
{
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 = 1000
xvalue("t","t", 2 )
tstop = 1000
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 = 6.9
xvalue("Real Time","realtime", 0,"", 0, 1 )
xpanel(75,460)
}
{
save_window_ = new PlotShape(0)
save_window_.size(-13.75,1014.75,-437.257,591.755)
save_window_.variable("v")
scene_vector_[3] = save_window_
{save_window_.view(-13.75, -437.257, 1028.5, 1029.01, 79, 122, 200.7, 200.8)}
fast_flush_list.append(save_window_)
save_window_.save_name("fast_flush_list.")
}
{
save_window_ = new Graph(0)
save_window_.size(0,500,-80,40)
scene_vector_[4] = save_window_
{save_window_.view(0, -80, 500, 120, 362, 25, 487.3, 289.9)}
graphList[0].append(save_window_)
save_window_.save_name("graphList[0].")
save_window_.addexpr("Default_Cell[1].soma.v( 0.5 )", 3, 1, 0.8, 0.9, 2)
}
objectvar scene_vector_[1]
{doNotify()}
Code: Select all
//Network instantiation interface. The following elements were created via NetBuilder. They were commented out and left as a reminder of how to execute the commands.
objref cells, nclist, netcon
{cells = new List() nclist = new List()}
func cell_append() {cells.append($o1) $o1.position($2,$3,$4)
return cells.count - 1
}
func nc_append() {//srcindex, tarcelindex, synindex
// netcon is created on the source and connected to destination.
// the target maitains a list of its synapses
// a global nclist is maintained for all connections
if ($3 >= 0) {
netcon = cells.object($1).connect2target(cells.object($2).synlist.object($3))
netcon.weight = $4 netcon.delay = $5
}else{
netcon = cells.object($1).connect2target(cells.object($2).pp)
netcon.weight = $4 netcon.delay = $5
}
nclist.append(netcon)
return nclist.count - 1
}