neurotools.spikes package
Submodules
Module contents
Signal processing routines related to spike trains.
- neurotools.spikes.pp_xcorr(t1, t2, maxlag)[source]
Gets all pairwise relative time lags within maxlag. pp_xcorr stands for point-process cross correlation.
- Parameters:
t1 (1d arrays) – Lists of time points to compare
t2 (1d arrays) – Lists of time points to compare
maxlag (number) – maximum time lag to consider, in the same units as t1 and t2
- neurotools.spikes.txcorr(t1, t2, maxlag, k=100, normalize=False, sampleat=None)[source]
Computes cross correlation between two spike trains provided in terms of spike times, over a maximum range of lags. Uses nearest- neighbor density estimation to provide an adaptively smoothed cross-correlation function.
- Parameters:
t1 (1d arrays) – Lists of time points to compare
t2 (1d arrays) – Lists of time points to compare
maxlag (number) – maximum time lag to consider, in the same units as t1 and t2
k (positive integer) – number of nearest neighbors to use in the density estimation
normalize (boolean) – Normalize correlation by zero-lag correlation. Default False
sampleat (int) – time lags to sample for the density estimation defaults to spanning +-lags with 1 time-unit bins if none
- neurotools.spikes.pack_cross_correlation_matrix(xc)[source]
Convert a 1D autocorrelogram into a two-timepoint correlation matrix.
This function is obsolete, use scipy.linalg.toeplitz instead.
- Parameters:
xc (1D np.array)
- Returns:
matrix
- Return type:
2D np.array
- neurotools.spikes.cut_spikes(s, cut)[source]
Downsample a spike raster s by factor cut by symming adjacent bins. This may generate counts >1 when two spikes occur within the same downsampled bin.
- Parameters:
s (1D np.array) – Array of spike counts
cut (positive int) – Downsampling factor
- Returns:
downsampled
- Return type:
np.array
- neurotools.spikes.times_to_raster(spikes, duration=1000)[source]
Convert spike times to a spike raster
- Parameters:
spikes (np.int32) – List of spike times as non-negative array indecies
duration – Duration of the desired raster
- Returns:
result
- Return type:
1D np.array with length duration