elephant icon indicating copy to clipboard operation
elephant copied to clipboard

Fix/onedimensional sigma

Open Moritz-Alexander-Kern opened this issue 2 years ago • 0 comments

This PR addresses Issue #455 .

Changes

  • check dimensions of sigma, if dimension > 0 , raise typeError
  • handle unambiguous case ndim=1 , size = 1 with sigma = sigma[0]
  • added tests for both above cases

Test

The following code snippet should no longer throw an error

import neo
import elephant
import quantities as pq

st = neo.SpikeTrain([1]*pq.s, t_stop=2*pq.s)
kernel = elephant.kernels.GaussianKernel(sigma=[20]*pq.ms)

rate = elephant.statistics.instantaneous_rate(st,
                                              sampling_period=1*pq.ms,
                                              kernel=kernel)

Moritz-Alexander-Kern avatar Jun 28 '22 09:06 Moritz-Alexander-Kern