This file is part of simplecochlea.
simplecochlea is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
simplecochlea is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with simplecochlea. If not, see <https://www.gnu.org/licenses/>.
simplecochlea.spikes.spikelist.
SpikeList
(time=[], channel=[], pattern_id=[], potential=[], n_channels=0, name='', tmin=0, tmax=[], pattern_names={})[source]¶Bases: object
SpikeList Class. A spike is defined by a time and a channel. In addition a pattern ID ad a potential can be assigned to spikes. These characteristics are defined as list.
Attributes: |
|
---|
Methods
add_time_offset (t_offset) |
Add a time offset to the spikes time. |
convert_to_packet (packet_size[, overlap]) |
Deprecated. |
epoch (t_start, t_end) |
Epoch the spikelist given the time periods defined by t_start and t_end . |
epoch_on_triggers (t_triggers, time_pre, …) |
Apply the epoch function on each trigger whose time is defined by t_triggers. |
export ([export_path, export_name]) |
Export the spikelist as a .mat file |
get_channel_selectivity () |
Compute channel selectivity. |
get_mean_isi () |
Compute and return the mean ISI (Inter-Spike-Interval) for each channel. |
get_median_isi () |
Compute and return the median ISI (Inter-Spike-Interval) for each channel. |
get_pattern_results (t_start, t_end, pattern_id) |
Compute the number of spikes per segment. |
plot ([bin_duration, potential_thresh, …]) |
Plot the spikelist. |
plot_channel_selectivity ([title_str]) |
Plot channel selectivity. |
select_spike ([time_min, time_max, …]) |
Select a subset of the spikelist. |
set_pattern_id_from_time_limits (t_start, …) |
Given time limits given by t_start and t_end, set the pattern_id of spikes in this time interval. |
set_pattern_id_from_time_limits_old (t_start, …) |
Deprecated - Use set_pattern_id_from_time_limits |
sort (field) |
Sort the spikelist by increasing attribute, selected by field |
to_dataframe () |
Convert the spikelist to a dataframe containing 3 fields : ‘time’, ‘channel’ and ‘pattern_id’ |
add_time_offset
(t_offset)[source]¶Add a time offset to the spikes time. Used when creating list of spikelists.
convert_to_packet
(packet_size, overlap=0)[source]¶Deprecated. Used to convert the spikelist to spike packets
epoch
(t_start, t_end)[source]¶Epoch the spikelist given the time periods defined by t_start
and t_end
. Returns a SpikeList_list
instance.
Parameters: |
|
---|---|
Returns: |
|
epoch_on_triggers
(t_triggers, time_pre, time_post)[source]¶Apply the epoch function on each trigger whose time is defined by t_triggers.
Parameters: |
|
---|---|
Returns: |
|
export
(export_path='.', export_name='spikelist_0_')[source]¶Export the spikelist as a .mat file
Parameters: |
|
---|
get_mean_isi
()[source]¶Compute and return the mean ISI (Inter-Spike-Interval) for each channel.
Returns: |
|
---|
get_median_isi
()[source]¶Compute and return the median ISI (Inter-Spike-Interval) for each channel.
Returns: |
|
---|
get_pattern_results
(t_start, t_end, pattern_id, pattern_names=[], min_potential=[], do_plot=True, fig_title='')[source]¶Compute the number of spikes per segment. Segments are defined by t_start
and t_end
. There might be
multiples patterns, defined by pattern_id
and pattern_names
.
If min_potential
is defined, select only the spikes whose potential is higher than this.
If do_plot
is true, plot the results.
Parameters: |
|
---|---|
Returns: |
|
plot
(bin_duration=0.002, potential_thresh=[], ax_list=[], minplot=0, tau_lif=[], pattern_id_sel=[], color=[])[source]¶Plot the spikelist. The main central axis plots the spike list, one dot for each spike. Each pattern has
a different color. The bottom axis plots the histogram of the spikes for all channels. The right axis sums up
the spikes over time for each channel. The left axis plot the median ISI (Inter-Spike Interval), and if the
tau_lif
parameter is given, the ratio ISI_med / Tau_Lif is also plotted.
Parameters: |
|
---|---|
Returns: |
|
plot_channel_selectivity
(title_str='')[source]¶Plot channel selectivity. Definition ?
Parameters: |
|
---|
select_spike
(time_min=[], time_max=[], channel_sel=[], potential_min=[], potential_max=[], pattern_id_sel=[])[source]¶Select a subset of the spikelist. If multiples selection parameters are given, select the spikes meeting all conditions.
Parameters: |
|
---|---|
Returns: |
|
set_pattern_id_from_time_limits
(t_start, t_end, pattern_id, pattern_dict)[source]¶Parameters: |
|
---|
set_pattern_id_from_time_limits_old
(t_start, t_end, pattern_id, pattern_names=[])[source]¶Deprecated - Use set_pattern_id_from_time_limits
simplecochlea.spikes.spikelist.
SpikeList_list
(spikelist_list, t_start=[], t_end=[])[source]¶Bases: object
SpikeList_list Class. Defines a list of SpikeList instances. Can represents differents epochs of a global spikelist, spikelists corresponding to repetitions of a pattern.
Methods
compute_channel_with_spikes () |
Get proportion of channel with spikes in all epochs |
compute_fano_factor () |
Compute the Fano Factor (~dispersion) of the number of spikes in each spike list, for each channel. |
compute_spike_per_channel_variation () |
Compute the coefficient of variation of the number of spikes per channel for each spikelist |
compute_vanrossum_distance ([cos, tau]) |
Compute the van Rossum distance (see: A Novel Spike Distance - M. C. W. van Rossum). |
plot ([n_max_cols, plot_vr_dist]) |
Plot all the spikelist in the same figure |
plot_superpose ([plot_fano_factor, plot_vr_dist]) |
Plot all the spikelists of the SpikeList_list superimposed on the same axes. |
compute_channel_with_spikes
()[source]¶Get proportion of channel with spikes in all epochs
Returns: |
|
---|
compute_fano_factor
()[source]¶Compute the Fano Factor (~dispersion) of the number of spikes in each spike list, for each channel. Fano factor is defined as the variance divided by the mean of a random process The global fano factor returned is the mean across channels
Returns: |
|
---|
compute_spike_per_channel_variation
()[source]¶Compute the coefficient of variation of the number of spikes per channel for each spikelist
Returns: |
|
---|
compute_vanrossum_distance
(cos=0.1, tau=0.001)[source]¶Compute the van Rossum distance (see: A Novel Spike Distance - M. C. W. van Rossum). Also compute the distance normalized by sqrt((M+N)/2) where M and N are the number of spikes in the 2 spike trains. This way the normalized distance between 2 uncorrelated Poisson spike trains in 1. The result is divided by sqrt(2) due to the implementation in pymuvr to get similar results as in the original paper.
The function return the mean of these distance across each comparison of the spikelist_list for each channel.
Parameters: |
|
---|---|
Returns: |
|
simplecochlea.spikes.spikelist.
dual_spikelist_plot
(spikelist_in, spikelist_out, potential_thresh_in=0, potential_thresh_out=0, tau_lif=[], pattern_id_sel_in=[], pattern_id_sel_out=[])[source]¶Parameters: |
|
---|---|
Returns: |
|
simplecochlea.spikes.spikelist.
import_spikelist_from_mat
(import_path, n_channels)[source]¶Import a spikelist (SpikeList instance) from a .mat file.
Parameters: |
|
---|---|
Returns: |
|
Spikes Module