# Kernels¶

Definition of a hierarchy of classes for kernel functions to be used in convolution, e.g., for data smoothing (low pass filtering) or firing rate estimation.

## Symmetric kernels¶

 RectangularKernel(sigma[, invert]) Class for rectangular kernels. TriangularKernel(sigma[, invert]) Class for triangular kernels. EpanechnikovLikeKernel(sigma[, invert]) Class for Epanechnikov-like kernels. GaussianKernel(sigma[, invert]) Class for gaussian kernels. LaplacianKernel(sigma[, invert]) Class for laplacian kernels.

## Asymmetric kernels¶

 ExponentialKernel(sigma[, invert]) Class for exponential kernels. AlphaKernel(sigma[, invert]) Class for alpha kernels.

## Examples¶

Example 1. Gaussian kernel

>>> import neo
>>> import quantities as pq
>>> from elephant import kernels
>>> kernel = kernels.GaussianKernel(sigma=300 * pq.ms)
>>> kernel
GaussianKernel(sigma=300.0 ms, invert=False)
>>> spiketrain = neo.SpikeTrain([-1, 0, 1], t_start=-1, t_stop=1, units='s')
>>> kernel_pdf = kernel(spiketrain)
>>> kernel_pdf
array([0.00514093, 1.3298076 , 0.00514093]) * 1/s


Cumulative Distribution Function

>>> kernel.cdf(0 * pq.s)
0.5
>>> kernel.cdf(1 * pq.s)
0.9995709396668032


Inverse Cumulative Distribution Function

>>> kernel.icdf(0.5)
array(0.) * ms
>>> kernel.icdf(0.9)
array(384.46546966) * ms


Example 2. Alpha kernel

>>> kernel = kernels.AlphaKernel(sigma=1 * pq.s)
>>> kernel(spiketrain)
array([-0.        ,  0.        ,  0.48623347]) * 1/s
>>> kernel.cdf(0 * pq.s)
0.0
>>> kernel.icdf(0.5)
array(1.18677054) * s