Skip to content

Commit

Permalink
Added separate functions for epigeopop
Browse files Browse the repository at this point in the history
  • Loading branch information
Kemuk committed Jan 23, 2025
1 parent cee0855 commit ffdcd73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions R/wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ configure_parameters <- function(pe, input_dir, config_parameters) {
return(pe)
}

create_toy_population <- function(pe, pop_params) {
return(pe$routine$ToyPopulationFactory()$make_pop(pop_params))
}

create_epigeopop_population <- function(pe, epigeopop_file) {
return(pe$routine$FilePopulationFactory()$make_pop_from_file(epigeopop_file))
}

# Wrap python simulation function
run_simulation <- function(pe, sim_params, file_params, dem_file_params,
inf_history_params, pop_params = NULL,
Expand All @@ -32,11 +40,9 @@ run_simulation <- function(pe, sim_params, file_params, dem_file_params,
pe$routine$Simulation$set_random_seed(seed = as.integer(seed))
# Create population or load from file
if (epigeopop_file == "") {
population <- pe$routine$ToyPopulationFactory()$
make_pop(pop_params)
population <- create_toy_population(pe, pop_params)
} else {
population <- pe$routine$FilePopulationFactory()$
make_pop_from_file(epigeopop_file)
population <- create_epigeopop_population(pe, epigeopop_file)
}

# Create and configure simulation
Expand Down
Binary file added data/simulation_outputs/SIR_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added simulation_outputs/sir_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ffdcd73

Please sign in to comment.