Пример #1
0
    def test__compare_distributions_multiple_returns(self):
        known = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3]])

        def f(x):
            return np.array([1, 2, 3])

        test = _compare_distributions(f, self.pop, 3, mode='matched',
                                      num_iter=3)
        npt.assert_array_equal(known, test)
Пример #2
0
 def test__compare_distributions_matched_mode(self):
     # Sets the known value
     known_mean = 0.162195
     known_std = 0.121887
     known_shape = (100,)
     # Tests the sample value
     test = _compare_distributions(self.f, self.pop, self.num_p,
                                   mode='matched', num_iter=100)
     npt.assert_allclose(known_mean, test.mean(), rtol=0.1, atol=0.02)
     npt.assert_allclose(known_std, test.std(), rtol=0.1, atol=0.02)
     self.assertEqual(known_shape, test.shape)
Пример #3
0
 def test__compare_distributions_all_mode(self):
     known = np.ones((100))*0.0026998
     test = _compare_distributions(self.f, self.samps, 1, num_iter=100)
     npt.assert_allclose(known, test, 5)
Пример #4
0
 def test__compare_distributions_sample_counts_error(self):
     with self.assertRaises(ValueError):
         _compare_distributions(self.f, [self.pop[0][:5], self.pop[1]], 1,
                                counts=25)
Пример #5
0
 def test__compare_distributions_matched_length_error(self):
     with self.assertRaises(ValueError):
         _compare_distributions(self.f, [np.ones((5)), np.zeros((6))],
                                mode="matched")
Пример #6
0
 def test__compare_distributions_count_error(self):
     with self.assertRaises(ValueError):
         _compare_distributions(self.f, self.samps, counts=[1, 2, 3],
                                num_iter=100)
Пример #7
0
 def test__compare_distributions_mode_error(self):
     with self.assertRaises(ValueError):
         _compare_distributions(self.f, self.samps, mode='fig')