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

Updated sample/tutorial files #407

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ For more details on how to use `pytest` please refer to their [usage guide](http

### Formatting

We try to remain close to Python conventions and to follow the updated rules and best practices. For formatting, we use [black](https://github.com/psf/black), the _Uncompromising Code Formatter_ before submitting pull requests. It provides a consistent style, which is useful when diffing. We use a custom length of 92 characters as the baseline is short for scientific code. Here is the line to use to format your code:
We try to remain close to Python conventions and to follow the updated rules and best practices. For formatting, we use [black](https://github.com/psf/black), the _Uncompromising Code Formatter_ before submitting pull requests. It provides a consistent style, which is useful when diffing. To get started with black please refer to their [Getting Started guide](https://black.readthedocs.io/en/stable/getting_started.html). We use a custom length of 92 characters as the baseline is short for scientific code. Here is the line to use to format your code:

```bash
black --line-length 92 \
--extend-exclude 'flepimop/gempyor_pkg/src/gempyor/steps_rk4.py' \
--verbose .
```

For those using a Mac or Linux system for development this command is also available for use by calling `./dev/lint`. Similarly, you can take advantage of the formatting pre-commit hook found at `bin/pre-commit`. To start using it copy this file to your git hooks folder:
For those using a Mac or Linux system for development this command is also available for use by calling `./bin/lint`. Similarly, you can take advantage of the formatting pre-commit hook found at `bin/pre-commit`. To start using it copy this file to your git hooks folder:

```bash
cp -f bin/pre-commit .git/hooks/
Expand Down
2 changes: 2 additions & 0 deletions examples/tutorials/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# flepimop_sample

This repository mirrors the contents in the **examples/tutorial** folder of the FlepiMoP repository ([link](https://github.com/HopkinsIDD/flepiMoP/tree/main/examples/tutorials)). It can be used to try out running simple projects using `flepimop` code and as a template for new projects.
4 changes: 2 additions & 2 deletions examples/tutorials/config_sample_2pop_inference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ seir_modifiers:
method: SinglePeriodModifier
parameter: Ro
period_start_date: 2020-05-01
period_end_date: 2020-07-01
period_end_date: 2020-08-31
subpop: "all"
value:
distribution: truncnorm
Expand Down Expand Up @@ -145,7 +145,7 @@ outcome_modifiers:
# assume that due to limitations in testing, initially the case detection probability was lower
test_limits:
method: SinglePeriodModifier
parameter: incidCase
parameter: incidCase::probability
subpop: "all"
period_start_date: 2020-02-01
period_end_date: 2020-06-01
Expand Down
66 changes: 0 additions & 66 deletions examples/tutorials/config_sample_2pop_interventions_test.yml

This file was deleted.

4 changes: 2 additions & 2 deletions examples/tutorials/config_sample_2pop_modifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ seir_modifiers:
method: SinglePeriodModifier
parameter: Ro
period_start_date: 2020-05-01
period_end_date: 2020-07-01
period_end_date: 2020-08-31
subpop: "all"
value: 0.8
Ro_all:
Expand Down Expand Up @@ -105,7 +105,7 @@ outcome_modifiers:
# assume that due to limitations in testing, initially the case detection probability was lower
test_limits:
method: SinglePeriodModifier
parameter: incidCase
parameter: incidCase::probability
subpop: "all"
period_start_date: 2020-02-01
period_end_date: 2020-06-01
Expand Down
168 changes: 168 additions & 0 deletions examples/tutorials/config_sample_2pop_vaccine_scenarios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: sample_2pop
setup_name: minimal
start_date: 2020-02-01
end_date: 2020-08-31
nslots: 10

subpop_setup:
geodata: model_input/geodata_sample_2pop.csv
mobility: model_input/mobility_sample_2pop.csv

initial_conditions:
method: SetInitialConditions
initial_conditions_file: model_input/ic_2pop.csv
allow_missing_subpops: TRUE
allow_missing_compartments: TRUE

compartments:
infection_stage: ["S", "E", "I", "R", "V"]

seir:
integration:
method: rk4
dt: 1
parameters:
sigma:
value: 1 / 4
gamma:
value: 1 / 5
Ro:
value:
distribution: truncnorm
mean: 2.5
sd: 0.1
a: 1.1
b: 3
omega_pess:
value: 0.02
omega_opt:
value: 0.01
nu_pess:
value: 0.01
nu_opt:
value: 0.03
transitions:
#infections
- source: ["S"]
destination: ["E"]
rate: ["Ro * gamma"]
proportional_to: [["S"],["I"]]
proportion_exponent: ["1","1"]
# progression to infectiousness
- source: ["E"]
destination: ["I"]
rate: ["sigma"]
proportional_to: ["E"]
proportion_exponent: ["1"]
# recovery
- source: ["I"]
destination: ["R"]
rate: ["gamma"]
proportional_to: ["I"]
proportion_exponent: ["1"]
#vaccination (offers complete protection)
- source: ["S"]
destination: ["V"]
rate: ["nu_pess + nu_opt"]
proportional_to: ["S"]
proportion_exponent: ["1"]
# waning of vaccine-induced protection
- source: ["V"]
destination: ["S"]
rate: ["omega_pess + omega_opt"]
proportional_to: ["V"]
proportion_exponent: ["1"]

seir_modifiers:
scenarios:
- no_vax
- pess_vax
- opt_vax
modifiers:
pess_vax_nu: # turn off nu_opt, only nu_pess left
method: SinglePeriodModifier
parameter: nu_opt
period_start_date: 2020-02-01
period_end_date: 2020-08-31
subpop: "all"
value: 0
pess_vax_wane: # turn off omega_opt, only omega_pess left
method: SinglePeriodModifier
parameter: omega_opt
period_start_date: 2020-02-01
period_end_date: 2020-08-31
subpop: "all"
value: 0
pess_vax: # turn off all vaccination
method: StackedModifier
modifiers: ["pess_vax_nu","pess_vax_wane"]
opt_vax_nu: # turn off nu_pess, only nu_opt left
method: SinglePeriodModifier
parameter: nu_pess
period_start_date: 2020-02-01
period_end_date: 2020-08-31
subpop: "all"
value: 0
opt_vax_wane: # turn off omega_pess, only omega_opt left
method: SinglePeriodModifier
parameter: omega_pess
period_start_date: 2020-02-01
period_end_date: 2020-08-31
subpop: "all"
value: 0
opt_vax: # turn off all vaccination
method: StackedModifier
modifiers: ["opt_vax_nu","opt_vax_wane"]
no_vax: # turn off all vaccination
method: StackedModifier
modifiers: ["pess_vax","opt_vax"]



outcomes:
method: delayframe
outcomes:
incidCase: #incidence of detected cases
source:
incidence:
infection_stage: "I"
probability:
value:
distribution: truncnorm
mean: 0.5
sd: 0.05
a: 0.3
b: 0.7
delay:
value: 5
incidHosp: #incidence of hospitalizations
source:
incidence:
infection_stage: "I"
probability:
value: 0.05
delay:
value: 7
duration:
value: 10
name: currHosp # will track number of current hospitalizations (ie prevalence)
incidDeath: #incidence of deaths
source: incidHosp
probability:
value: 0.2
delay:
value: 14

# outcome_modifiers:
# scenarios:
# - test_limits
# modifiers:
# # assume that due to limitations in testing, initially the case detection probability was lower
# test_limits:
# method: SinglePeriodModifier
# parameter: incidCase::probability
# subpop: "all"
# period_start_date: 2020-02-01
# period_end_date: 2020-06-01
# value: 0.5

This file was deleted.

Loading