Exemple #1
0
 def test_cat_trials_dimensions(self):
     """cat_trials did not always return a 2d array."""
     self.assertEqual(
         datatools.cat_trials(np.random.randn(2, 2, 100)).ndim, 2)
     self.assertEqual(
         datatools.cat_trials(np.random.randn(1, 2, 100)).ndim, 2)
     self.assertEqual(
         datatools.cat_trials(np.random.randn(2, 1, 100)).ndim, 2)
     self.assertEqual(
         datatools.cat_trials(np.random.randn(1, 1, 100)).ndim, 2)
    def test_cat_trials(self):
        x = np.random.randn(60, 5, 9)
        xc = x.copy()

        y = datatools.cat_trials(x)

        self.assertTrue(np.all(x == xc))
        self.assertEqual(y.shape, (x.shape[0] * x.shape[2], x.shape[1]))

        for it in range(x.shape[2]):
            a = y[it * x.shape[0]: (it + 1) * x.shape[0], :]
            b = x[:, :, it]
            self.assertTrue(np.all(a == b))
Exemple #3
0
    def test_cat_trials(self):
        x = np.random.randn(9, 5, 60)
        xc = x.copy()

        y = datatools.cat_trials(x)

        self.assertTrue(np.all(x == xc))
        self.assertEqual(y.shape, (x.shape[1], x.shape[0] * x.shape[2]))

        for it in range(x.shape[0]):
            a = y[:, it * x.shape[2]:(it + 1) * x.shape[2]]
            b = x[it, :, :]
            self.assertTrue(np.all(a == b))
 def test_cat_trials_dimensions(self):
     """cat_trials did not always return a 2d array."""
     self.assertEqual(datatools.cat_trials(np.random.randn(100, 2, 2)).ndim, 2)
     self.assertEqual(datatools.cat_trials(np.random.randn(100, 1, 2)).ndim, 2)
     self.assertEqual(datatools.cat_trials(np.random.randn(100, 2, 1)).ndim, 2)
     self.assertEqual(datatools.cat_trials(np.random.randn(100, 1, 1)).ndim, 2)