-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0. settings.R
49 lines (40 loc) · 1.75 KB
/
0. settings.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Needed for finding the most recent datafiles from EPI
library(tidyverse)
library(here)
library(furrr)
# Under this subfolder, all relevant files will be written
runname <- "results/paper"
dir.create(here(runname), showWarnings = FALSE, recursive = TRUE ) # allows all runs to be in a single subdirectory if runname consists of stacked folders
startday <- as.Date("2020-08-01")
lastday <- as.Date("2022-02-08")
dir.create.if.needed <- function(x){
if( !dir.exists(x)) dir.create(x)
}
# directories
dir.create.if.needed(here(runname, "model_code_backup"))
file.copy( from = list.files( pattern = "^[0-9].*R|^.*stan"),
to = here(runname, "model_code_backup"))
walk( c("figures", "output"),
function(x){
outdir <- here(runname, x)
dir.create.if.needed(outdir)
dir.create.if.needed(here(outdir, "model_data" ))
dir.create.if.needed(here(outdir, "Netherlands" ))
dir.create.if.needed(here(outdir, "RWZI" ))
dir.create.if.needed(here(outdir, "municipality" ))
dir.create.if.needed(here(outdir, "safetyregion" ))
dir.create.if.needed(here(outdir, "manuscript" ))})
# Finally, we copy df_viralload to the newly created map if it doesn't exists yet
viralload_filename <- "df_viralload_human_regions.RData"
if(!file.exists(here(runname,"output", "model_data","df_viralload_human_regions.RData"))){
file.copy(from = viralload_filename,
to = here(runname,"output", "model_data","df_viralload_human_regions.RData"))
}
viralload_filename <- here(runname,"output", "model_data","df_viralload_human_regions.RData")
# Settings for wastewater-model
num_knots <- 15
spline_degree <- 3
n_chains <- 10
# Number of cores for parallelization
plan(multisession, workers = 10)
settings_sourced <- T