Distribution Plotting of CBGTC spike times¶
Distribution Plotting¶
Functions |
|---|
1. Pre-requisites¶
1.1. Import Modules¶
from analyseur.cbgtc.loader import LoadSpikeTimes
from analyseur.cbgtc.visual.distribution import <desired_method>
1.2. Load file and get spike times¶
loadST = LoadSpikeTimes("spikes_GPi.csv")
spiketimes_set = loadST.get_spiketimes_superset()
2. Cases¶
2.1. Standard plot¶
<desired_method>(spiketimes_set)
2.2. Create the plot for customization¶
This is for power users who for instance want to insert the plot in their collage of subplots.
import matplotlib.pyplot as plt
from analyseur.cbgtc.visual.distribution import plot_ratedist_in_ax
fig, (ax1, ax2) = plt.subplots(1, 2)
fig.suptitle('Horizontally stacked subplots')
ax1 = plot_ratedist_in_ax(ax1, spiketimes_set)
ax2 = plot_ratedist_in_ax(ax2, spiketimes_set)
plt.show()
- analyseur.cbgtc.visual.distribution.plot_isi_distrib(spiketimes_set, n_bins=50)[source]¶
Interspike Interval Distributions ┌─────────────────────────────────────┐ ┌─────────────────────────────────────┐ │ Neuron ISI Distributions │ │ Population ISI Distributions │ │ │ │ │ │ Density │ │ Density │ │ ^ │ │ ^ │ │ | ████ │ │ | ████ │ │ | ████████ │ │ | ████████ │ │ | ███████████ │ │ | ███████████ │ │ | █████████ │ │ | █████████ │ │ | █████ │ │ | █████ │ │ | │ │ | │ │ +---------------------------------> │ │ +---------------------------------> │ │ Interspike Interval (s) │ │ Interspike Interval (s) │ └─────────────────────────────────────┘ └─────────────────────────────────────┘ Left: overlapping ISI histograms for individual neurons. Right: histogram of ISIs pooled across the entire population.
Visualize Distribution of Inter-Spike Interval of the given neuron population.
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param n_bins:
50 [default]
- return:
object ax with ISI Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_latencydist(spiketimes_set, stimulus_onset=None, binsz=None, window=None, neurons=None, nucleus=None, orient=None)[source]¶
Visualize Latency Distribution of the given neuron population using
plot_latencydist_in_ax()- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param stimulus_onset:
float
- param binsz:
integer or float; defines the number of equal-width bins in the range
- param window:
2-tuple; defines upper and lower range of the bins
- param neurons:
“all” or list: range(a, b) or [1, 4, 5, 9]
- param nucleus:
string; name of the nucleus
- param orient:
“horizontal” or None [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_latencydist_in_ax(ax, spiketimes_set, stimulus_onset=None, binsz=None, window=None, neurons=None, nucleus=None, orient=None)[source]¶
Response Latency Distribution Number of Neurons ^ | █ | ████ | ███████ | ███████████ | ███████████████ | ███████████ | │ | │ Mean +-------------------------------------------------> Response Latency (s) 0.000 0.005 0.010 0.015 0.020 0.025 Histogram shows the distribution of response latencies across neurons. The vertical marker indicates the mean response latency.
Draws the Population Latency Distribution on the given matplotlib.pyplot.axis
- Parameters:
ax – object matplotlib.pyplot.axis`
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param stimulus_onset:
float; 0 [default]
- param binsz:
integer or float; 0.01 [default]
- param window:
2-tuple; (0, 10) [default]
- param neurons:
“all” [default] or list: range(a, b) or [1, 4, 5, 9]
- param nucleus:
string; name of the nucleus
- param orient:
“horizontal” or None [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_ratedist(spiketimes_set, binsz=None, window=None, neurons=None, nucleus=None, orient=None)[source]¶
Visualize Rate Distribution of the given neuron population using
plot_ratedist_in_ax()- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param binsz:
integer or float; defines the number of equal-width bins in the range
- param window:
2-tuple; defines upper and lower range of the bins
- param neurons:
“all” or list: range(a, b) or [1, 4, 5, 9]
- param nucleus:
string; name of the nucleus
- param orient:
“horizontal” or None [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_ratedist_in_ax(ax, spiketimes_set, binsz=None, window=None, neurons=None, nucleus=None, orient=None)[source]¶
Population Rate Distribution Number of Neurons ^ | █ | ████ | ███████ | ███████████ | ███████████████ | ███████████████████ | │ | │ Mean +-------------------------------------------------> Firing Rate (Hz) 65 70 75 80 85 90 95 100 Histogram shows the distribution of firing rates across neurons. The vertical marker indicates the mean population firing rate.
Draws the Population Rate Distribution on the given matplotlib.pyplot.axis
- Parameters:
ax – object matplotlib.pyplot.axis`
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param binsz:
integer or float; 0.01 [default]
- param window:
2-tuple; (0, 10) [default]
- param neurons:
“all” [default] or list: range(a, b) or [1, 4, 5, 9]
- param nucleus:
string; name of the nucleus
- param orient:
“horizontal” or None [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_spike_counts_distrib(spiketimes_set, neurons=None, nucleus=None, orient=None)[source]¶
Visualize Spike Count Distribution of the given neuron population using
plot_spike_counts_distrib_in_ax()- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param neurons:
“all” or list: range(a, b) or [1, 4, 5, 9]
- param nucleus:
string; name of the nucleus
- param orient:
“horizontal” or None [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_spike_counts_distrib_in_ax(ax, spiketimes_set, neurons=None, nucleus=None, orient=None)[source]¶
Cumulative Spike Count ^ | ███████████████████ | █████ | █████ | █████ | █████ | █████ | █████ | +-------------------------------------------------> Time (s) 0 2 4 6 8 10 Thin step curves represent cumulative spike counts for individual neurons. The thicker curve represents the total cumulative spike count of the entire neuron population.
Draws the Spike Count Distribution on the given matplotlib.pyplot.axis
- Parameters:
ax – object matplotlib.pyplot.axis`
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param neurons:
“all” [default] or list: range(a, b) or [1, 4, 5, 9]
- param nucleus:
string; name of the nucleus
- param orient:
“horizontal” or None [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.distribution.plot_spike_density_distrib(spiketimes_set, window=(0, 10), bandwidth=0.1, plot_type='line')[source]¶
Visualize Spike Density Distribution of the given neuron population using
plot_spike_density_distrib_line_in_ax()orplot_spike_density_distrib_stacked_in_ax()(depending on the plot_type).- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param window:
2-tuple; defines upper and lower range of the bins
- param bandwidth:
0.1 [default]
- param plot_type:
“line” [default] or “stacked”
- return:
object ax with spike density distribution plot done into it
- analyseur.cbgtc.visual.distribution.plot_spike_density_distrib_line_in_ax(ax, spiketimes_set, window=(0, 10), bandwidth=0.1)[source]¶
Population Spike Density Density ^ | ________ | __-- --__ | _-- --_ | _-- --_ | _-- --_ |______-- --______ | +-------------------------------------------------> Time (s) 0 2 4 6 8 10 Smooth red curve represents the population spike density estimated using kernel density estimation (KDE) over all spikes in the neuron population.
Visualize Spike Density Distribution of the given neuron population.
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param window:
2-tuple; defines upper and lower range of the bins
- param bandwidth:
0.1 [default]
- return:
object ax with Spike Density Distribution plot done into it
- analyseur.cbgtc.visual.distribution.plot_spike_density_distrib_stacked_in_ax(ax, spiketimes_set, window=(0, 10), bandwidth=0.1, max_neurons=20)[source]¶
Density + Offset ^ | ───────────── population density | | ~~~~~~~~ neuron 10 | ~~~~~~~~ neuron 9 | : : : | ~~~~~~~~ neuron 3 | ~~~~~~~~ neuron 2 | ~~~~~~~~ neuron 1 | +------------------------------------> Time
Visualize Spike Density Distribution of the given neuron population and plot max_neurons such that plot of one neuron is stacked over another.
- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- param window:
2-tuple; defines upper and lower range of the bins
- param bandwidth:
0.1 [default]
- param max_neurons:
20 [default]
- return:
object ax with Spike Density Distribution plot done into it