def test_Dakar(): """Test Dakar population constructed.""" sp.logger.info("Not a real test yet. To be filled out.") pop = sp.Pop(**pars) assert pop.location == 'Dakar', 'population location information is not set to Dakar' sp.reset_default_settings() # reset defaults
def test_Nepal(): """Test Nepal population constructed.""" sp.logger.info( "Test that Nepal contact networks can be made. Not a guarantee that the population made matches age mixing patterns well yet." ) # make a basic population pop = sp.Pop(**pars) assert pop.country_location == 'Nepal', "population location information is not set to Malawi" sp.reset_default_settings( ) # reset defaults so that other tests in parallel are not impacted
def pop_exploration(): sp.logger.info( "Exploration of the Malawi population generation with default methods and missing data filled in with Senegal data" ) sp.set_location_defaults(country_location="Senegal") pop = sp.Pop(**pars) print(pop.summarize()) pop.plot_ages() pop.plot_enrollment_rates_by_age() sp.set_location_defaults() plt.show() sp.reset_default_settings() # reset defaults
def test_Malawi(): """Test Malawi population constructed.""" sp.logger.info( "Test that Malawi contact networks can be made. Not a guarantee that the population made matches age mixing patterns well yet." ) # reset the default location to pull other data sp.set_location_defaults(country_location="Senegal") # make a basic population pop = sp.Pop(**pars) assert pop.country_location == 'Malawi', "population location information is not set to Malawi" sp.reset_default_settings() # reset defaults
def pop_exploration(): sp.logger.info("Exploration of the Dakar population generation with default methods") pop = sp.Pop(**pars) print(pop.summarize()) print(pop.information) pop.plot_household_sizes() # update household sizes data to go up to 50 - make sure to calculate these using the household weights and not just pure counts pop.plot_ages() pop.plot_enrollment_rates_by_age() pop.plot_employment_rates_by_age() pop.plot_workplace_sizes() pop.plot_household_head_ages_by_size() # update the household head age by size matrix to go up to 50 pop.plot_contacts(layer='H', density_or_frequency='frequency', logcolors_flag=1, aggregate_flag=1) # test other options pop.plot_contacts(layer='S', density_or_frequency='frequency', logcolors_flag=1, aggregate_flag=1) # test other options pop.plot_contacts(layer='W', density_or_frequency='frequency', logcolors_flag=1, aggregate_flag=1) # test other options plt.show() sp.reset_default_settings() # reset defaults
def pop_exploration(): sp.logger.info( "Exploration of the Zimbabwe population generation with default methods and missing data filled in with Senegal data" ) sp.set_location_defaults(country_location="Senegal") pop = sp.Pop(**pars) print(pop.summarize()) pop.plot_ages() pop.plot_household_sizes() pop.plot_enrollment_rates_by_age() pop.plot_contacts(layer='H', density_or_frequency='density', logcolors_flag=0, title_prefix="Zimbabwe Age Mixing") pop.plot_school_sizes(with_school_types=1) pop.plot_employment_rates_by_age() pop.plot_workplace_sizes() sp.reset_default_settings() # reset defaults plt.show()