Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split school types #385

Merged
merged 376 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
376 commits
Select commit Hold shift + click to select a range
a5dd726
update of RESTORE 8
twallema Jun 18, 2021
6ebb6b3
Merge remote-tracking branch 'upstream/master'
twallema Jun 25, 2021
20b5c21
Merge remote-tracking branch 'upstream/master'
twallema Jun 28, 2021
478f4e2
Merge branch 'master' into RESTORE-8-updates
twallema Jul 14, 2021
425c345
update data
twallema Jul 14, 2021
5c7411b
bring vaccination function in line with previous bugfix
twallema Jul 14, 2021
fb49e68
expand dims on ICUrec and remove subtraction of dUCUrec with dICU_R
twallema Jul 14, 2021
6cc5861
vectorize vaccination implementation
twallema Jul 14, 2021
7742b74
working first- and second dose vaccination function
twallema Jul 14, 2021
556d273
working multidose model
twallema Jul 14, 2021
62c3be5
implement a draw function for the stratified vaccination model
twallema Jul 15, 2021
35e4295
format vaccination functions of both models and update docstrings
twallema Jul 15, 2021
ad234da
all changes to notebook and models.py
twallema Jul 15, 2021
7c58f23
Merge branch 'RESTORE-8-updates'
twallema Jul 16, 2021
1766490
update policies
twallema Jul 28, 2021
a35fde7
update data
twallema Jul 28, 2021
348dc8b
tryout calibration script
twallema Jul 28, 2021
c8e96c5
plot PSO stratified function
twallema Jul 28, 2021
b013a05
changes to notebook
twallema Jul 28, 2021
afe7692
update data
twallema Aug 24, 2021
443a365
adjusted samples location in function run_MCMC
twallema Aug 24, 2021
bbe5017
Experiment with different ensemble moves
twallema Aug 24, 2021
8612548
reduce number of dimensions down to time (irregardless of dims in out)
twallema Aug 24, 2021
3562de2
bring draw function in line with new calibration
twallema Aug 24, 2021
2f87566
adjust output_to_visuals to sum over all dims except time/draws
twallema Aug 24, 2021
88e5896
tweaks to the model structure
twallema Aug 24, 2021
1640a6f
implementation of split prev_rest parameter for lockdown and relaxation
twallema Aug 24, 2021
f5fb56f
calibration script
twallema Aug 24, 2021
c0a2380
changes to calibration script
twallema Aug 24, 2021
fcf4202
calibration results
twallema Aug 24, 2021
5ecdf41
changes to tryout script
twallema Aug 24, 2021
c01ad1f
fix new age groups in vaccination dataframe
twallema Aug 26, 2021
adfa516
implement new age groups in vaccination campaign in vaccination class
twallema Aug 26, 2021
a470373
remove obsolete code in draw_fcn
twallema Aug 26, 2021
cbf6aaf
introduce effect of leisure mentality changes gradually in the model
twallema Aug 26, 2021
90d1b86
stop vaccination campaign after end of data
twallema Aug 26, 2021
68f3a07
changes to calibration script
twallema Aug 26, 2021
ada66fd
Merge branch 'RESTORE-8-updates' of https://github.com/twallema/COVID…
twallema Aug 26, 2021
d6361e4
Merge branch 'twallema-RESTORE-8-updates'
twallema Aug 26, 2021
643c468
merge master
twallema Aug 26, 2021
ccb4fd1
Merge remote-tracking branch 'upstream/master'
twallema Aug 27, 2021
20eb655
Merge remote-tracking branch 'upstream/master'
twallema Aug 27, 2021
712091d
Merge remote-tracking branch 'upstream/master'
twallema Sep 1, 2021
b63b953
Merge remote-tracking branch 'upstream/master'
twallema Oct 7, 2021
a34c466
Merge remote-tracking branch 'upstream/master'
twallema Oct 11, 2021
7e23704
Merge remote-tracking branch 'upstream/master'
twallema Oct 11, 2021
a632b81
implement automatic formatting of initN to desired age groups and test
twallema Oct 12, 2021
ab97f6c
remove old notebook performing the formatting
twallema Oct 12, 2021
45a5aad
cleanup data folder --> remove unused datasets
twallema Oct 12, 2021
eaf40c6
update data readme
twallema Oct 12, 2021
a23c21a
raw willem 2012 data in 10 age bins
twallema Oct 13, 2021
e92db40
raw willem 2012 data in 3 age bins
twallema Oct 13, 2021
e6da655
remove need for more_5_min and more_15_min in interaction matrices
twallema Oct 13, 2021
efb1e6b
delete interim interaction matrices
twallema Oct 13, 2021
3fd5250
update data readme for removal of interim interaction matrices
twallema Oct 13, 2021
eaee03f
implementation of three age options for initN and interaction matrices
twallema Oct 13, 2021
044247d
fixed a bug in extraction of serological data
twallema Oct 14, 2021
358b0c1
add option to contruct_initN to not perform grouping in age bins
twallema Oct 14, 2021
b3d93c8
conversion functions for model pars a and h
twallema Oct 14, 2021
7131302
move hospital data to a folder denoting its age-stratification
twallema Oct 14, 2021
a0a6216
pre-program three age bins in hospital data analysis
twallema Oct 14, 2021
e4905cd
age-stratification and hospitals are now working
twallema Oct 14, 2021
53c6668
implement age_stratification_size in samples_dict preparation function
twallema Oct 14, 2021
4eba5e2
adjust vaccination function to work for 10 age groups only
twallema Oct 14, 2021
40a16a9
changes to calibration script
twallema Oct 14, 2021
912285f
put initN_arr, initN_mun, initN_prov back in place
twallema Oct 14, 2021
5e011ec
initial_state function does not work
twallema Oct 14, 2021
caadce1
make vaccine function working
twallema Oct 14, 2021
5c638ce
fixed reshape size error in vaccination function
twallema Oct 15, 2021
f26fb39
change vaccination dataframe age index to intervalindex
twallema Oct 15, 2021
a95a85d
rename convert_age_stratified_series to convert_age_stratified_property
twallema Oct 15, 2021
4179b8b
manually make age index of spatial vacc data a pd.IntervalIndex
twallema Oct 15, 2021
4e6b53a
vaccination age-interpolation (1)
twallema Oct 15, 2021
5eebc13
vaccination age-interpolation (2)
twallema Oct 15, 2021
a1b6fed
let function construct_initN return a pd.DataFrame
twallema Oct 15, 2021
dc11b2c
vaccination age-interpolation (working)
twallema Oct 15, 2021
bfe4798
vaccination age-interpolation (bugfix)
twallema Oct 15, 2021
e95866b
changes to michiels script
twallema Oct 15, 2021
ac1f2d7
vaccination age-interpolation (bugfix)
twallema Oct 15, 2021
1069035
set progress to true by default
twallema Oct 15, 2021
0e25db4
verified calibration FULL is working for three age groups
twallema Oct 15, 2021
a29ae6e
add effect of variants on transmissiblity to model
twallema Oct 18, 2021
ecadf70
add redundancy to avoid negative susceptible pools due to vaccination
twallema Oct 18, 2021
f8c869b
add path to hospital data to samples_dict init function
twallema Oct 18, 2021
8bfa867
hardcode a good starting estimate for calibration in calibration script
twallema Oct 18, 2021
013c9ae
rename all models in models.py SEIRD --> SEIQRD
twallema Oct 18, 2021
1fb6f0e
update data
twallema Oct 18, 2021
1ed4b3b
update calibrate-COVID-19-SEIQRD-WAVE-1 script
twallema Oct 18, 2021
e01e6ee
modify draw_fcn_WAVE1 to automatically deduce age strat size
twallema Oct 18, 2021
a8a75d0
make model xarray output immutable in function output_to_visuals
twallema Oct 18, 2021
cedb6c1
rename WAVE 1 calibration script
twallema Oct 18, 2021
3cb9315
change SEIRD --> SEIQRD in all calibration script names
twallema Oct 18, 2021
c206025
working visualization script for WAVE 1
twallema Oct 18, 2021
6d6548b
rename folder COVID19_SEIRD --> COVID19_SEIQRD
twallema Oct 18, 2021
bd9ce8f
ajust directory names where relevant
twallema Oct 18, 2021
36f61b1
ajust folder name in sciensano hospital data analysis
twallema Oct 18, 2021
5d4ce7a
intermediate save of adjusting the sciensano data function
twallema Oct 18, 2021
7f60f52
new sciensano public data function
twallema Oct 19, 2021
69fd373
tweaks to calibration/plot_fit WAVE1 due to change in sciensano data
twallema Oct 19, 2021
89cc1ef
fix bug in sciensano public data formatting
twallema Oct 19, 2021
224bb3d
change idx name 'start_week' in spatial public vacc data into 'date'
twallema Oct 19, 2021
eaa83e9
WAVE2 calibration --> R0 method works
twallema Oct 19, 2021
119707f
folder name SEIRD --> SEIQRD
twallema Oct 20, 2021
af5668d
vaccination function works for unidose models
twallema Oct 20, 2021
3f29939
place others.csv directly in get_model_parameters
twallema Oct 20, 2021
dce90c6
fix bug in matrix size of willem2012 matrices
twallema Oct 20, 2021
576e435
calibrate and plot_fit for WAVE2 working
twallema Oct 20, 2021
797b403
update spatial vacc data
twallema Oct 20, 2021
b22c15e
tweaks to stratified vacc calibration
twallema Oct 20, 2021
2fc1bca
automatic dimension reduction in plot_PSO
twallema Oct 21, 2021
a262276
working vaccination module
twallema Oct 21, 2021
5c7a6dd
leave dose E out of vaccination model data analysis for now
twallema Oct 21, 2021
a15e3a2
avoid deprication error in vacc module
twallema Oct 21, 2021
ac09e14
remove print() from plot fit WAVE1
twallema Oct 21, 2021
041bd63
name change for calibration script of wave 1
twallema Oct 21, 2021
53ac9b4
name change for plot fit script of wave 1
twallema Oct 21, 2021
66ad808
calibration script vaccination national model is working
twallema Oct 21, 2021
3681cca
plot fit for vacc national model works
twallema Oct 21, 2021
b573814
adjust method to find start and end of vacc dataframe
twallema Oct 21, 2021
a071810
verified michiels calibration script is working
twallema Oct 21, 2021
d8bdb68
remove sciensano test function
twallema Oct 21, 2021
7c5f8f6
Merge branch 'redo-age-groups'
twallema Oct 21, 2021
a769870
Merge remote-tracking branch 'upstream/master'
twallema Oct 21, 2021
21a0b93
Merge remote-tracking branch 'upstream/master'
twallema Oct 28, 2021
6a0b707
Merge remote-tracking branch 'upstream/master'
twallema Oct 28, 2021
588557f
Merge remote-tracking branch 'upstream/master'
twallema Oct 29, 2021
763e7e8
Merge remote-tracking branch 'upstream/master'
twallema Nov 10, 2021
d8ec326
Merge remote-tracking branch 'upstream/master'
twallema Nov 11, 2021
b866b64
Merge remote-tracking branch 'upstream/master'
twallema Nov 15, 2021
b9ea5a3
Merge remote-tracking branch 'upstream/master'
twallema Nov 16, 2021
a07d4cc
Merge remote-tracking branch 'upstream/master'
twallema Nov 26, 2021
83a4083
Merge remote-tracking branch 'upstream/master'
twallema Nov 30, 2021
771b063
Merge remote-tracking branch 'upstream/master'
twallema Dec 1, 2021
330ac53
Merge remote-tracking branch 'upstream/master'
twallema Dec 1, 2021
25565b1
Merge remote-tracking branch 'upstream/master'
twallema Dec 1, 2021
312202a
Merge remote-tracking branch 'upstream/master'
twallema Dec 3, 2021
3c9a979
Merge remote-tracking branch 'upstream/master'
twallema Dec 15, 2021
1c845d4
Merge remote-tracking branch 'upstream/master'
twallema Dec 20, 2021
ee25b0d
Merge remote-tracking branch 'upstream/master'
twallema Dec 21, 2021
6984847
Merge remote-tracking branch 'upstream/master'
twallema Dec 21, 2021
7c5f716
Merge remote-tracking branch 'upstream/master'
twallema Jan 31, 2022
88e9e78
Merge remote-tracking branch 'upstream/master'
twallema Jan 31, 2022
1916a79
Merge remote-tracking branch 'upstream/master'
twallema Feb 1, 2022
514cc8b
Merge remote-tracking branch 'upstream/master'
twallema Mar 8, 2022
48ea412
Merge remote-tracking branch 'upstream/master'
twallema Mar 8, 2022
359f6e2
Merge remote-tracking branch 'upstream/master'
twallema Mar 8, 2022
91b96db
Merge remote-tracking branch 'upstream/master'
twallema Mar 9, 2022
e008509
Merge remote-tracking branch 'upstream/master'
twallema Mar 9, 2022
cbe8272
Merge remote-tracking branch 'upstream/master'
twallema Mar 10, 2022
6135c3e
Merge remote-tracking branch 'upstream/master'
twallema Mar 11, 2022
f9c62c8
Merge remote-tracking branch 'upstream/master'
twallema Mar 14, 2022
67a982a
Merge remote-tracking branch 'upstream/master'
twallema Mar 25, 2022
043892d
Merge remote-tracking branch 'upstream/master'
twallema Mar 25, 2022
59ed9c7
Merge remote-tracking branch 'upstream/master'
twallema Mar 30, 2022
62095a8
Merge remote-tracking branch 'upstream/master'
twallema Apr 11, 2022
bfad3dd
Merge remote-tracking branch 'upstream/master'
twallema Apr 12, 2022
6eb2eee
Merge remote-tracking branch 'upstream/master'
twallema Apr 13, 2022
c600e86
Merge remote-tracking branch 'upstream/master'
twallema Apr 20, 2022
c306a9d
Merge remote-tracking branch 'upstream/master'
twallema Apr 20, 2022
ece729c
Merge remote-tracking branch 'upstream/master'
twallema Apr 20, 2022
42ab9eb
Merge remote-tracking branch 'upstream/master'
twallema May 3, 2022
28b213c
Merge remote-tracking branch 'upstream/master'
twallema May 9, 2022
daf28d8
Merge remote-tracking branch 'upstream/master'
twallema May 9, 2022
0d33f39
Merge remote-tracking branch 'upstream/master'
twallema May 16, 2022
c50c48e
Merge remote-tracking branch 'upstream/master'
twallema May 24, 2022
66b2dc3
omit zeta from calibration, set to one year on average
twallema May 24, 2022
5105e04
remove zeta from calibration and adjust draw function
twallema May 25, 2022
ddc92fb
new calibration result
twallema May 25, 2022
cc84224
remove old calibration result
twallema May 25, 2022
219c067
tryout new initial states
twallema May 25, 2022
6724304
new initial condition, set l1 to 7 days
twallema May 25, 2022
c0a6658
calibration result 05-25
twallema May 25, 2022
7bf3738
initial condition script
twallema May 25, 2022
59608b0
tweak to plot fit base
twallema May 25, 2022
188f51a
Merge branch 'elaborate-calibration-national-model'
twallema May 25, 2022
6701f09
Merge remote-tracking branch 'upstream/master'
twallema May 25, 2022
12341e6
Merge remote-tracking branch 'upstream/master'
twallema May 25, 2022
f36477e
Merge remote-tracking branch 'upstream/master'
twallema May 25, 2022
c7cee2a
Merge remote-tracking branch 'upstream/master'
twallema May 25, 2022
b0c9509
Merge remote-tracking branch 'upstream/master'
twallema May 25, 2022
a5c51ee
Merge remote-tracking branch 'upstream/master'
twallema May 30, 2022
00d8c10
Merge remote-tracking branch 'upstream/master'
twallema Jun 3, 2022
73eb102
Merge remote-tracking branch 'upstream/master'
twallema Jun 9, 2022
0850296
Merge remote-tracking branch 'upstream/master'
twallema Jun 16, 2022
36cb7bc
Merge remote-tracking branch 'upstream/master'
twallema Aug 10, 2022
e8addf9
Merge remote-tracking branch 'upstream/master'
twallema Aug 18, 2022
16dc879
Merge remote-tracking branch 'upstream/master'
twallema Aug 18, 2022
16603c4
Merge remote-tracking branch 'upstream/master'
twallema Aug 26, 2022
4582dca
Merge remote-tracking branch 'upstream/master'
twallema Sep 14, 2022
f24fa2d
Merge remote-tracking branch 'upstream/master'
twallema Sep 14, 2022
5093593
Merge remote-tracking branch 'upstream/master'
twallema Sep 23, 2022
9712edf
Merge remote-tracking branch 'upstream/master'
twallema Sep 23, 2022
129320b
Merge remote-tracking branch 'upstream/master'
twallema Sep 28, 2022
7b24150
Merge remote-tracking branch 'upstream/master'
twallema Sep 29, 2022
7f10492
Merge remote-tracking branch 'upstream/master'
twallema Oct 3, 2022
8c2d518
Merge remote-tracking branch 'upstream/master'
twallema Oct 3, 2022
84558e6
Merge remote-tracking branch 'upstream/master'
twallema Oct 25, 2022
7a21ea8
Merge remote-tracking branch 'upstream/master'
twallema Oct 27, 2022
dc51859
Merge remote-tracking branch 'upstream/master'
twallema Nov 7, 2022
bf15d71
Merge remote-tracking branch 'upstream/master'
twallema Nov 8, 2022
0d09ef9
Merge remote-tracking branch 'upstream/master'
twallema Nov 9, 2022
ffd4236
Merge remote-tracking branch 'upstream/master'
twallema Nov 29, 2022
814f909
Merge remote-tracking branch 'upstream/master'
twallema Jan 25, 2023
f6da930
Merge remote-tracking branch 'upstream/master'
twallema Mar 6, 2023
d678a7a
Merge remote-tracking branch 'upstream/master'
twallema Mar 20, 2023
38b580d
Merge remote-tracking branch 'upstream/master'
twallema Mar 20, 2023
55e1dd2
Merge remote-tracking branch 'upstream/master'
twallema Apr 19, 2023
5040e53
Merge remote-tracking branch 'upstream/master'
twallema May 9, 2023
cbd0c64
Merge remote-tracking branch 'upstream/master'
twallema May 26, 2023
a396d41
Merge remote-tracking branch 'upstream/master'
twallema May 26, 2023
8545ea8
Merge remote-tracking branch 'upstream/master'
twallema May 26, 2023
b55e459
Merge remote-tracking branch 'upstream/master'
twallema Jun 5, 2023
476dd21
Merge remote-tracking branch 'upstream/master'
twallema Jun 14, 2023
f97fa10
construct matrices
twallema Jun 14, 2023
6f33159
split primary/secundary vs tertiary education
twallema Jun 14, 2023
8e05254
native datetime implementation ramp function
twallema Jun 26, 2023
99fe54b
simplified VOC function
twallema Jun 26, 2023
7b4efcf
omit datetime conversion from vacc efficacy
twallema Jun 26, 2023
147d943
get conversion to datetime dates out of contact function
twallema Jun 26, 2023
b8aff8a
closure of uni's not implemented well --> fix
twallema Jun 26, 2023
4aca1e7
un-panda-ify the belgian school holidays function
twallema Jun 26, 2023
b5c1214
fix bugs
twallema Jun 26, 2023
af14281
vaccination function
twallema Jun 26, 2023
26650e9
f_h func, seasonality func
twallema Jun 26, 2023
4ad4bd5
works
twallema Jun 26, 2023
9efb6ac
pandas datetime from policy function national model
twallema Jun 26, 2023
85e77cc
ODE model
twallema Jun 26, 2023
3d4711b
clean up ODE models
twallema Jun 27, 2023
e6a0a57
clean up SDE models
twallema Jun 27, 2023
f7b961b
remove three beta's from spatial model
twallema Jun 27, 2023
df0a7fa
belongs to previous
twallema Jun 27, 2023
6d22e70
removes pandas from TDPF spatial
twallema Jun 27, 2023
d53d0df
calibration scripts
twallema Jun 27, 2023
31b7767
scenario notebooks
twallema Jun 27, 2023
0c437a8
calibration results
twallema Jun 27, 2023
a545997
update python version to 3.11
twallema Jun 27, 2023
4341ab1
update reference dictionary
twallema Jun 27, 2023
80a402c
add nationally aggregated data in the estimation of spatial model
twallema Jun 27, 2023
49244eb
fix wrong abbreviation september in sciensano blood data
twallema Jun 28, 2023
13acfeb
rearrange environment
twallema Jun 28, 2023
643a1d1
fix wrong data in sciensano blood sero data
twallema Jun 28, 2023
2d286d9
set limburg to 0.9
twallema Jun 28, 2023
a9a55ec
incorporate pySODM changes
twallema Jun 28, 2023
9b387c5
more inclusive TDPF
twallema Jul 3, 2023
b7c0212
update calibration provincial model
twallema Jul 3, 2023
084633e
plotfit/calibrate toestanden
twallema Jul 3, 2023
52f11f4
the vaccine incidences for some weird ass reason
twallema Jul 3, 2023
908251d
calibration results
twallema Jul 5, 2023
975227c
mky
twallema Aug 20, 2023
64e52e7
mkay?
twallema Aug 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ A folder containing all raw simulations used for the RESTORE reports, the report

