コード例 #1
0
    def test_sampling_all_locations_multiple_samples(self):
        five_samples = self.solution.sample(size=5)

        chi_squared = np.array([
            chi_squared_statistic(sample, self.solution[:].mean,
                                  self.solution[:].cov)
            for sample in five_samples
        ]).mean()
        self.assertLess(chi_squared, 10.0)
        self.assertLess(0.1, chi_squared)
コード例 #2
0
    def test_sampling_many_locations_multiple_samples(self):
        locs = np.arange(0.0, 0.5, 0.025)
        five_samples = self.solution.sample(t=locs, size=5)

        chi_squared = np.array([
            chi_squared_statistic(sample,
                                  self.solution(locs).mean,
                                  self.solution(locs).cov)
            for sample in five_samples
        ]).mean()
        self.assertLess(chi_squared, 10.0)
        self.assertLess(0.1, chi_squared)
コード例 #3
0
    def test_sampling_two_locations_multiple_samples(self):
        locs = self.solution.t[[2, 3]]
        five_samples = self.solution.sample(t=locs, size=5)

        chi_squared = np.array([
            chi_squared_statistic(
                sample,
                self.solution[:].mean[[2, 3]],
                self.solution[:].cov[[2, 3]],
            ) for sample in five_samples
        ]).mean()
        self.assertLess(chi_squared, 10.0)
        self.assertLess(0.1, chi_squared)