Population Activity of CBGTC spike times

class analyseur.cbgtc.visual.popact.VizPopAct[source]

Bases: object

Methods

plot_heatmap()

plot_heatmap_in_ax()

plot_pcatraj()

plot_pcatraj_in_ax()

plot_popcount_dist_in_ax()

plot_popcount_vs_time_in_ax()

Use Cases

1. Pre-requisites

1.1. Import Modules

from analyseur.cbgtc.loader import LoadSpikeTimes
from analyseur.cbgtc.visual.popact import VizPopAct

1.2. Load file and get spike times

loadST = LoadSpikeTimes("spikes_GPi.csv")
spiketimes_superset = loadST.get_spiketimes_superset()

2. Visualize

To visualize pass the spiketimes to respective method.


classmethod plot_heatmap(spiketimes_set, binsz=None, window=None, nucleus=None)[source]

Displays the Population Activity Heatmap of the given spike times and returns the plot figure (to save if necessary) using plot_heatmap_in_ax()

Parameters:

spiketimes_set – Dictionary returned using get_spiketimes_superset()

or using get_spiketimes_subset()

Parameters:
  • binsz – defines the number of equal-width bins in the range [default: 50]

  • window – defines upper and lower range of the bins but ignore lower and upper outliers [default: (0,10000)]

  • nucleus – [OPTIONAL] None or name of the nucleus (string)

  • show – boolean [default: True]

Returns:

object matplotlib.pyplot.imshow

  • window controls the binning range as well as the spike counting window

  • CBGT simulation was done in seconds so window (0, 10) signifies time 0 s to 10 s

  • popactivity gives a spatio-temporal pattern across neurons


classmethod plot_heatmap_in_ax(fig, ax, spiketimes_set, binsz=None, window=None, nucleus=None)[source]
Population Activity Heatmap

Neurons
^
|  █▓▒░█▓▒░█▓▒░█▓▒░█▓▒░█▓▒░
|  ░▒▓█░▒▓█░▒▓█░▒▓█░▒▓█░▒▓█
|  █▓▒░█▓▒░█▓▒░█▓▒░█▓▒░█▓▒░
|  ░▒▓█░▒▓█░▒▓█░▒▓█░▒▓█░▒▓█
|
+--------------------------------------------------> Time (s)
0        2        4        6        8        10

Each cell represents the spike count of a neuron
within a time bin. Color intensity encodes activity.

Displays the Population Activity Heatmap of the given spike times on the given matplotlib.pyplot.axis and returns the plot figure (to save if necessary)

