Ejemplo n.º 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)
Ejemplo n.º 2
0
 def test_run_Influenza(self):
     model = Epimodel(1, modtype=b'Influenza')
     res = run(model, [(2490, 0, 10, 0, 0, 2490, 0, 10, 0, 0, 2490, 0, 10,
                        0, 0, 2490, 0, 10, 0, 0), 0, 10000, 0, 0, {
                            b'incub_age1': 0,
                            b'subc_age1': 10,
                            b'susc_age1': 2490,
                            b'incub_age2': 0,
                            b'subc_age2': 10,
                            b'susc_age2': 2490,
                            b'incub_age3': 0,
                            b'subc_age3': 10,
                            b'susc_age3': 2490,
                            b'incub_age4': 0,
                            b'subc_age4': 10,
                            b'susc_age4': 2490,
                            b'sympt_age1': 0,
                            b'sympt_age2': 0,
                            b'sympt_age3': 0,
                            b'sympt_age4': 0,
                            b'comp_age1': 0,
                            b'comp_age2': 0,
                            b'comp_age3': 0,
                            b'comp_age4': 0
                        }, {
                            b'r': 0.1,
                            b'b': 0.01,
                            b'beta': 1,
                            b'e': 0.1,
                            b'pc1': .1,
                            b'c': 0.1,
                            b'pp1': .1,
                            b'g': .1,
                            b'd': .1,
                            b'pc2': .1,
                            b'pp2': .1,
                            b'pc3': .1,
                            b'pp3': .1,
                            b'pc4': .1,
                            b'pp4': .1,
                            b'alpha': 1.,
                            b'delta': 0.1,
                            b'vaccineNow': 1,
                            b'vaccov': 0.3
                        }], 100)
     P.plot(res)
     P.title('Influenza')
     P.legend([
         'Susc_age1', 'Incub_age1', 'Subc_age1', 'Sympt_age1', 'Comp_age1',
         'Susc_age2', 'Incub_age2', 'Subc_age2', 'Sympt_age2', 'Comp_age2',
         'Susc_age3', 'Incub_age3', 'Subc_age3', 'Sympt_age3', 'Comp_age3',
         'Susc_age4', 'Incub_age4', 'Subc_age4', 'Sympt_age4', 'Comp_age4'
     ])
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
 def test_run_SIS(self):
     model = Epimodel(1, modtype=b'SIS')
     res = run(model, [(0, 10, 990), 0, 10000, 0, 0, self.bi, self.bp], 100)
     P.plot(res)
     P.title('$SIS$')
     P.legend(['E', 'I', 'S'])