Marker Plots (Scatter, Raster, etc.) of CBGTC spike times

Marker Plotting

Functions

Purpose

plot_raster()

plots Coefficient of Variations of all the neurons in a population

plot_ratechange()

draws the Coefficient of Variations of all the neurons into a given matplotlib.pyplot.axis

plot_ratechange_in_ax()

plots Local Coefficient of Variations of all the neurons in a population

Raster Plot of Spike Times

1. Pre-requisites

1.1. Import Modules
from analyseur.cbgtc.loader import LoadSpikeTimes
from analyseur.cbgtc.visual.markerplot import plot_raster
1.2. Load file and get spike times
loadST = LoadSpikeTimes("spikes_GPi.csv")
spiketimes_superset = loadST.get_spiketimes_superset()

2. Cases

2.1. Raster for all the neurons
plot_raster(spiketimes_superset)
2.2. Raster for first 50 neurons
plot_raster(spiketimes_superset, neurons=range(50))
2.3. Raster for second 50 neurons
plot_raster(spiketimes_superset, neurons=range(50, 100))
2.4. Create the plot for customization

This is for power users who for instance want to insert the raster plot in their collage of subplots.

import matplotlib.pyplot as plt
from analyseur.cbgtc.visual.markerplot import plot_raster_in_ax

fig, (ax1, ax2) = plt.subplots(1, 2)
fig.suptitle('Horizontally stacked subplots')

ax1 = plot_raster_in_ax(ax1, spiketimes_superset)
ax2 = plot_raster_in_ax(ax2, spiketimes_superset)

plt.show()

NOTE: This example shows plot_raster_in_ax() in default setting but this function works like plot_raster() therefore all the cases 2.1, 2.2 and 2.3 are applicable for plot_raster_in_ax().

Plot Rate Change Scatter

1. Pre-requisites

1.1. Import Modules
from analyseur.cbgtc.loader import LoadSpikeTimes
from analyseur.cbgtc.visual.markerplot import plot_ratechange
1.2. Load file and get spike times
loadST = LoadSpikeTimes("spikes_GPi.csv")
spiketimes_superset = loadST.get_spiketimes_superset()

2. Cases

2.1. Plot Rate Change Scatter for all the neurons
plot_ratechange(spiketimes_superset)

analyseur.cbgtc.visual.markerplot.plot_raster(spiketimes_superset, colors=False, neurons=None, nucleus=None, alpha=True)[source]

Visualize Raster plot for the given neuron population using plot_raster_in_ax().

Parameters:

spiketimes_superset – Dictionary returned using LoadSpikeTimes

OPTIONAL parameters

Parameters:
  • colorsFalse [default] or True

  • neurons“all” [default] or range(a, b) or list of neuron ids like `[2, 3, 6, 7]

  • nucleus – string; name of the nucleus

  • alphaTrue [default]

Returns:

object ax with Raster plotting done into it


analyseur.cbgtc.visual.markerplot.plot_raster_in_ax(ax, spiketimes_superset, window=None, colors=False, neurons=None, nucleus=None, alpha=True)[source]
Raster representation:

neuron ↑
n3 | . .   .    . .
n2 |   . .     .
n1 | .    .   .   .

    └──────────── time →

Draws the Rasterplot (matplotlib.pyplot.eventplot) on the given matplotlib.pyplot.axis

Parameters:
  • ax – object matplotlib.pyplot.axis`

  • spiketimes_superset – Dictionary returned using LoadSpikeTimes

OPTIONAL parameters

Parameters:
  • window – Tuple in the form (start_time, end_time); (0, 10) [default]

  • colorsFalse [default] or True

  • neurons“all” [default] or range(a, b) or list of neuron ids like `[2, 3, 6, 7]

  • nucleus – string; name of the nucleus

  • alphaTrue [default]

Returns:

object ax with Raster plotting done into it


analyseur.cbgtc.visual.markerplot.plot_ratechange(spiketimes_superset, stimulus_onset=None, window=None, neurons=None, nucleus=None, mode=None, alpha=True)[source]

Visualize Rate Change Scatter of the given neuron population using plot_ratechange_in_ax().

Parameters:

spiketimes_superset – Dictionary returned using LoadSpikeTimes

OPTIONAL parameters

Parameters:
  • stimulus_onset – float

  • window – 2-tuple; defines upper and lower range of the bins

  • neurons – “all” or list: range(a, b) or [1, 4, 5, 9]

  • nucleus – string; name of the nucleus

  • mode – “portrait” or None/landscape [default]

  • alphaTrue [default]

Returns:

object ax with Rate Distribution plotting done into it


analyseur.cbgtc.visual.markerplot.plot_ratechange_in_ax(ax, spiketimes_superset, stimulus_onset=None, window=None, neurons=None, nucleus=None, mode=None, alpha=True)[source]
Each point represents one neuron.

y-axis : response firing rate (Hz)
x-axis : baseline firing rate (Hz)

Points above the diagonal → increased firing after stimulus
Points below the diagonal → decreased firing after stimulus

 response ↑
          |
     ↑    |        *
 increase |      *      *
          |    *
          |  *
----------+----------------------→ baseline
          |        *
 decrease |            *
     ↓    |   *
          |
          +----------------------

          dashed line = no change
          (response rate = baseline rate)

Draws the Population Rate Change Scatter on the given matplotlib.pyplot.axis

Parameters:

OPTIONAL parameters

Parameters:
  • stimulus_onset – float; 0 [default]

  • window – 2-tuple; (0, 10) [default]

  • neurons – “all” [default] or list: range(a, b) or [1, 4, 5, 9]

  • nucleus – string; name of the nucleus

  • mode – “portrait” or None/landscape [default]

  • alphaTrue [default]

Returns:

object ax with Rate Distribution plotting done into it