Attempting to generate Raster Plot for 2 cell network

The basics of how to develop, test, and use models.
Post Reply
sean.powell

Attempting to generate Raster Plot for 2 cell network

Post by sean.powell »

Keep in mind, this is coming from a total beginner.
I have created a network of two cells and am attempting to create a Raster Plot to record the spiking of each but I am having trouble getting it to appear. An empty graph shows up when I run the program but that is all. I believe it may be because the list "cells" referenced in the Raster plotting files is not specified anywhere, so it does not know what to graph.
I'm assuming this is an easy fix, but I unsure of how to tell the program that this list, "cells", contains the the two network neurons.

Code: Select all

//// Prepare to record spike trains
objref netcon, vec, spikes, nil // nil is an alias for NULLobject
spikes = new List()

for i=0, cells.count()-1 { //  iterate over all cells
  vec = new Vector()
  netcon = new NetCon(cells.object(i),nil)
  netcon.record(vec)  // vec will record the firing times
  spikes.append(vec)  // add vec to the list of vectors that record firing times
}

objref netcon, vec // these are not needed anymore

objref graster, spikey
graster = new Graph(0)
graster.size(0, tstop, 0, cells.count())
graster.view(0, 0, tstop, cells.count(), 300, 105, 300.48, 200.32)

proc showraster() {
  graster.erase_all()
  for i=0, cells.count()-1 { // iterate over all cells
      // number of elements in spikey must equal number of spikes fired by cell i
      // value of each element must equal i+1
      spikey = spikes.object(i).c
      spikey.fill(i+1)
      spikey.mark(graster, spikes.object(i), "|", 6)
    }
    objref spikey // this is not needed anymore
}

proc init() {
    finitialize(v_init)
    fcurrent()
    graster.erase_all
}

proc run() {
    running_ = 1
    stdinit()
    continuerun(tstop)
    showraster()
}
Thank you very much for your time!
Sean Powell
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Attempting to generate Raster Plot for 2 cell network

Post by ted »

Not so bad for a "total beginner."

The first question is: are there are any spike times to be plotted?

Code: Select all

for i=0,spikes.count()-1 (
  print i
  spikes.o(i).printf()
)
sean.powell

Re: Attempting to generate Raster Plot for 2 cell network

Post by sean.powell »

I thought that Raster plots were made to show the location of spikes for different cells (spaced apart on the y axis) with time on the x axis. Is there another way that these plots are typically used?
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Attempting to generate Raster Plot for 2 cell network

Post by ted »

Let me try again. Might the attempted raster plot be empty because the spike time vectors are empty? The code in my previous post is one way to test that hypothesis.
Post Reply