elephant.statistics.optimal_kernel_bandwidth

elephant.statistics.optimal_kernel_bandwidth(spiketimes, times=None, bandwidth=None, bootstrap=False)[source]

Calculates optimal fixed kernel bandwidth (Shimazaki and Shinomoto, 2010), given as the standard deviation sigma.

Original matlab code (sskernel.m) http://2000.jukuin.keio.ac.jp/shimazaki/res/kernel.html has been ported to Python by Subhasis Ray, NCBS.

Parameters:
spiketimesnp.ndarray

Sequence of spike times (sorted to be ascending).

timesnp.ndarray or None, optional

Time points at which the kernel bandwidth is to be estimated. If None, spiketimes is used. Default: None

bandwidthnp.ndarray or None, optional

Vector of kernel bandwidths (standard deviation sigma). If specified, optimal bandwidth is selected from this. If None, bandwidth is obtained through a golden-section search on a log-exp scale. Default: None

bootstrapbool, optional

If True, calculates the 95% confidence interval using Bootstrap. Default: False

Returns:
dict
‘y’np.ndarray

Estimated density.

‘t’np.ndarray

Points at which estimation was computed.

‘optw’float

Optimal kernel bandwidth given as standard deviation sigma

‘w’np.ndarray

Kernel bandwidths examined (standard deviation sigma).

‘C’np.ndarray

Cost functions of bandwidth.

‘confb95’tuple of np.ndarray

Bootstrap 95% confidence interval: (lower level, upper level). If bootstrap is False, confb95 is None.

‘yb’np.ndarray

Bootstrap samples. If bootstrap is False, yb is None.

If no optimal kernel could be found, all entries of the dictionary are set to None.