Peri-Stimulus Time Histogram (PSTH) of CBGTC spike times¶
- class analyseur.cbgtc.visual.peristimulus.VizPSTH[source]¶
Bases:
objectThe Peri-Stimulus Time Histogram (PSTH) Class.
Methods
Return
matplotlib.pyplot.hist object
matplotlib.pyplot.axis object
Use Case:
Setup
from analyseur.cbgtc.loader import LoadSpikeTimes from analyseur.cbgtc.visual.peristimulus import VizPSTH loadST = LoadSpikeTimes("/full/path/to/spikes_GPi.csv") spiketimes_superset = loadST.get_spiketrains()
Peri-Stimulus Time Histogram for the whole simulation window
VizPSTH.plot_pool(spiketimes_superset)
PSTH for desired window and bin size
VizPSTH.plot_pool(spiketimes_superset, window=(0,5), binsz=1) # time unit in seconds VizPSTH.plot_pool(spiketimes_superset, window=(0,5), binsz=0.05)
PSTH gives an overall temporal pattern of population activity with a picture in both temporal and rate
The computation is done by
PSTH
- classmethod plot_avg(spiketimes_set, binsz=0.01, window=(0, 10), neurons='all', nucleus=None, show=True)[source]¶
Displays the Averaged Peri-Stimulus Time Histogram (PSTH) of the given spike times (seconds) and returns the plot figure (to save if necessary) using
plot_avg_in_ax().- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Parameters:
binsz – integer or float; 0.01 [default]
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” [default] 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
show – boolean [default: True]
- Returns:
object matplotlib.axes.Axes
containing matplotlib.pyplot.bar
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
- classmethod plot_avg_in_ax(ax, spiketimes_set, binsz=None, window=None, neurons=None, nucleus=None)[source]¶
Averaged PSTH (Population Activity) Average Firing Rate (Hz) ^ | ┬ ┬ ┬ ┬ ┬ | ███ ███ ███ ███ ███ | ███ ███ ███ ███ ███ | ███ ███ ███ ███ ███ | ┴ ┴ ┴ ┴ ┴ +--------------------------------------------------> Time (s) 0 2 4 6 8 10 Bars represent the population-average firing rate per time bin. Error bars indicate variability across neurons (SEM).
Draws the Averaged Peri-Stimulus Time Histogram (PSTH) 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()- Parameters:
binsz – integer or float; 0.01 [default]
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” [default] 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
- Returns:
object ax with PSTH plotting done into it
- classmethod plot_pool(spiketimes_set, binsz=0.01, window=(0, 10), neurons='all', nucleus=None, show=True)[source]¶
Displays the Pooled Peri-Stimulus Time Histogram (PSTH) of the given spike times (seconds) and returns the plot figure (to save if necessary) using
plot_pool_in_ax().- Parameters:
spiketimes_set – Dictionary returned using
get_spiketimes_superset()
or using
get_spiketimes_subset()- Parameters:
binsz – integer or float; 0.01 [default]
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” [default] 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
show – boolean [default: True]
- Returns:
object matplotlib.axes.Axes
containing matplotlib.pyplot.bar
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
- classmethod plot_pool_in_ax(ax, spiketimes_set, binsz=None, window=None, neurons=None, nucleus=None)[source]¶
Pooled PSTH (Population Activity) Total Spike Count | | ████ █████ ████ █████ ████ | ████ █████ ████ █████ ████ | ████ █████ ████ █████ ████ | +--------------------------------------------------> Time (s) 0 2 4 6 8 10 Histogram bins show spike counts aggregated across neurons. Each bar represents the number of spikes from the pooled neuron population within a time bin.
Draws the Pooled Peri-Stimulus Time Histogram (PSTH) 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()- Parameters:
binsz – integer or float; 0.01 [default]
window – Tuple in the form (start_time, end_time); (0, 10) [default]
neurons –
“all” [default] 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
- Returns:
object ax with PSTH plotting done into it