Exemple #1
0
        def test_update(d):
            d['smart_tracing_households_only'] = True
            d['smart_tracing_actions'] = ['test', 'isolate']
            d['test_reporting_lag'] = 0.5

            # isolation
            d['smart_tracing_policy_isolate'] = 'basic'
            d['smart_tracing_isolated_contacts'] = 100000

            # testing
            d['smart_tracing_policy_test'] = 'basic'
            d['smart_tracing_tested_contacts'] = 100000
            d['trigger_tracing_after_posi_trace_test'] = False
            return d

        simulation_info = options_to_str(p_compliance=p_compliance)

        experiment.add(
            simulation_info=simulation_info,
            country=country,
            area=area,
            measure_list=m,
            test_update=test_update,
            seed_summary_path=seed_summary_path,
            set_initial_seeds_to=set_initial_seeds_to,
            set_calibrated_params_to=calibrated_params,
            full_scale=full_scale,
            expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)

    print(f'{experiment_info} configuration done.')
    def test_update(d):
        d['smart_tracing_households_only'] = True
        d['smart_tracing_actions'] = ['test', 'isolate']
        d['test_reporting_lag'] = 0.5

        # isolation
        d['smart_tracing_policy_isolate'] = 'basic'
        d['smart_tracing_isolated_contacts'] = 100000

        # testing
        d['smart_tracing_policy_test'] = 'basic'
        d['smart_tracing_tested_contacts'] = 100000
        d['trigger_tracing_after_posi_trace_test'] = False
        return d

    sim_info = options_to_str(
        expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)

    # baseline
    experiment.add(
        simulation_info=sim_info,
        country=country,
        area=area,
        measure_list=m,
        test_update=test_update,
        seed_summary_path=seed_summary_path,
        set_initial_seeds_to=set_initial_seeds_to,
        set_calibrated_params_to=calibrated_params,
        full_scale=full_scale,
        store_mob=store_mob,
        expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)
Exemple #3
0
                    d['smart_tracing_policy_isolate'] = 'advanced-threshold'
                    d['smart_tracing_isolation_threshold'] = smart_tracing_threshold
                    d['smart_tracing_isolated_contacts'] = 100000
                    d['smart_tracing_isolation_duration'] = 14 * TO_HOURS,

                    # testing
                    d['smart_tracing_policy_test'] = 'advanced-threshold'
                    d['smart_tracing_testing_threshold'] = smart_tracing_threshold
                    d['smart_tracing_tested_contacts'] = 100000
                    d['trigger_tracing_after_posi_trace_test'] = False

                    return d

                simulation_info = options_to_str(
                    p_adoption=p_adoption,
                    test_lag=test_lag,
                    tracing_threshold=smart_tracing_threshold,
                )

                experiment.add(
                    simulation_info=simulation_info,
                    country=country,
                    area=area,
                    measure_list=m,
                    test_update=test_update,
                    seed_summary_path=seed_summary_path,
                    set_initial_seeds_to=set_initial_seeds_to,
                    set_calibrated_params_to=calibrated_params,
                    full_scale=full_scale,
                    expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)
Exemple #4
0
        m = [
            SocialDistancingForAllMeasure(
                t_window=Interval(
                    measure_window_in_hours['start'], 
                    measure_window_in_hours['end']),
                p_stay_home=p_stay_home),

            BetaMultiplierMeasureByType(
                t_window=Interval(
                    measure_window_in_hours['start'], 
                    measure_window_in_hours['end']),
                beta_multiplier=calibration_lockdown_beta_multipliers)
            ]

        simulation_info = options_to_str(iter=iteration)

        experiment.add(
            simulation_info=simulation_info,
            country=country,
            area=area,
            measure_list=m,
            lockdown_measures_active=False,
            test_update=None,
            seed_summary_path=seed_summary_path,
            set_calibrated_params_to=calibrated_params,
            set_initial_seeds_to=set_initial_seeds_to,
            full_scale=full_scale)

    print(f'{experiment_info} configuration done.')
    
