Exemple #1
0
 def test_waveforms_arange_single_spiketrain(self):
     target_snr = 0.9
     waveforms = np.arange(20).reshape((2, 1, 10))
     snr_float = waveform_features.waveform_snr(waveforms)
     self.assertIsInstance(snr_float, float)
     self.assertEqual(snr_float, target_snr)
     self.assertEqual(waveform_features.waveform_snr(np.squeeze(waveforms)),
                      target_snr)
Exemple #2
0
 def test_zero_waveforms(self):
     zero_waveforms = [np.zeros((5, 10)),
                       np.zeros((5, 1, 10)),
                       np.zeros((5, 3, 10))]
     for zero_wf in zero_waveforms:
         with self.assertWarns(UserWarning):
             # expect np.nan result when waveform noise is zero.
             result = waveform_features.waveform_snr(zero_wf)
         self.assertTrue(np.all(np.isnan(result)))
Exemple #3
0
 def test_waveforms_arange_multiple_spiketrains(self):
     target_snr = [0.3, 0.3, 0.3]
     waveforms = np.arange(60).reshape((2, 3, 10))
     snr_arr = waveform_features.waveform_snr(waveforms)
     self.assertIsInstance(snr_arr, np.ndarray)
     assert_array_almost_equal(snr_arr, target_snr)
 def test_with_waveforms(self):
     target_value = 0.9
     result = waveform_features.waveform_snr(self.spiketrain_with_waveforms)
     self.assertEqual(result, target_value)
 def test_with_zero_waveforms(self):
     with self.assertWarns(UserWarning):
         # expect np.nan result when spiketrain noise is zero.
         result = waveform_features.waveform_snr(
             self.spiketrain_with_zero_waveforms)
     self.assertTrue(np.isnan(result))
 def test_with_waveforms(self):
     target_value = 0.9
     result = waveform_features.waveform_snr(
         self.spiketrain_with_waveforms)
     self.assertEqual(result, target_value)
 def test_with_zero_waveforms(self):
     result = waveform_features.waveform_snr(
         self.spiketrain_with_zero_waveforms)
     self.assertTrue(np.isnan(result))