Raster plot of spikes in network

The basics of how to develop, test, and use models.
Post Reply
abogaard
Posts: 8
Joined: Mon Feb 05, 2007 4:21 pm
Location: ann arbor, mi

Raster plot of spikes in network

Post by abogaard »

I have created a network of biophysical cells (around 50) with a simple ring architecture. Each cell has a single connection to each beside it. I stimulate firing in the soma of one cell, and watch the spikes propogate through the ring using the simple v graph, plotting about 8 different cells through the ring.

I would like to generate a raster plot of the spikes with t along x axis, cell no. along y axis, and dots representing spikes. I am under the impression that this is an option native to the gui, but I am unable to find it.

Forgive me if this is somewhere else in the forums, but I have spent much of the day googling and searching these pages.

Thanks,
Andrew
abogaard
Posts: 8
Joined: Mon Feb 05, 2007 4:21 pm
Location: ann arbor, mi

Post by abogaard »

(without SpikePlot, since I did not use network builder)
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Generating your own raster plot with hoc

Post by ted »

abogaard wrote:(without SpikePlot, since I did not use network builder)
Then you'll have to roll your own with hoc. Piece of cake with the NetCon class's record() method--
http://www.neuron.yale.edu/neuron/stati ... tml#record
In particular, I refer to the netcon.record(tvec, idvec, id) syntax.

For example, suppose your model neurons have been appended to a List called cells, and
that each one has its spike trigger zone at its soma. Then

Code: Select all

objref timevec, idvec, recncs, tobj, nil
timevec = new Vector()
idvec = new Vector()
recncs = new List()
for i=0,cells.count()-1 {
  cells.object(i).soma tobj = new NetCon(&v(0.5), nil)
  tobj.record(timevec, idvec, i+1) // 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
Now all you have to do is run a simulation, then after the end of the simulation, pop up a
new Graph object, and use the Vector class's mark() method to draw vertical bars | --see
http://www.neuron.yale.edu/neuron/stati ... .html#mark

Code: Select all

objref g
proc plotraster() {
  g = new Graph()
  idvec.mark(g, timevec, "|")
}

proc myrun() {
  run()
  plotraster()
}

// call myrun() to launch a simulation and generate a raster plot
Further refinements are possible, e.g. control of position and scaling of the raster plot,
or implementing a dynamically-updated raster plot, but this should be enough to get you
going.
abogaard
Posts: 8
Joined: Mon Feb 05, 2007 4:21 pm
Location: ann arbor, mi

Post by abogaard »

Wow - an impressive, quick response. I really appreciate it, and will post back if I run into any difficulties. (looks pretty simple written out like that, though)
ps0322

Re: Raster plot of spikes in network

Post by ps0322 »

Hi,
I following the code for raster plot in this thread . When I run it the spikes are misplaced.
Ex.
Image
I wonder how could I fix the scale of the graph? Is it possible to make it auto adjust?
Thanks in advance.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Raster plot of spikes in network

Post by ted »

ps0322 wrote:the spikes are misplaced.
No, they're exactly where they should be. You need to specify axis scales that span your data. Read about the Graph class's methods for specifying axis ranges--it's in the Programmer's Reference.
how could I fix the scale of the graph?
Click on the graph's menu box (left upper corner of its canvas), choose "Set view" from the graph's secondary menu, then specify the x and y axis ranges. Or use the Graph class's functions for doing this--see the Programmer's Reference.
Is it possible to make it auto adjust?
Select "View = plot" from the graph's secondary menu. Or use the graph's exec_menu() method to execute "View = plot"--see the Programmer's Reference.

You might find it helpful to read "How to use hoc to plot a variable vs. time"--it's in the Hot tips area of the Forum.
ps0322

Re: Raster plot of spikes in network

Post by ps0322 »

Thank you for your prompt response!!
Post Reply