Exemple #1
0
    def test_random_select_errors(self):
        obs = Sculptor(self.bt, self.mf, self.tree, 'Day', 'Host',
                       'random-select-errors')

        with self.assertRaisesRegex(ValueError, 'uniformly subsampled'):
            obs.alpha_table()

        with self.assertRaisesRegex(ValueError, 'uniformly subsampled'):
            obs.beta_table()

        with self.assertRaisesRegex(ValueError, 'uniformly subsampled'):
            obs.microbes_over_time()
Exemple #2
0
    def test_microbes_over_time(self):
        skl = Sculptor(self.bt, self.mf, self.tree, 'Day', 'Host',
                       'microbes-over-time')
        np.random.seed(0)
        skl.randomly_select(5)

        obs = skl.microbes_over_time()

        metrics = ['mean', 'abs_energy', 'non_zero_samples', 'abs_mean_diff']
        columns = ['%s_%s' % (a, b) for a, b in product(range(1, 8), metrics)]
        index = ['A', 'B']

        self.assertEqual(obs.columns.tolist(), columns)
        self.assertEqual(obs.index.tolist(), index)
        self.assertEqual(obs.values.shape, (2, 28))