Exemple #5
0
                              measure_window_in_hours['end']),
            beta_multiplier=beta_multiplier,
            max_pos_tests_per_week_per_100k=max_pos_tests_per_week_per_100k,
            intervention_times=intervention_times,
            init_active=is_measure_active_initially),
        UpperBoundCasesSocialDistancing(
            t_window=Interval(measure_window_in_hours['start'],
                              measure_window_in_hours['end']),
            p_stay_home=p_stay_home,
            max_pos_tests_per_week_per_100k=max_pos_tests_per_week_per_100k,
            intervention_times=intervention_times,
            init_active=is_measure_active_initially)
    ]

    simulation_info = options_to_str(
        max_pos_tests_per_week_per_100k=50,
        initially_active=is_measure_active_initially)

    experiment.add(
        simulation_info=simulation_info,
        country=country,
        area=area,
        measure_list=m,
        lockdown_measures_active=False,
        test_update=None,
        seed_summary_path=seed_summary_path,
        set_calibrated_params_to=calibrated_params,
        set_initial_seeds_to=set_initial_seeds_to,
        full_scale=full_scale,
        expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)
            d['tests_per_batch'] = 100000

            # isolation
            d['smart_tracing_policy_isolate'] = 'basic'
            d['smart_tracing_isolated_contacts'] = 100000
            d['smart_tracing_isolation_duration'] = 14 * TO_HOURS,

            # testing
            d['smart_tracing_policy_test'] = test_policy
            d['smart_tracing_tested_contacts'] = contacts_tested

            return d

        simulation_info = options_to_str(
            tracing='+'.join(smart_tracing_actions),
            delay=test_delay,
            contacts_tested=contacts_tested,
            test_policy=test_policy,
        )

        experiment.add(
            simulation_info=simulation_info,
            country=country,
            area=area,
            measure_list=m,
            test_update=test_update,
            seed_summary_path=seed_summary_path,
            set_initial_seeds_to=set_initial_seeds_to,
            set_calibrated_params_to=calibrated_params,
            full_scale=full_scale,
            expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)
            site_type: 1.0
            for site_type in calibration_lockdown_site_closures
        }
        p_stay_home_dict = {
            **p_stay_home_dict_closures,
            **p_stay_home_dict_mobility_reduced
        }

        m = [
            SocialDistancingBySiteTypeForAllMeasure(
                t_window=Interval(measure_window_in_hours['start'],
                                  measure_window_in_hours['end']),
                p_stay_home_dict=p_stay_home_dict),
        ]

        sim_info = options_to_str(validation_region=val_area)

        experiment.add(simulation_info=sim_info,
                       country=val_country,
                       area=val_area,
                       measure_list=m,
                       seed_summary_path=seed_summary_path,
                       set_calibrated_params_to=calibrated_params,
                       set_initial_seeds_to=set_initial_seeds_to,
                       full_scale=full_scale)

        print(f'{experiment_info} configuration done.')

        # execute all simulations
        experiment.run_all()
                d['smart_tracing_households_only'] = True
                d['smart_tracing_actions'] = ['test', 'isolate']
                d['test_reporting_lag'] = 0.5

                # isolation
                d['smart_tracing_policy_isolate'] = 'basic'
                d['smart_tracing_isolated_contacts'] = 100000

                # testing
                d['smart_tracing_policy_test'] = 'basic'
                d['smart_tracing_tested_contacts'] = 100000
                d['trigger_tracing_after_posi_trace_test'] = False
                return d

            simulation_info = options_to_str(
                max_incidence=max_incidence,
                p_compliance=p_compliance,
            )

            experiment.add(
                simulation_info=simulation_info,
                country=country,
                area=area,
                measure_list=m,
                test_update=test_update,
                seed_summary_path=seed_summary_path,
                set_calibrated_params_to=calibrated_params,
                set_initial_seeds_to=set_initial_seeds_to,
                full_scale=full_scale,
                expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)

    print(f'{experiment_info} configuration done.')
                d['smart_tracing_households_only'] = True
                d['smart_tracing_actions'] = ['test', 'isolate']
                d['test_reporting_lag'] = 0.5

                # isolation
                d['smart_tracing_policy_isolate'] = 'basic'
                d['smart_tracing_isolated_contacts'] = 100000

                # testing
                d['smart_tracing_policy_test'] = 'basic'
                d['smart_tracing_tested_contacts'] = 100000
                d['trigger_tracing_after_posi_trace_test'] = False
                return d

            simulation_info = options_to_str(
                K_groups=groups,
                p_compliance=p_compliance)

            experiment.add(
                simulation_info=simulation_info,
                country=country,
                area=area,
                measure_list=m,
                test_update=test_update,
                seed_summary_path=seed_summary_path,
                set_initial_seeds_to=set_initial_seeds_to,
                set_calibrated_params_to=calibrated_params,
                full_scale=full_scale,
                expected_daily_base_expo_per100k=expected_daily_base_expo_per100k)

    print(f'{experiment_info} configuration done.')