#### Belgian Census 2011

+ `Pop_LPW_NL_25FEB15.xlsx` contains the working population per sex, place of residence and place of work. First, the raw spreadsheet `data/covid19_DTM/raw/census_2011/Pop_LPW_NL_25FEB15.xlsx` was modified in MS Excel and placed in the data/covid19_DTM/interim folder under the name `Pop_LPW_NL_25FEB15_delete_unknown.xlsx`. Data free for download at https://census2011.fgov.be/download/downloads_nl.html .
+ `Pop_LPW_NL_25FEB15.xlsx` contains the working population per sex, place of residence and place of work. First, the raw spreadsheet `data/covid19_DTM/raw/census_2011/Pop_LPW_NL_25FEB15.xlsx` was modified in MS Excel and placed in the data/covid19_DTM/interim folder under the name `Pop_LPW_NL_25FEB15_delete_unknown.xlsx`. Data free for download at https://census2011.fgov.be/download/downloads_nl.html.
+ `census_demo_nl_04nov14.xlsx` contains all demographic data from the 2011 Belgian census. From these data, the number of individuals in 10 year age-bins per Belgian arrondissement are calculated. The conversion notebook is `notebooks/0.1-twallema-extract-census-data.ipynb`. Data free for download at https://census2011.fgov.be/download/downloads_nl.html .
+ `census_arbeidsmarkt_nl_24oct14.xlsx` contains all work related data from the 2011 Belgian census. Data free for download at https://census2011.fgov.be/download/downloads_nl.html .

