Exemplo n.º 1
0
    def test_set_lockdown_multiplier_params(self):
        params = Parameters(
            constant.TEST_DATA_TEMPLATE,
            constant.PARAM_LINE_NUMBER,
            constant.DATA_DIR_TEST,
            constant.TEST_HOUSEHOLD_FILE,
        )
        model = Model(params)
        assert covid19.get_param_lockdown_on(model.c_params) == 0

        model.update_running_params("lockdown_work_network_multiplier", 0.4)
        assert model.get_param("lockdown_work_network_multiplier") == 0.4

        model.update_running_params("lockdown_random_network_multiplier", 0.8)
        assert model.get_param("lockdown_random_network_multiplier") == 0.8

        model.update_running_params("lockdown_house_interaction_multiplier",
                                    1.2)
        assert model.get_param("lockdown_house_interaction_multiplier") == 1.2

        model.update_running_params("lockdown_on", 1)
        assert covid19.get_param_lockdown_on(model.c_params) == 1

        model.update_running_params("lockdown_work_network_multiplier", 0.5)
        assert model.get_param("lockdown_work_network_multiplier") == 0.5

        model.update_running_params("lockdown_random_network_multiplier", 0.9)
        assert model.get_param("lockdown_random_network_multiplier") == 0.9

        model.update_running_params("lockdown_house_interaction_multiplier",
                                    1.3)
        assert model.get_param("lockdown_house_interaction_multiplier") == 1.3

        assert covid19.get_param_lockdown_on(model.c_params) == 1
Exemplo n.º 2
0
    def test_set_lockdown_multiplier_params(self):
        params = Parameters(constant.TEST_DATA_TEMPLATE,
                            constant.PARAM_LINE_NUMBER, constant.DATA_DIR_TEST,
                            constant.TEST_HOUSEHOLD_FILE,
                            constant.TEST_HOSPITAL_FILE,
                            constant.PARAM_LINE_NUMBER)
        model = Model(params)
        assert covid19.get_param_lockdown_on(model.c_params) == 0
        for oc_net in OccupationNetworkEnum:
            model.update_running_params(
                f"lockdown_occupation_multiplier{oc_net.name}", 0.4)
            assert model.get_param(
                f"lockdown_occupation_multiplier{oc_net.name}") == 0.4

        for oc_net in OccupationNetworkEnum:
            model.update_running_params(
                f"lockdown_occupation_multiplier{oc_net.name}", 0.8)
            assert model.get_param(
                f"lockdown_occupation_multiplier{oc_net.name}") == 0.8

        model.update_running_params("lockdown_house_interaction_multiplier",
                                    1.2)
        assert model.get_param("lockdown_house_interaction_multiplier") == 1.2

        model.update_running_params("lockdown_on", 1)
        assert covid19.get_param_lockdown_on(model.c_params) == 1

        for oc_net in OccupationNetworkEnum:
            model.update_running_params(
                f"lockdown_occupation_multiplier{oc_net.name}", 0.5)
            assert model.get_param(
                f"lockdown_occupation_multiplier{oc_net.name}") == 0.5

        model.update_running_params("lockdown_random_network_multiplier", 0.9)
        assert model.get_param("lockdown_random_network_multiplier") == 0.9

        model.update_running_params("lockdown_house_interaction_multiplier",
                                    1.3)
        assert model.get_param("lockdown_house_interaction_multiplier") == 1.3

        assert covid19.get_param_lockdown_on(model.c_params) == 1