Evaluate (spike_sort.evaluate
)¶
Utility functions to evaluate the quality of spike sorting
snr_spike (spike_waves[, scale]) |
Estimate signal-to-noise ratio (SNR) as a ratio of peak-to-peak amplitude of an average spike to the std. |
snr_clust (spike_waves, noise_waves) |
Calculate signal-to-noise ratio. |
detect_noise (sp, spt, sp_win[, type, …]) |
Find noisy spikes |
calc_noise_threshold (spike_waves[, sign, …]) |
Find threshold to extract noise cluster. |
isolation_score (sp, spt, sp_win[, …]) |
calculate spike isolation score from raw data and spike times |
calc_isolation_score (spike_waves, noise_waves) |
Calculate isolation index according to Joshua et al. |
Reference¶
-
spike_sort.core.evaluate.
calc_isolation_score
(spike_waves, noise_waves, spike_type='positive', lam=10.0, max_spikes=None)¶ Calculate isolation index according to Joshua et al. (2007)
Parameters: spike_waves : dict
noise_waves : dict
sp_win : list or tuple
window used for spike extraction
spike_type : {‘positive’, ‘negative’}
indicates if the spikes occuring at time points given by spt are positive or negative going
lambda : float
determines the “softness” of clusters
Returns: isolation_score : float
a value from the range [0,1] indicating the quality of sorting (1=ideal isolation of spikes)
-
spike_sort.core.evaluate.
calc_noise_threshold
(spike_waves, sign=1, frac_spikes=0.02, frac_max=0.5)¶ Find threshold to extract noise cluster.
According to algorithm described in Joshua et al. (2007)
Parameters: spike_waves : dict
waveshapes of spikes from the identified single unit (extracted with extract.extrac_spikes)
sign : int
sign should be negative for negative-going spikes and positive for postitive-going spikes. Note that only sign of this number is taken into account.
frac_spikes : float, optional
fraction of largest (smallest) spikes to calculate the threshold from (default 0.02)
frac_max : float
fraction of the average peak amplitude to use as a treshold
Returns: threshold : float
threshold to obtain a noise cluster
-
spike_sort.core.evaluate.
detect_noise
(sp, spt, sp_win, type='positive', max_spikes=None, resample=1)¶ Find noisy spikes
-
spike_sort.core.evaluate.
isolation_score
(sp, spt, sp_win, spike_type='positive', lam=10.0, max_spikes=None)¶ calculate spike isolation score from raw data and spike times
-
spike_sort.core.evaluate.
snr_clust
(spike_waves, noise_waves)¶ Calculate signal-to-noise ratio.
Comparing average P2P amplitude of spike cluster to noise cluster (randomly selected signal segments)
Parameters: spike_waves : dict
noise_waves : dict
Returns: snr : float
signal-to-noise ratio
-
spike_sort.core.evaluate.
snr_spike
(spike_waves, scale=5.0)¶ Estimate signal-to-noise ratio (SNR) as a ratio of peak-to-peak amplitude of an average spike to the std. deviation of residuals
Parameters: spike_waves : dict
Returns: snr : float
signal to noise ratio