Visualize Rate Statistics of CBGTC spike times¶
Rate Plotting¶
Functions |
|---|
Plot Mean Rate¶
1. Pre-requisites¶
1.1. Import Modules¶
from analyseur.cbgtc.loader import LoadSpikeTimes
from analyseur.cbgtc.visual.rate import plot_mean_rate_isi
1.2. Load file and get spike times¶
loadST = LoadSpikeTimes("spikes_GPi.csv")
spiketimes_superset = loadST.get_spiketimes_superset()
2. Cases¶
2.1. Visualize Mean Rate with default setting¶
[fig, ax] = plot_mean_rate_isi(spiketimes_superset)
2.2. Visualize Mean Rate in portrait mode¶
[fig, ax] = plot_mean_rate_isi(spiketimes_superset, mode="portrait")
2.3. Visualize Mean Rate in portrait mode with nucleus name in title¶
[fig, ax] = plot_mean_rate_isi(spiketimes_superset, mode="portrait", nucleus="GPi")
2.4. Create the plot for customization¶
This is for power users who for instance want to insert the Mean Rate plot in their collage of subplots.
import matplotlib.pyplot as plt
from analyseur.cbgtc.visual.rate import plot_mean_rate_isi_in_ax
fig, (ax1, ax2) = plt.subplots(1, 2)
fig.suptitle('Horizontally stacked subplots')
ax1 = plot_mean_rate_isi_in_ax(ax1, spiketimes_superset)
ax2 = plot_mean_rate_isi_in_ax(ax2, spiketimes_superset)
plt.show()
NOTE: This example shows plot_mean_rate_isi_in_ax() in default setting but this function works like
plot_mean_rate_isi() therefore all the cases 2.1, 2.2 and 2.3 are applicable for plot_mean_rate_isi_in_ax().
Plot Average Instantaneous Rate¶
Similar as documented above for plotting Mean Rate but using the function
plot_avg_inst_rate() and plot_avg_inst_rate_in_ax() with the
additional OPTIONAL argument for binsz (otherwise it picks a default value).
This is imported as
from analyseur.cbgtc.visual.rate import plot_avg_inst_rate, plot_avg_inst_rate_in_ax
- analyseur.cbgtc.visual.rate.plot_mean_rate_all_neurons_across_time_in_ax(ax, spiketimes_set, window=None, binsz=None, nucleus=None)[source]¶
Mean Population Firing Rate Over Time Firing Rate (Hz) ^ | ~~~ ~~~ ~~~ ~~~ | ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ | ~ ~~ ~~ ~~ ~ | +--------------------------------------------------> Time (s) 0 5 10 15 20 Line shows the mean firing rate of the neuron population as it evolves over time.
Draws the Mean Firing Rate (1/s) over time 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
- Parameters:
window – 2-tuple; (0, 10) [default]
binsz – 0.01 [default]
nucleus – string; name of the nucleus
- Returns:
object ax with plotting of the temporal dynamics of the mean firing rate across neurons
- analyseur.cbgtc.visual.rate.plot_mean_rate_isi(spiketimes_superset, nucleus=None, mode=None)[source]¶
Visualize Mean Rate (1/s) of the given neuron population using
plot_mean_rate_isi_in_ax().- Parameters:
spiketimes_superset – Dictionary returned using
analyseur.cbgtc.stats.isi.InterSpikeInterval.compute()
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
- analyseur.cbgtc.visual.rate.plot_mean_rate_isi_in_ax(ax, spiketimes_set, nucleus=None, mode=None)[source]¶
Mean Rate (1/s) ^ | █ █ █ █ █ █ █ █ | ███ ██ ████ ██ ██ ███ ██ | █████████████████████████ | +---------------------------------------------> Neurons 0 50 100 150 200 Each bar represents the mean firing rate of one neuron computed from its inter-spike intervals (ISI).
Draws the Mean Rate (1/s) 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 nucleus:
string; name of the nucleus
- param mode:
“portrait” or None/landscape [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.rate.plot_mean_rate_spikecounts_in_ax(ax, spiketimes_set, window=None, binsz=None, nucleus=None, mode=None)[source]¶
Mean Rate (1/s) ^ | █ █ █ █ █ █ █ █ | ███ ██ ████ ██ ██ ███ ██ | █████████████████████████ | +---------------------------------------------> Neurons 0 50 100 150 200 Each bar represents the mean firing rate of one neuron computed from spike counts within the analysis window.
Draws the Mean Rate (1/s) 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 nucleus:
string; name of the nucleus
- param mode:
“portrait” or None/landscape [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.rate.plot_pool_avg_inst_rates(spiketimes_superset, binsz=None, nucleus=None, mode=None)[source]¶
Visualize Mean Rate (1/s) of the given neuron population using
plot_pool_avg_inst_rates_in_ax().- Parameters:
spiketimes_superset – Dictionary returned using
LoadSpikeTimes
OPTIONAL parameters
- param binsz:
0.01 [default]
- param nucleus:
string; name of the nucleus
- param mode:
“portrait” or None/landscape [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.rate.plot_pool_avg_inst_rates_in_ax(ax, spiketimes_superset, binsz=None, nucleus=None, mode=None)[source]¶
Average Inst. Rate (Hz) ^ | ███ ████ ███ ████ ███ ███ | █████████████████████████ | ██████████████████████████ | +--------------------------------------------------> Time (s) 0 2 4 6 8 10 Each bar represents the average instantaneous firing rate of the neuron population within a time bin.
Draws the Mean Rate (1/s) on the given matplotlib.pyplot.axis
- Parameters:
ax – object matplotlib.pyplot.axis`
spiketimes_superset – Dictionary returned using
analyseur.cbgtc.stats.isi.InterSpikeInterval.compute()
OPTIONAL parameters
- param binsz:
0.01 [default]
- param nucleus:
string; name of the nucleus
- param mode:
“portrait” or None/landscape [default]
- return:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.rate.plot_true_avg_inst_rate(spiketimes_set, nucleus=None, mode=None)[source]¶
Visualize Instantaneuous Rate (1/s) of the given neuron population using
plot_true_avg_inst_rate_in_ax().- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()OPTIONAL parameters
- Parameters:
neurons –
“all” or scalar or range(a, b) or list of neuron ids like [2, 3, 6, 7]
”all” means subset = superset
N (a scalar) means subset of first N neurons in the superset
range(a, b) or [2, 3, 6, 7] means subset of selected neurons
nucleus – string; name of the nucleus
mode – “portrait” or None/landscape [default]
- Returns:
object ax with Rate Distribution plotting done into it
- analyseur.cbgtc.visual.rate.plot_true_avg_inst_rate_in_ax(ax, spiketimes_set, nucleus=None, mode=None)[source]¶
Avg. Inst. Rate (Hz) ^ | █ █ █ █ █ █ █ █ | ███ ██ ████ ██ ██ ███ ██ | █████████████████████████ | +---------------------------------------------> Neurons 0 50 100 150 200 Each bar represents the average instantaneous firing rate of an individual neuron computed from its ISI sequence.
Draws the Instantaneuous Rate (1/s) 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
- Parameters:
neurons –
“all” or scalar or range(a, b) or list of neuron ids like [2, 3, 6, 7]
”all” means subset = superset
N (a scalar) means subset of first N neurons in the superset
range(a, b) or [2, 3, 6, 7] means subset of selected neurons
nucleus – string; name of the nucleus
mode – “portrait” or None/landscape [default]
- Returns:
object ax with Rate Distribution plotting done into it