Exemple #1
0
    def test_make_infections_third_calculate_incidence_less_than_susceptible_return_incidence(self):
        number_of_epochs = 10
        xsize = ysize = 10
        r0 = 1
        recovery_period = 1
        latency_period = 1
        xcoord = ycoord = 0
        travel_rate = 0.25
        migrate_infections = 5
        global_population = 25
        count = 0
        SEIR_lambda = 1.0 / latency_period
        SEIR_gamma = 1.0 / recovery_period

        model = Model(number_of_epochs)
        region_mock(xsize, ysize, model, r0, recovery_period, latency_period)
        patch = Patch(xcoord, ycoord)
        patch.new_cases_made = 3
        patch.population = 10
        patch.num_travel_incases = 0
        patch.num_susceptible = 5

        patch.make_infections_third_calculate_incidence(travel_rate, migrate_infections,
                                                                         global_population, count)

        self.assertNotEqual(patch.num_susceptible, patch.num_incidence)
Exemple #2
0
    def test_add_people_to_schedule(self):
        model = Model(10)
        region_mock(10, 10, model, 1, 2, 5)

        number_of_people = 10
        for x in range(0, number_of_people):
            model.schedule.agents.add(InfectionAgent(model, x, x))

        self.assertEqual(len(model.schedule.agents), 10)
Exemple #3
0
    def test_visible_patches_empty(self):
        model = Model(10)
        region = region_mock(10, 10, model, 1, 2, 5)

        for x in range(region.xsize):
            for y in range(region.ysize):
                region.patches[x][y] = Patch(x, y)

        patch = region.patches[2][2]
        patch.set_visible_patches(model)

        self.assertEqual(len(patch.visible_patches), 0)
Exemple #4
0
    def test_number_of_agents_at_patch(self):
        x = 0
        y = 0

        patch = Patch(x, y)
        model = Model(10)
        region_mock(10, 10, model, 1, 2, 5)

        patch.agents.append(InfectionAgent(model, x, y))
        patch.agents.append(InfectionAgent(model, x, y))

        self.assertEqual(len(patch.agents), 2)