Skip to content

Commit 2f98e51

Browse files
committed
minor changes
1 parent 5b06ae6 commit 2f98e51

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

covid19AgeModel/inst/scripts/post-processing-etas.R

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ if(!file.exists(file) | args_dir[['overwrite']])
140140
cat("\nWrite ",file," ... ")
141141
saveRDS(mcnts, file=file)
142142
file2 <- gsub('_by_age','',file)
143-
cat("\nWrite ",file," ... ")
143+
cat("\nWrite ",file2," ... ")
144144
saveRDS(ocnts, file=file2)
145145
})
146146
cat(" \n -------------------------------- \n summarise marginal contact intensities by age: end \n -------------------------------- \n")
147147
}
148148
if(file.exists(file))
149149
{
150150
mcnts <- readRDS(file)
151-
file <- gsub('_by_age','',file)
152-
ocnts <- readRDS(file)
151+
file2 <- gsub('_by_age','',file)
152+
ocnts <- readRDS(file2)
153153
}
154154

155155
# handle if forecast period is to be included in plots
@@ -189,7 +189,17 @@ file <- paste0(outfile.base,'-marginal_contact_intensities_across_states_weighte
189189
if(!file.exists(file) | args_dir[['overwrite']])
190190
{
191191
cat(" \n -------------------------------- \n summarise marginal contact intensities across states: start \n -------------------------------- \n")
192-
tryCatch({
192+
tryCatch({
193+
round.choose <- function(x, roundTo, dir = 1) {
194+
if(dir == 1) { ##ROUND UP
195+
x + (roundTo - x %% roundTo)
196+
} else {
197+
if(dir == 0) { ##ROUND DOWN
198+
x - (x %% roundTo)
199+
}
200+
}
201+
}
202+
193203
weighted_contacts <- make_contact_intensities_across_states_summaries(plot.pars.basic$regions,
194204
plot.pars.basic$mobility_data,
195205
plot.pars.basic$dates,
@@ -220,7 +230,7 @@ if(!file.exists(file) | args_dir[['overwrite']])
220230
file2 <- paste0(outfile.base,'-marginal_contact_intensities_across_states_weighted_age.rds')
221231
saveRDS(age_specific, file=file2, version = 2)
222232

223-
p <- make_age_contact_boxplot(age_specific, outfile.base)
233+
#p <- make_age_contact_boxplot(age_specific, outfile.base)
224234

225235

226236
})

covid19AgeModel/inst/scripts/post-processing-make-daily-weekly-deaths-expected-observed-plot.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# post-processing-make-deaths-panel-plot.R
1+
# post-processing-make-daily-weekly-deaths-expected-observed-plot.R
22
#
33
###############################################################################
44

5-
cat(" \n -------------------------------- \n \n post-processing-make-deaths-panel-plot.R \n \n -------------------------------- \n")
5+
cat(" \n -------------------------------- \n \n post-processing-make-daily-weekly-deaths-expected-observed-plot.R \n \n -------------------------------- \n")
66

77
suppressMessages(library(data.table, quietly = TRUE))
88
suppressMessages(library(bayesplot, quietly = TRUE))
@@ -130,3 +130,5 @@ df.weekly = find_observed_death_fourageband(e_adeaths_weekly, "weekly")
130130

131131
plot_expected_observed_death(df.daily, "daily")
132132
plot_expected_observed_death(df.weekly, "weekly")
133+
134+
cat(" \n -------------------------------- \n \n Completed post-processing-make-daily-weekly-deaths-expected-observed-plot.R \n \n -------------------------------- \n")

covid19AgeModel/inst/scripts/post-processing-plot-age-newcases.R

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# post-processing-plot-mean-age-newcases.R
1+
# post-processing-plot-age-newcases.R
22
#
33
###############################################################################
44

5-
cat(" \n -------------------------------- \n \n Running post-processing-plot-mean-age-newcases.R \n \n -------------------------------- \n")
5+
cat(" \n -------------------------------- \n \n Running post-processing-plot-age-newcases.R \n \n -------------------------------- \n")
66

77
suppressMessages(library(data.table, quietly = TRUE))
88
suppressMessages(library(bayesplot, quietly = TRUE))
@@ -82,6 +82,10 @@ if(!file.exists(file) | args_dir[['overwrite']])
8282
cat("\nWrite ",file," ... ")
8383
saveRDS(e_newcases_byage_c, file=file)
8484
}
85+
if(file.exists(file))
86+
{
87+
e_newcases_byage_c <- readRDS(file)
88+
}
8589
cat("\n ----------- plot_proportion_newcases_byage_c ----------- \n")
8690

8791
#
@@ -134,7 +138,10 @@ if(!file.exists(file) | args_dir[['overwrite']])
134138
cat("\nWrite ",file," ... ")
135139
saveRDS(e_age_newcases, file=file)
136140
}
137-
141+
if(file.exists(file))
142+
{
143+
e_age_newcases <- readRDS(file)
144+
}
138145
cat("\n ----------- plot_mean_age_new_cases ----------- \n")
139146

140147
#
@@ -168,4 +175,4 @@ ggplot(e_age_newcases, aes(x = date)) +
168175
scale_colour_viridis(begin=0,end=1,direction=-1) +
169176
ggsave(paste0(outfile.base,'-mean_ageofinfection.png'), w = 210, h = 310, units = "mm")
170177

171-
cat(" \n -------------------------------- \n \n Completed post-processing-plot-mean-age-newcases.R \n \n -------------------------------- \n")
178+
cat(" \n -------------------------------- \n \n Completed post-processing-plot-age-newcases.R \n \n -------------------------------- \n")

covid19AgeModel/inst/scripts/post-processing-summarise-antibody.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# post-processing-validate-prop_antibodys.R
1+
# post-processing-summarise-antibody.R
22
#
33
###############################################################################
44

5-
cat(" \n -------------------------------- \n \n post-processing-validate-prop_antibodys.R \n \n -------------------------------- \n")
5+
cat(" \n -------------------------------- \n \n post-processing-summarise-antibody.R \n \n -------------------------------- \n")
66

77
suppressMessages(library(data.table, quietly = TRUE))
88
suppressMessages(library(bayesplot, quietly = TRUE))
@@ -349,7 +349,7 @@ cat("\n ----------- plot estimated/observed attack rates ----------- \n")
349349
da <- copy( artable[[1]] )
350350

351351
da <- subset(da, select=-c(L_est,L_obs))
352-
da <- reshape2::melt(da, measure.vars=c('M_est','CL_est','CU_est','M_obs','CL_obs','CU_obs'))
352+
da <- as.data.table( reshape2::melt(da, measure.vars=c('M_est','CL_est','CU_est','M_obs','CL_obs','CU_obs')) )
353353
set(da, NULL, 'value', da[, as.numeric(value)/100])
354354
da[, mtype:= gsub('est','Estimated',gsub('obs','Survey',gsub('^([A-Za-z]+)_([A-Za-z]+)$','\\2',variable)))]
355355
da[, stat:= gsub('^([A-Za-z]+)_([A-Za-z]+)$','\\1',variable)]
@@ -379,4 +379,4 @@ for (i in 1:length(lags)) {
379379
ggsave(file=paste0(outfile.base, "-prop_antibody_validation_lag",lags[i],".png"),g,w=7, h=10)
380380
}
381381

382-
cat(" \n -------------------------------- \n \n completed post-processing-validate-prop_antibodys.R \n \n -------------------------------- \n")
382+
cat(" \n -------------------------------- \n \n completed post-processing-summarise-antibody.R \n \n -------------------------------- \n")

0 commit comments

Comments
 (0)