viziphant.unitary_event_analysis.plot_ue

viziphant.unitary_event_analysis.plot_ue(spiketrains, Js_dict, significance_level=0.05, **plot_params)[source]

Plots the results of pairwise unitary event analysis as a column of six subplots, comprised of raster plot, peri-stimulus time histogram, coincident event plot, coincidence rate plot, significance plot and unitary event plot, respectively.

Parameters:
spiketrainslist of list of neo.SpikeTrain

A nested list of trials, neurons and their neo.SpikeTrain objects, respectively. This should be identical to the one used to generate Js_dict.

Js_dictdict

The output of elephant.unitary_event_analysis.jointJ_window_analysis() function. The values of each key has the shape of:

  • different window –> 0-axis.

  • different pattern hash –> 1-axis;

Dictionary keys:

‘Js’: list of float

JointSurprise of different given patterns within each window.

‘indices’: list of list of int

A list of indices of pattern within each window.

‘n_emp’: list of int

The empirical number of each observed pattern.

‘n_exp’: list of float

The expected number of each pattern.

‘rate_avg’: list of float

The average firing rate of each neuron.

significance_levelfloat

The significance threshold used to determine which coincident events are classified as unitary events within a window.

**plot_params

User-defined plotting parameters used to update the default plotting parameter values. The valid keys:

‘events’dict

Epochs to be marked on the time axis.

‘figsize’tuple of int

The dimensions for the figure size.

‘right’float

The size of the right margin.

‘top’float

The size of the top margin.

‘bottom’float

The size of the bottom margin.

‘left’float

The size of the left margin.

‘hspace’flaot

The size of the horizontal white space between subplots.

‘wspace’float

The width of the white space between subplots.

‘fsize’int

The size of the font.

‘unit_real_ids’list of int

The unit ids from the experimental recording.

‘lw’int

The default line width.

‘ms’int

The marker size for the unitary events and coincidences.

Returns:
resultFigureUE

The container for Axes objects generated by the function. Individual axes can be accessed using the following identifiers:

  • axes_spike_events : matplotlib.axes.Axes

    Contains the elements of the spike events subplot.

  • axes_spike_rates : matplotlib.axes.Axes

    Contains the elements of the spike rates subplot.

  • axes_coincident_events : matplotlib.axes.Axes

    Contains the elements of the coincident events subplot.

  • axes_coincidence_rates : matplotlib.axes.Axes

    Contains the elements of the coincidence rates subplot.

  • axes_significance : matplotlib.axes.Axes

    Contains the elements of the statistical significance subplot.

  • axes_unitary_events : matplotlib.axes.Axes

    Contains the elements of the unitary events subplot.

Examples

Unitary Events of homogenous Poisson random processes.

Since we don’t expect to find significant correlations in random processes, we show non-significant events (significance_level=0.34). Typically, in your analyses, the significant level threshold is ~0.05.

import matplotlib.pyplot as plt
import numpy as np
import quantities as pq

import viziphant
from elephant.spike_train_generation import homogeneous_poisson_process
from elephant.unitary_event_analysis import jointJ_window_analysis

np.random.seed(10)

spiketrains1 = [homogeneous_poisson_process(rate=20 * pq.Hz,
                t_stop=2 * pq.s) for _ in range(5)]
spiketrains2 = [homogeneous_poisson_process(rate=50 * pq.Hz,
                t_stop=2 * pq.s) for _ in range(5)]

spiketrains = np.stack((spiketrains1, spiketrains2), axis=1)
ue_dict = jointJ_window_analysis(spiketrains,
                                 bin_size=5 * pq.ms,
                                 win_size=100 * pq.ms,
                                 win_step=10 * pq.ms)
viziphant.unitary_event_analysis.plot_ue(spiketrains, Js_dict=ue_dict,
                                         significance_level=0.34,
                                         unit_real_ids=['1', '2'])
plt.show()

(Source code, png, hires.png, pdf)

../../_images/viziphant-unitary_event_analysis-plot_ue-1.png

Refer to UEA Tutorial for real-case scenario.