示例#1
0
 def run_simulations(self):
     for frag_model in self.fragmentation_models:
         pi, pi_b, pi_w = run_mspi_simulations(frag_model,
                 number_of_processes = self._number_of_processes,
                 number_of_replicates = self._number_of_simulations)
         pi_summary = stats.SampleSummarizer(pi)
         pi_b_summary = stats.SampleSummarizer(pi_b)
         self.pi_samples.append(pi_summary)
         self.pi_between_samples.append(pi_b_summary)
示例#2
0
 def test_init_with_samples(self):
     ss = stats.SampleSummarizer([1.0, 2.0, 3.0])
     self.assertEqual(ss.minimum, 1.0)
     self.assertEqual(ss.maximum, 3.0)
     self.assertApproxEqual(ss.mean, 2.0, 1e-9)
     self.assertApproxEqual(ss.variance, 1.0, 1e-9)
     self.assertEqual(ss.std_deviation, math.sqrt(1.0), 1e-9)
     self.assertApproxEqual(ss.pop_variance, 2 / float(3), 1e-9)
示例#3
0
 def test_init(self):
     ss = stats.SampleSummarizer(tag='test')
     self.assertEqual(ss.tag, 'test')
     self.assertEqual(ss.minimum, None)
     self.assertEqual(ss.maximum, None)
     self.assertEqual(ss.mean, None)
     self.assertEqual(ss.variance, None)
     self.assertEqual(ss.std_deviation, None)
     self.assertEqual(ss.pop_variance, None)
示例#4
0
    def test_add_one_sample(self):
        ss = stats.SampleSummarizer(tag='test')
        ss.add_sample(1)
        self.assertEqual(ss.tag, 'test')
        self.assertEqual(ss.minimum, 1)
        self.assertEqual(ss.maximum, 1)
        self.assertApproxEqual(ss.mean, 1.0, 1e-9)
        self.assertEqual(ss.variance, float('inf'))
        self.assertEqual(ss.std_deviation, float('inf'))
        self.assertEqual(ss.pop_variance, 0)

        ss = stats.SampleSummarizer(tag='test')
        ss.add_sample(3.45)
        self.assertEqual(ss.tag, 'test')
        self.assertEqual(ss.minimum, 3.45)
        self.assertEqual(ss.maximum, 3.45)
        self.assertApproxEqual(ss.mean, 3.45, 1e-9)
        self.assertEqual(ss.variance, float('inf'))
        self.assertEqual(ss.std_deviation, float('inf'))
        self.assertEqual(ss.pop_variance, 0)