Ejemplo n.º 1
0
 def test_remove_epochs(self):
     """Removing Epochs."""
     # normal case
     dat = remove_epochs(self.dat, [0])
     self.assertEqual(dat.data.shape[0], 3)
     np.testing.assert_array_equal(dat.data, self.dat.data[1:])
     # normal every second
     dat = remove_epochs(self.dat, [0, 2])
     self.assertEqual(dat.data.shape[0], 2)
     np.testing.assert_array_equal(dat.data, self.dat.data[1::2])
     # the full epo
     dat = remove_epochs(self.dat, list(range(self.dat.data.shape[0])))
     np.testing.assert_array_equal(dat.data.shape[0], 0)
Ejemplo n.º 2
0
 def test_remove_epochs(self):
     """Removing Epochs."""
     # normal case
     dat = remove_epochs(self.dat, [0])
     self.assertEqual(dat.data.shape[0], 3)
     np.testing.assert_array_equal(dat.data, self.dat.data[1:])
     # normal every second
     dat = remove_epochs(self.dat, [0, 2])
     self.assertEqual(dat.data.shape[0], 2)
     np.testing.assert_array_equal(dat.data, self.dat.data[1::2])
     # the full epo
     dat = remove_epochs(self.dat, list(range(self.dat.data.shape[0])))
     np.testing.assert_array_equal(dat.data.shape[0], 0)
Ejemplo n.º 3
0
 def test_remove_epochs_copy(self):
     """Remove Epochs must not modify argument."""
     cpy = self.dat.copy()
     remove_epochs(self.dat, [0, 1])
     self.assertEqual(self.dat, cpy)
Ejemplo n.º 4
0
 def test_remove_epochs_swapaxes(self):
     """Remove epochs must work with nonstandard classaxis."""
     dat = remove_epochs(swapaxes(self.dat, 0, 2), [0, 1], classaxis=2)
     dat = swapaxes(dat, 0, 2)
     dat2 = remove_epochs(self.dat, [0, 1])
     self.assertEqual(dat, dat2)
Ejemplo n.º 5
0
 def test_remove_epochs_with_cnt(self):
     """Remove epochs must raise an exception if called with cnt argument."""
     del (self.dat.class_names)
     with self.assertRaises(AssertionError):
         remove_epochs(self.dat, [0, 1])
Ejemplo n.º 6
0
 def test_remove_epochs_copy(self):
     """Remove Epochs must not modify argument."""
     cpy = self.dat.copy()
     remove_epochs(self.dat, [0, 1])
     self.assertEqual(self.dat, cpy)
Ejemplo n.º 7
0
 def test_remove_epochs_swapaxes(self):
     """Remove epochs must work with nonstandard classaxis."""
     dat = remove_epochs(swapaxes(self.dat, 0, 2), [0, 1], classaxis=2)
     dat = swapaxes(dat, 0, 2)
     dat2 = remove_epochs(self.dat, [0, 1])
     self.assertEqual(dat, dat2)
Ejemplo n.º 8
0
 def test_remove_epochs_with_cnt(self):
     """Remove epochs must raise an exception if called with cnt argument."""
     del(self.dat.class_names)
     with self.assertRaises(AssertionError):
         remove_epochs(self.dat, [0, 1])