Expand Down

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Binary file modified data/covid19_DTM/interim/sciensano/vacc_incidence_national.pkl
Binary file not shown.
Binary file modified data/covid19_DTM/interim/sciensano/vacc_incidence_prov.pkl
Binary file not shown.
126,264 changes: 63,132 additions & 63,132 deletions data/covid19_DTM/interim/sciensano/vacc_rescaling_values_prov.csv

Large diffs are not rendered by default.

Binary file modified data/covid19_DTM/interim/sciensano/vacc_rescaling_values_prov.pkl
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Date,Lower CI,Upper CI,Seroprevalence
23 Jul 2020,0.035,0.069,0.052
5 Aug 2020,0.031,0.066,0.048
19 Aug 2020,0.042,0.079,0.06
2 Sept 2020,0.03,0.069,0.049
16 Sept 2020,0.028,0.062,0.044
30 Sept 2020,0.03,0.069,0.048
2 Sep 2020,0.03,0.069,0.049
16 Sep 2020,0.028,0.062,0.044
30 Sep 2020,0.03,0.069,0.048
14 Oct 2020,0.038,0.077,0.057
28 Oct 2020,0.068,0.12,0.092
11 Nov 2020,0.106,0.167,0.136
Expand All @@ -29,4 +29,4 @@ Date,Lower CI,Upper CI,Seroprevalence
25 May 2021,0.575,0.651,0.611
22 Jun 2021,0.759,0.815,0.787
20 Jul 2021,0.955,0.992,0.975
1 Aug 2021,,,
1 Aug 2021,,,
22 changes: 10 additions & 12 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
name: COVID_MODEL
channels:
- defaults
- conda-forge
- defaults
dependencies:
- python=3.10
- jupyter
- python=3.11.4
- pandas
- numpy
- scipy
- numba
- xarray
- matplotlib
- numpy
- scipy
- xarray
- pandas
- emcee
- h5py
- corner
- geopandas
- zarr
- SAlib
- numba
- h5py
- tqdm
- click
29 changes: 15 additions & 14 deletions notebooks/calibration/calibrate_BASE-COVID19_SEIQRD_hybrid_vacc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
This script contains a calibration of national COVID-19 SEIQRD model to hospitalization data in Belgium.