Parameters:
  • fig – object matplotlib.pyplot.figure

  • ax – object matplotlib.pyplot.axis`

  • spiketimes_set – Dictionary returned using get_spiketimes_superset()

or using get_spiketimes_subset()

Parameters:
  • binsz – defines the number of equal-width bins in the range [default: 50]

  • window – defines upper and lower range of the bins but ignore lower and upper outliers [default: (0,10000)]

  • nucleus – [OPTIONAL] None or name of the nucleus (string)

Returns:

object matplotlib.pyplot.imshow

  • window controls the binning range as well as the spike counting window

  • CBGT simulation was done in seconds so window (0, 10) signifies time 0 s to 10 s

  • popactivity gives a spatio-temporal pattern across neurons


classmethod plot_pcatraj(spiketimes_set, binsz=None, window=None, nucleus=None)[source]

Displays the Population Activity Heatmap of the given spike times and returns the plot figure (to save if necessary) using plot_pcatraj_in_ax()

Parameters:

spiketimes_set – Dictionary returned using get_spiketimes_superset()

or using get_spiketimes_subset()

Parameters:
  • binsz – defines the number of equal-width bins in the range [default: 50]

  • window – defines upper and lower range of the bins but ignore lower and upper outliers [default: (0,10000)]

  • nucleus – [OPTIONAL] None or name of the nucleus (string)

  • show – boolean [default: True]

Returns:

fig object and axes object comprising of three suplots


classmethod plot_pcatraj_in_ax(fig, axes, spiketimes_set, binsz=None, window=None, n_comp=None, nucleus=None)[source]
PCA Trajectory of Population Activity

Principal Component Analysis
┌──────────────────────────────────────────────────────────────┐
│                     PC1 Over Time                            │
│  PC1                                                         │
│   ^        ~~      ~~      ~~       ~~      ~~               │
│   |      ~~  ~~  ~~  ~~  ~~  ~~  ~~  ~~  ~~  ~~              │
│   |____~~____~~____~~____~~____~~____~~____~~_______________ │
│                                                              │
│   +-----------------------------------------------> Time (s) │
└──────────────────────────────────────────────────────────────┘

┌───────────────────────────────┐   ┌───────────────────────────────┐
│ PCA Trajectory (PC1 vs PC2)   │   │ PCA Variance Explained        │
│                               │   │                               │
│  PC2 ^                        │   │ Variance ^                    │
│      |   • • • • • • •        │   │         █                     │
│      |  • • • • • • • •       │   │         ███                   │
│      | • • • • • • • • •      │   │         █████                 │
│      |  • • • • • • • •       │   │         ███████               │
│      |   • • • • • • •        │   │         █████████             │
│      +--------------------->  │   │         +-------------------> │
│            PC1                │   │           Principal Component │
└───────────────────────────────┘   └───────────────────────────────┘

Top: temporal evolution of the first principal component.
Bottom-left: trajectory of activity in PC space (colored by time).
Bottom-right: variance explained by each principal component.

Displays the PCA Trajectory of population activity on the given matplotlib.pyplot.axis and returns the plot figure (to save if necessary)

Parameters:
  • fig – object matplotlib.pyplot.figure

  • ax – object matplotlib.pyplot.axis`

  • spiketimes_set – Dictionary returned using get_spiketimes_superset()

or using get_spiketimes_subset()

Parameters:
  • binsz – defines the number of equal-width bins in the range [default: 50]

  • window – defines upper and lower range of the bins but ignore lower and upper outliers [default: (0,10000)]

  • n_comp – integer or float; 0.95 [default]

  • nucleus – [OPTIONAL] None or name of the nucleus (string)

Returns:

fig object and axes object comprising of three suplots


classmethod plot_popcount_dist_in_ax(ax, spiketimes_set, binsz=None, nucleus=None, mode=None)[source]
Population Spike Count Distribution

Probability Density
^
|            █
|          ████
|        ███████
|      ██████████
|    ██████████████
|  ██████████████████
|        │
|        │  Mean
+-----------------------------------------------> Spike Counts per Bin
0      50      100      150      200      250

Histogram shows the distribution of population spike counts
(complexity) across time bins. The vertical marker indicates
the mean spike count.

Draws the Distribution of Population Spike Counts (complexity) across time bin on the given matplotlib.pyplot.axis

Parameters:

spiketimes_set – Dictionary returned using get_spiketimes_superset()

or using get_spiketimes_subset()

Parameters:

binsz – integer or float; 0.01 [default]

OPTIONAL parameters

  • param nucleus:

    string; name of the nucleus

  • param mode:

    “portrait” or None/landscape [default]

  • return:

    object ax with Rate Distribution plotting done into it

INTERPRETATION

Distribution Shape

Interpretation

Poisson-like

Random Independent firing

Right skew

Bursty/synchronous activity

Narrow distribution

Regular/independent firing


classmethod plot_popcount_vs_time_in_ax(ax, spiketimes_set, binsz=None, nucleus=None)[source]
Population Spike Counts vs Time

Spike Count
^
|     ███ ████ ████ ███ ████ ███
|    ███████████████████████████
|   ████████████████████████████
|----------------------------------  Mean
|
+--------------------------------------------------> Time (s)
0        2        4        6        8        10

Bars represent the number of spikes in the population
within each time bin. The dashed line indicates the
mean spike count across bins.

Draws the Population Spike Counts over time on the given matplotlib.pyplot.axis

Parameters:

spiketimes_set – Dictionary returned using get_spiketimes_superset()

or using get_spiketimes_subset()

Parameters:

binsz – integer or float; 0.01 [default]

OPTIONAL parameters

  • param nucleus:

    string; name of the nucleus

  • return:

    object ax with Rate Distribution plotting done into it