Example #1
0
    def test_returns_discretization_bins(self):
        start = 2.0 * pq.s
        stop = 5.0 * pq.s
        sampling_rate = 2.0 * pq.Hz
        expected = sp.array([2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]) * pq.s

        st = create_empty_spike_train(start, stop)
        _, bins = sigproc.st_convolve(st,
                                      sigproc.GaussianKernel(),
                                      sampling_rate=sampling_rate)
        assert_array_almost_equal(expected, bins)
Example #2
0
    def test_length_of_returned_array_equals_sampling_rate_times_duration(
            self):
        start = 2.0 * pq.s
        stop = 5.0 * pq.s
        duration = stop - start
        sampling_rate = 12 * pq.Hz
        expected_length = (sampling_rate * duration).simplified

        st = create_empty_spike_train(start, stop)
        result, _ = sigproc.st_convolve(st,
                                        sigproc.GaussianKernel(),
                                        sampling_rate=sampling_rate)
        self.assertEqual(expected_length, result.size)
Example #3
0
 def test_convolution_with_empty_spike_train_returns_array_of_zeros(self):
     st = create_empty_spike_train()
     result, _ = sigproc.st_convolve(st, sigproc.GaussianKernel(),
                                     1 * pq.Hz)
     self.assertTrue(sp.all(result == 0.0))
Example #4
0
 def test_length_of_returned_array_equals_length_of_binned(self):
     binned = sp.ones(10)
     sampling_rate = 10 * pq.Hz
     result = sigproc.smooth(binned, sigproc.GaussianKernel(),
                             sampling_rate)
     self.assertEqual(binned.size, result.size)
Example #5
0
 def test_convolution_with_empty_binned_array_returns_array_of_zeros(self):
     binned = sp.zeros(10)
     sampling_rate = 10 * pq.Hz
     result = sigproc.smooth(binned, sigproc.GaussianKernel(),
                             sampling_rate)
     self.assertTrue(sp.all(result == 0.0))
Example #6
0
 def setUp(self):
     self.kernel_size = 500 * pq.ms
     self.kernel = sigproc.GaussianKernel(self.kernel_size)