Example function call
---------------------
Example
-------

python calibrate_BASE-COVID19_SEIQRD_hybrid_vacc.py -e 2021-08-23 -n_ag 10 -ID test
python calibrate_BASE-COVID19_SEIQRD_hybrid_vacc.py -e 2021-11-01 -n_ag 10 -ID test
"""

__author__ = "Tijs Alleman"
Expand All @@ -19,12 +19,12 @@
import ast
import click
import json
import datetime
import argparse
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import multiprocessing as mp
from datetime import date, datetime, timedelta
# COVID-19 code
from covid19_DTM.models.utils import initialize_COVID19_SEIQRD_hybrid_vacc
from covid19_DTM.data import sciensano
Expand Down Expand Up @@ -76,13 +76,15 @@
# Number of age groups used in the model
age_stratification_size=int(args.n_age_groups)
# Date at which script is started
run_date = str(datetime.date.today())
run_date = str(date.today())
# Keep track of runtime
initial_time = datetime.datetime.now()
initial_time = datetime.now()
# Start and end of calibration
start_calibration = pd.to_datetime(args.start_calibration)
start_calibration = datetime.strptime(args.start_calibration,"%Y-%m-%d")
if args.end_calibration:
end_calibration = pd.to_datetime(args.end_calibration)
end_calibration = datetime.strptime(args.end_calibration,"%Y-%m-%d")
# Leap size
tau = 0.50

##############################
## Define results locations ##
Expand Down Expand Up @@ -117,10 +119,9 @@
## Initialize the model ##
##########################

model, BASE_samples_dict, initN = initialize_COVID19_SEIQRD_hybrid_vacc(age_stratification_size=age_stratification_size, update_data=False, start_date=start_calibration.strftime("%Y-%m-%d"),
model, BASE_samples_dict, initN = initialize_COVID19_SEIQRD_hybrid_vacc(age_stratification_size=age_stratification_size, update_data=False, start_date=start_calibration,
stochastic=True, distinguish_day_type=True)

tau = 0.5
# Deterministic
model.parameters['beta'] = 0.027 # R0 = 3.31 --> https://pubmed.ncbi.nlm.nih.gov/32498136/
warmup = 0# 39 # Start 5 Feb. 2020: day of first detected COVID-19 infectee in Belgium
Expand Down Expand Up @@ -203,7 +204,7 @@
#out = pso.optimize(objective_function, bounds, kwargs={'simulation_kwargs':{'warmup': warmup}},
# swarmsize=multiplier_pso*processes, max_iter=n_pso, processes=processes, debug=True)[0]
# A good guess
theta = [0.50, 0.56, 5000, 1.40, 1.90, 0.225, 0.60]
theta = [0.50, 0.56, 5000, 1.45, 1.80, 0.225, 0.60]

# Nelder-mead
#step = len(bounds)*[0.05,]
Expand All @@ -220,10 +221,10 @@
# Assign estimate
model.parameters = assign_theta(model.parameters, pars, theta)
# Perform simulation
end_visualization = '2022-07-01'
out = model.sim([start_calibration, pd.Timestamp(end_visualization)], warmup=warmup)
end_visualization = datetime(2022, 7, 1)
out = model.sim([start_calibration, end_visualization], warmup=warmup)
# Visualize fit
ax = plot_PSO(out, data, states, start_calibration-pd.Timedelta(days=warmup), end_visualization)
ax = plot_PSO(out, data, states, start_calibration-timedelta(days=warmup), end_visualization)
plt.show()
plt.close()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This script contains a calibration of the spatial COVID-19 SEIQRD model to hospitalization data in Belgium during the period 2020-03-15 until 2021-10-07.
This script contains a calibration of the spatial COVID-19 SEIQRD model to hospitalization data in Belgium during the period 2020-03-15 until 2021-11-01.
"""

