OpenABM-Covid19 icon indicating copy to clipboard operation
OpenABM-Covid19 copied to clipboard

Zero tests recorded if hospitalisation fraction set to zero

Open p-robot opened this issue 3 years ago • 0 comments

The n_tests column of the time series records zero tests if hospitalisation fraction is zero in all age groups (total infected added as a superfluous variable in case --showlocals is flagged in pytest to highlight that infection is occurring). This test fails (if put in test_interventions.py, for instance), whereas I would have expected it to have passed.

    def test_testing_outside_hospitalisation( self ):
        """
        Check there can be testing outside of hospitalisation
        """

        params = utils.get_params_swig()
        params.set_param("n_total", 50000)
        params.set_param( "infectious_rate", 7.25 )

         # Set hospitalisation fraction to zero in all age groups
        utils.set_hospitalisation_fraction_all(params, 0)

        # Give everyone the app and all interactions are traceable
        params.set_param("traceable_interaction_fraction", 1)
        utils.set_app_users_fraction_all(params, 1)
        params.set_param( "test_on_symptoms", 1 )
        
        model  = utils.get_model_swig( params )
        
        model.one_time_step()
        model.update_running_params("app_turned_on", 1 )
        model.update_running_params("trace_on_symptoms", 1)
        model.update_running_params("trace_on_positive", 1)
        model.update_running_params("test_on_traced", 1)
        
        n_tests = []; total_infected = []
        for time in range( 60 ):
            model.one_time_step()
            n_tests.append(model.one_time_step_results()["n_tests"])
            total_infected.append(model.one_time_step_results()["total_infected"])
        
        total_tests = np.sum(n_tests)
        final_infected = total_infected[-1]
        np.testing.assert_equal( total_tests > 0, True )

p-robot avatar Sep 22 '20 14:09 p-robot