For the purpose of exploratory simulations, I created a program that sets up the model network and provides just enough of a graphical user interface to launch a simulation and display results. The main file is initnet_basic.hoc
load_file("nrngui.hoc") load_file("netspec.hoc") // properties of network load_file("netrig.hoc") // basic instrumentation and simulation control // required to launch a simulation and see results // i.e. just a RunControl, Vector recording of spike times and cell IDs, // and a graph that shows a spike raster
The computational model is just a single instance of the NetStim class, with a nonzero noise parameter. This is specified in netspec.hoc
objref ns ns = new NetStim() ns.interval = 1000/7 // "theta" ns.number = 1e9 ns.start = 1 ns.noise = 0.5 // minimum ISI is ns.interval*ns.noise
And here is netrig.hoc, which records and generates a raster plot of the spike times, and offers user controls for launching new simulations. Since this toy network contains only one artificial spiking cell and is being run on serial hardware, there is no need to use gids, Instead, I "fake" a Vector of gids by generating a new Vector called idvec, making it the same size as the Vector of recorded spike times, and setting all of its elements to 0 (because that's the index of the only cell in the model).
///// specify instrumentation for manual exploration of model cell ///// basic instrumentation // capture spikes, show after end of simulation // for devel & debugging simulations that generate up to about 100 spikes objref spikes, idvec, nc, nil spikes = new Vector() // for spike times idvec = new Vector() // for cell IDs nc = new NetCon(ns, nil) nc.record(spikes) // this toy model has no gids, so we fake them proc fake_idvec() { idvec = new Vector(spikes.size()) idvec.fill(0) } objref g proc plotspikes() { localobj cellids g = new Graph(0) g.size(tstart,tstop, 0, 1) g.view(tstart, 0, tstop, 1, 265, 105, 300.48, 200.32) fake_idvec() // just for this toy model cellids = new Vector() cellids = idvec.c // so we don't mess up the idvec cellids.add(1) // move all rasters up 1 to avoid putting marks on the x axis cellids.mark(g, spikes, "|", 12) } ///// basic simulation control cvode.active(1) // turn on adaptive integration tstart = 0 tstop = 9000 // simulation duration proc myrun() { run() plotspikes() // display the spike raster } { xpanel("RunControl", 0) xvalue("Init","v_init", 1,"stdinit()", 1, 1 ) // xbutton("Init & Run","run()") xbutton("Init & Run","myrun()") 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 = 0 xvalue("t","t", 2 ) 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(0,105) }
I used this program to run simulations in order to verify that the model was implemented properly, and that the model generated enough spikes to validate the segmentation and reconstitution of a complete simulation.