__author__ = " Tijs W. Alleman, Michiel Rollier"
Expand All @@ -21,6 +21,7 @@
import numpy as np
import matplotlib.pyplot as plt
import multiprocessing as mp
from datetime import date, datetime, timedelta
# COVID-19 code
from covid19_DTM.models.utils import initialize_COVID19_SEIQRD_spatial_hybrid_vacc
from covid19_DTM.data import sciensano
Expand Down Expand Up @@ -88,15 +89,17 @@
# Number of age groups used in the model
age_stratification_size=int(args.n_age_groups)
# Date at which script is started
run_date = str(datetime.date.today())
run_date = str(date.today())
# Keep track of runtime
initial_time = datetime.datetime.now()
initial_time = datetime.now()
# Show progress
progress=True
# Start and end of calibration
start_calibration = pd.to_datetime(args.start_calibration)
start_calibration = datetime.strptime(args.start_calibration,"%Y-%m-%d")
if args.end_calibration:
end_calibration = pd.to_datetime(args.end_calibration)
end_calibration = datetime.strptime(args.end_calibration,"%Y-%m-%d")
# Leap size
tau = 0.50

##############################
## Define results locations ##
Expand Down Expand Up @@ -136,10 +139,8 @@
## Initialize the model ##
##########################

model, BASE_samples_dict, initN = initialize_COVID19_SEIQRD_spatial_hybrid_vacc(age_stratification_size=age_stratification_size, agg=agg,
start_date=start_calibration.strftime("%Y-%m-%d"), stochastic=True,
distinguish_day_type=True)
tau = 0.50
model, BASE_samples_dict, initN = initialize_COVID19_SEIQRD_spatial_hybrid_vacc(age_stratification_size=age_stratification_size, agg=agg,start_date=start_calibration,
stochastic=True, distinguish_day_type=True)

