def test_kcsd2d_init(self): method = 'KCSD3D' result = csd.estimate_csd(lfp=self.lfp, method=method, **self.params[method]) self.assertEqual(result.t_start, 0.0 * pq.s) self.assertEqual(result.sampling_rate, 1000 * pq.Hz) self.assertEqual(len(result.times), 1)
def test_moi_estimate(self): result = CSD.estimate_csd(self.an_sigs, method='MoIKCSD', MoI_iters=10, lambd=0.0, gdx=0.2, gdy=0.2) self.assertEqual(result.t_start, 0.0 * pq.s) self.assertEqual(result.sampling_rate, 1000 * pq.Hz) self.assertEqual(result.times, [0.] * pq.s) self.assertEqual(len(result.annotations.keys()), 2)
def test_kcsd1d_estimate(self, cv_params={}): self.test_params.update(cv_params) result = CSD.estimate_csd(self.an_sigs, method=self.test_method, **self.test_params) self.assertEqual(result.t_start, 0.0 * pq.s) self.assertEqual(result.sampling_rate, 1000 * pq.Hz) self.assertEqual(result.times, [0.] * pq.s) self.assertEqual(len(result.annotations.keys()), 1) true_csd = self.csd_profile(result.annotations['x_coords']) rms = np.linalg.norm(np.array(result[0, :]) - true_csd) rms /= np.linalg.norm(true_csd) self.assertLess(rms, 0.5, msg='RMS between trueCSD and estimate > 0.5')