예제 #1
0
 def test_run_SIRS_s(self):
     model = Epimodel(1, modtype=b'SIRS_s')
     res = model.step((0, 1, 999),
                      0,
                      1000,
                      0,
                      0,
                      bi={
                          'e': 0,
                          'i': 1,
                          's': 999
                      },
                      bp={
                          'r': 0.1,
                          'b': 0.01,
                          'beta': 0.01,
                          'alpha': 1.,
                          'delta': 0.1,
                          'p': 0.1,
                          'w': 0.1
                      })
     for x, y in zip(res[0], [0, 0.9, 999.01]):
         self.assertAlmostEqual(x, y, 0)
     self.assertAlmostEqual(res[1], 0, 1)
     self.assertAlmostEqual(res[2], 0.9, 1)
예제 #2
0
    def test_run_SIR(self):
        model = Epimodel(1, modtype=b'SIR')
        res = model.step((0, 1, 999),
                         0,
                         1000,
                         0,
                         0,
                         bi={
                             b'e': 0,
                             b'i': 1,
                             b's': 999
                         },
                         bp={
                             b'r': 0.1,
                             b'b': 0.01,
                             b'beta': 0.01,
                             b'alpha': 1.
                         })

        for x, y in zip(res[0], [0, 0.9, 999.01]):
            self.assertAlmostEqual(x, y, 1)
        self.assertAlmostEqual(res[1], 0, 1)
        self.assertAlmostEqual(res[2], 0.9, 1)