if agg == 'arr':
# Switch to the provinicial initN
Expand Down Expand Up @@ -190,18 +191,20 @@
processes = int(os.getenv('SLURM_CPUS_ON_NODE', mp.cpu_count()/2))
multiplier_pso = 3
# MCMC settings
multiplier_mcmc = 10
multiplier_mcmc = 5
max_n = n_mcmc
print_n = 5
print_n = 10
# Define dataset
data=[df_hosp.loc[(slice(start_calibration,end_calibration), slice(None))],
df_hosp.loc[(slice(start_calibration,end_calibration), slice(None))].groupby(by=['date']).sum(),
df_sero_herzog['abs','mean'],
df_sero_sciensano['abs','mean'][:23],
df_cases]
states = ["H_in", "R", "R", "M_in"]
weights = np.array([1, 1, 1, 1])
log_likelihood_fnc = [ll_negative_binomial, ll_negative_binomial, ll_negative_binomial, ll_negative_binomial] # For arr calibration --> use poisson
states = ["H_in", "H_in", "R", "R", "M_in"]
weights = np.array([1, 1, 1, 1, 1])
log_likelihood_fnc = [ll_negative_binomial, ll_negative_binomial, ll_negative_binomial, ll_negative_binomial, ll_negative_binomial] # For arr calibration --> use poisson
log_likelihood_fnc_args = [dispersion_hosp.values,
dispersion_weighted_hosp,
dispersion_weighted_hosp,
dispersion_weighted_hosp,
dispersion_cases]
Expand Down Expand Up @@ -246,7 +249,7 @@
# out = pso.optimize(objective_function, bounds, kwargs={'simulation_kwargs':{'warmup': 0}},
# swarmsize=multiplier_pso*processes, maxiter=n_pso, processes=processes, debug=True)[0]
# A good guess
theta = [0.5, 0.56, 5000, 0.50, 0.4, 0.7, 1.4, 1.9, 0.225, 0.6]
theta = [0.5, 0.56, 5000, 0.45, 0.40, 0.70, 1.4, 1.9, 0.225, 0.6]

