-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 549: Extra post-processing steps (#551)
* Update changelog.md * Update make_model_priors.jl * Make `define_epiprob` more modular _make_epidata can also be reused elsewhere * restructure analysis dataframe func * fix make_prediction_dataframe_from_output And add simple unit test with committed test data * Revert "fix make_prediction_dataframe_from_output" This reverts commit 7e6238b. * Reapply "fix make_prediction_dataframe_from_output" This reverts commit 14d29b4. * script to generate prediction dataframes * create_prediction_df refactor + fix * update to analyses failures * Update create_prediction_dataframe.jl * refactor make_truthdata_dataframe And add unit test * create script for generating postprocessed truth data And bundle into single script for DRY
- Loading branch information
1 parent
8229711
commit 12a21c6
Showing
6 changed files
with
49 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using EpiAwarePipeline, EpiAware, JLD2, DrWatson, DataFramesMeta, CSV | ||
|
||
## Define scenarios | ||
scenarios = ["measures_outbreak", "smooth_outbreak", "smooth_endemic", "rough_endemic"] | ||
|
||
if !isfile(plotsdir("plotting_data/predictions.csv")) | ||
@info "Prediction dataframe does not exist, generating now" | ||
include("create_prediction_dataframe.jl") | ||
end | ||
|
||
if !isfile(plotsdir("plotting_data/truthdata.csv")) | ||
@info "Truth dataframe does not exist, generating now" | ||
include("create_truth_dataframe.jl") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
truth_df = mapreduce(vcat, scenarios) do scenario | ||
truth_data_files = readdir(datadir("truth_data")) |> | ||
strs -> filter(s -> occursin("jld2", s), strs) |> | ||
strs -> filter(s -> occursin(scenario, s), strs) | ||
mapreduce(vcat, truth_data_files) do filename | ||
D = load(joinpath(datadir("truth_data"), filename)) | ||
make_truthdata_dataframe(D, scenario) | ||
end | ||
end | ||
|
||
CSV.write(plotsdir("plotting_data/truthdata.csv"), truth_df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@testset "make_truthdata_dataframe tests" begin | ||
truth_data = Dict( | ||
"I_t" => [10, 20, 30], | ||
"truth_I0" => 5, | ||
"truth_gi_mean" => 2.5, | ||
"truth_process" => [1.0, 1.5, 2.0] | ||
) | ||
scenario = "test_scenario" | ||
|
||
df = make_truthdata_dataframe(truth_data, scenario) | ||
|
||
@test typeof(df) == DataFrame | ||
@test size(df, 1) == 9 # 3 targets * 3 time points | ||
@test all(df.Scenario .== scenario) | ||
@test all(df.True_GI_Mean .== truth_data["truth_gi_mean"]) | ||
@test all(df.Target .== | ||
["log_I_t", "log_I_t", "log_I_t", "rt", "rt", "rt", "Rt", "Rt", "Rt"]) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
include("make_prediction_dataframe_from_output.jl") | ||
include("make_truthdata_dataframe.jl") |