Exemple #1
0
 def test_set_params_occupation_network_by_age_check_used(self):
     p = Parameters(
         read_param_file=True,
         input_households="tests/data/baseline_household_demographics.csv",
         input_param_file="tests/data/baseline_parameters.csv",
         param_line_number=1,
     )
     model = Model(p)
     non_scaled = [
         model.get_param(f"daily_fraction_work_used{age.name}")
         for age in OccupationNetworkEnum
     ]
     model.update_running_params("lockdown_on", 1)
     scaled = [
         model.get_param(f"daily_fraction_work_used{age.name}")
         for age in OccupationNetworkEnum
     ]
     for non_scaled_i, scaled_i in zip(non_scaled, scaled):
         assert non_scaled_i * 0.2 == scaled_i
     model.update_running_params(
         "lockdown_occupation_multiplier_primary_network", 10.0)
     scaled = [
         model.get_param(f"daily_fraction_work_used{age.name}")
         for age in OccupationNetworkEnum
     ]
     for non_scaled_i, scaled_i, factor in zip(non_scaled, scaled, [
             10.0,
             0.2,
             0.2,
             0.2,
             0.2,
     ]):
         assert non_scaled_i * factor == scaled_i
Exemple #2
0
    def test_set_params_manual_traceable_fraction(self):
        p = Parameters(
            read_param_file=True,
            input_households="tests/data/baseline_household_demographics.csv",
            input_param_file="tests/data/baseline_parameters.csv",
            param_line_number=1,
        )

        p.set_param("manual_traceable_fraction_occupation", 0.8)
        assert p.get_param("manual_traceable_fraction_occupation") == 0.8

        p.set_param("manual_traceable_fraction_household", 0.6)
        assert p.get_param("manual_traceable_fraction_household") == 0.6
        assert p.get_param("manual_traceable_fraction_occupation") == 0.8

        model = Model(p)
        model.update_running_params("manual_traceable_fraction_household", 0.4)
        assert model.get_param("manual_traceable_fraction_household") == 0.4