#######################################
## Visualize fits on multiple levels ##
Expand All @@ -257,13 +260,13 @@
print(theta)
pars_PSO = assign_theta(model.parameters, pars, theta)
model.parameters = pars_PSO
end_visualization = '2022-01-01'
end_visualization = datetime(2022, 1, 1)
# Perform simulation with best-fit results
out = model.sim([start_calibration, pd.Timestamp(end_visualization)], tau=tau)
out = model.sim([start_calibration, end_visualization], tau=tau)
# Aggregate Brussels and Brabant
out = aggregate_Brussels_Brabant_Dataset(out)
# National fit
data_star=[data[0].groupby(by=['date']).sum(), df_sero_herzog['abs','mean'], df_sero_sciensano['abs','mean'][:23], data[-1].groupby(by=['date']).sum(),]
data_star=[data[0].groupby(by=['date']).sum(), data[0].groupby(by=['date']).sum(), df_sero_herzog['abs','mean'], df_sero_sciensano['abs','mean'][:23], data[-1].groupby(by=['date']).sum(),]
ax = plot_PSO(out, data_star, states, start_calibration, end_visualization)
plt.show()
plt.close()
Expand Down Expand Up @@ -294,7 +297,7 @@
pars_PSO = assign_theta(model.parameters, pars, theta)
model.parameters = pars_PSO
# Perform simulation
out = model.sim([start_calibration, pd.Timestamp(end_visualization)], tau=tau)
out = model.sim([start_calibration, end_visualization], tau=tau)
# Aggregate Brussels and Brabant
out = aggregate_Brussels_Brabant_Dataset(out)
# Visualize national fit
Expand Down
2 changes: 1 addition & 1 deletion notebooks/calibration/emcee_sampler_to_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
smooth=1,
label_kwargs=dict(fontsize=24),
title_kwargs=dict(fontsize=14),
quantiles=[0.05, 0.95],
title_quantiles=[0.05, 0.50, 0.95],
levels=(1 - np.exp(-0.5), 1 - np.exp(-2), 1 - np.exp(-9 / 2.)),
plot_density=True,
plot_datapoints=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""