Exemple #10
0
                        d['smart_tracing_policy_isolate'] = 'advanced-threshold'
                        d['smart_tracing_isolation_threshold'] = smart_tracing_threshold
                        d['smart_tracing_isolated_contacts'] = 100000
                        d['smart_tracing_isolation_duration'] = 14 * TO_HOURS,

                        # testing
                        d['smart_tracing_policy_test'] = 'advanced-threshold'
                        d['smart_tracing_testing_threshold'] = smart_tracing_threshold
                        d['smart_tracing_tested_contacts'] = 100000
                        d['trigger_tracing_after_posi_trace_test'] = False

                        return d

                    simulation_info = options_to_str(
                        p_tracing=p_adoption,
                        p_social_distancing=p_social_distancing,
                        test_lag=test_lag,
                        tracing_threshold=smart_tracing_threshold,
                    )

                    experiment.add(simulation_info=simulation_info,
                                   country=country,
                                   area=area,
                                   measure_list=m,
                                   test_update=test_update,
                                   seed_summary_path=seed_summary_path,
                                   set_initial_seeds_to=set_initial_seeds_to,
                                   set_calibrated_params_to=calibrated_params,
                                   full_scale=full_scale,
                                   expected_daily_base_expo_per100k=
                                   expected_daily_base_expo_per100k)
Exemple #11
0
        m = [
            SocialDistancingForAllMeasure(
                t_window=Interval(
                    measure_window_in_hours['start'], 
                    measure_window_in_hours['start'] + TO_HOURS * 7 * weeks),
                p_stay_home=p_stay_home),

            BetaMultiplierMeasureByType(
                t_window=Interval(
                    measure_window_in_hours['start'], 
                    measure_window_in_hours['start'] + TO_HOURS * 7 * weeks),
                beta_multiplier=calibration_lockdown_beta_multipliers)
            ]

        simulation_info = options_to_str(extended_lockdown_weeks=weeks)

        experiment.add(
            simulation_info=simulation_info,
            country=country,
            area=area,
            measure_list=m,
            lockdown_measures_active=False,
            test_update=None,
            seed_summary_path=seed_summary_path,
            set_calibrated_params_to=calibrated_params,
            set_initial_seeds_to=set_initial_seeds_to,
            full_scale=full_scale)
    print(f'{experiment_info} configuration done.')

    # execute all simulations
Exemple #12
0
        end_date=end_date,
        random_repeats=random_repeats,
        full_scale=None,
        verbose=verbose,
    )

    summary_paths = []
    for exp, expparams in exps.items():
        calibrated_params = get_calibrated_params(country=country,
                                                  area=area,
                                                  multi_beta_calibration=False,
                                                  maxiters=maxBOiters)
        calibrated_params['beta_site'] = expparams[
            'beta_scaling'] * calibrated_params['beta_site']

        simulation_info = options_to_str(
            exp=exp, beta_scaling=expparams['beta_scaling'])

        summary_path = experiment_info + '/' + experiment_info + '-' + simulation_info
        summary_paths.append(summary_path)

        if not os.path.exists('summaries/' + summary_path + '.pk'):
            experiment.add(
                simulation_info=simulation_info,
                country=country,
                area=area,
                test_update=None,
                measure_list=[],  # set automatically during lockdown
                seed_summary_path=seed_summary_path,
                set_initial_seeds_to=set_initial_seeds_to,
                set_calibrated_params_to=calibrated_params,
                full_scale=expparams['full_scale'])
Exemple #13
0
        full_scale=full_scale,
        verbose=verbose,
    )

    # Isolate k groups for different numbers of groups
    for groups in K_groups:
        # measures
        max_days = (pd.to_datetime(end_date) - pd.to_datetime(start_date)).days

        m = [
            SocialDistancingForKGroups(
                t_window=Interval(measure_window_in_hours['start'], measure_window_in_hours['end']),
                K=groups)
            ]

        simulation_info = options_to_str(
            K_groups=groups)

        experiment.add(
            simulation_info=simulation_info,
            country=country,
            area=area,
            measure_list=m,
            lockdown_measures_active=False,
            test_update=None,
            seed_summary_path=seed_summary_path,
            set_calibrated_params_to=calibrated_params,
            set_initial_seeds_to=set_initial_seeds_to,
            full_scale=full_scale)
    print(f'{experiment_info} configuration done.')

    # execute all simulations