Page 1 of 1

Attempting to generate Raster Plot for 2 cell network

Posted: Tue Dec 04, 2018 4:00 pm
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

Re: Attempting to generate Raster Plot for 2 cell network

Posted: Fri Dec 07, 2018 9:46 am
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()
)

Re: Attempting to generate Raster Plot for 2 cell network

Posted: Fri Dec 07, 2018 11:08 am
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?

Re: Attempting to generate Raster Plot for 2 cell network

Posted: Fri Dec 07, 2018 9:40 pm
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.