__author__ = "Tijs Alleman"
__copyright__ = "Copyright (c) 2022 by T.W. Alleman, BIOMATH, Ghent University. All Rights Reserved."
__copyright__ = "Copyright (c) 2023 by T.W. Alleman, BIOMATH, Ghent University. All Rights Reserved."

############################
## Load required packages ##
Expand All @@ -37,6 +37,7 @@
import argparse
import numpy as np
import pandas as pd
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
from covid19_DTM.models.utils import initialize_COVID19_SEIQRD_hybrid_vacc
from covid19_DTM.data import sciensano
Expand Down Expand Up @@ -67,7 +68,7 @@
################################

# Start and end of simulation
end_sim = '2022-01-01'
end_sim = datetime(2022,1,1)
# Confidence level used to visualise model fit
conf_int = 0.05

Expand All @@ -91,10 +92,10 @@
samples_dict = load_samples_dict(samples_path+str(args.agg)+'_'+str(args.identifier) + '_SAMPLES_' + str(args.date) + '.json', age_stratification_size=age_stratification_size)
warmup = samples_dict['warmup']
# Start of calibration warmup and beta
start_calibration = samples_dict['start_calibration']
start_calibration = datetime.strptime(samples_dict['start_calibration'], '%Y-%m-%d')
start_sim = start_calibration
# Last datapoint used to calibrate warmup and beta
end_calibration = samples_dict['end_calibration']
end_calibration = datetime.strptime(samples_dict['end_calibration'], '%Y-%m-%d')
# Overdispersion data
dispersion = float(samples_dict['dispersion'])

Expand Down Expand Up @@ -160,7 +161,7 @@
ax2.plot(df_2plot['H_in','mean'], color='blue', linewidth=1.5)
ax2.fill_between(simtime, df_2plot['H_in','lower'], df_2plot['H_in','upper'],alpha=0.20, color = 'blue')
ax2.scatter(df_hosp[start_calibration:end_calibration].index,df_hosp['H_in'][start_calibration:end_calibration], color='red', alpha=0.2, linestyle='None', facecolors='red', s=10)
ax2.scatter(df_hosp[pd.to_datetime(end_calibration)+datetime.timedelta(days=1):end_sim].index,df_hosp['H_in'][pd.to_datetime(end_calibration)+datetime.timedelta(days=1):end_sim], color='black', alpha=0.2, linestyle='None', facecolors='black', s=10)
ax2.scatter(df_hosp[pd.to_datetime(end_calibration)+timedelta(days=1):end_sim].index,df_hosp['H_in'][pd.to_datetime(end_calibration)+timedelta(days=1):end_sim], color='black', alpha=0.2, linestyle='None', facecolors='black', s=10)
ax2 = _apply_tick_locator(ax2)
ax2.set_xlim(start_sim,end_sim)
ax2.set_ylabel('Incidence\nHospital (-)', fontsize=13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
from covid19_DTM.data import sciensano
from covid19_DTM.visualization.output import _apply_tick_locator
# Import the function to initialize the model
from covid19_DTM.models.utils import initialize_COVID19_SEIQRD_spatial_hybrid_vacc, output_to_visuals, add_negative_binomial

#############################
## Handle script arguments ##
#############################
Expand All @@ -66,8 +68,7 @@
################################

# Start and end of simulation
start_sim = '2020-09-01'
end_sim = '2022-01-01'
end_sim = datetime(2022,1,1)
# Confidence level used to visualise model fit
conf_int = 0.05

Expand All @@ -92,11 +93,12 @@
samples_dict = load_samples_dict(samples_path+str(args.agg)+'_'+str(args.identifier) + '_SAMPLES_' + str(args.date) + '.json', age_stratification_size=age_stratification_size)
warmup = float(samples_dict['warmup'])
dispersion = float(samples_dict['dispersion'])
tau = float(samples_dict['dispersion'])
tau = float(samples_dict['tau'])
# Start of calibration warmup and beta
start_calibration = samples_dict['start_calibration']
start_calibration = datetime.strptime(samples_dict['start_calibration'], '%Y-%m-%d')
start_sim = start_calibration
# Last datapoint used to calibrate warmup and beta
end_calibration = samples_dict['end_calibration']
end_calibration = datetime.strptime(samples_dict['end_calibration'], '%Y-%m-%d')

##################################################
## Load data not needed to initialize the model ##
Expand Down Expand Up @@ -138,7 +140,7 @@

print('\n1) Simulating spatial COVID-19 SEIRD '+str(args.n_samples)+' times')
start_sim = start_calibration
out = model.sim([start_sim,end_sim], warmup=warmup, N=args.n_samples, draw_function=draw_fnc, samples=samples_dict, processes=int(args.processes), tau=0.75)
out = model.sim([start_sim,end_sim], warmup=warmup, N=args.n_samples, draw_function=draw_fnc, samples=samples_dict, processes=int(args.processes), tau=tau)
# Aggregate Brussels and Brabant
out = aggregate_Brussels_Brabant_Dataset(out)
simtime = out['date'].values
Expand Down
Loading
Loading