-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow simulations until Nov 2021 at least. #127
Open
roecla
wants to merge
12
commits into
main
Choose a base branch
from
prep-for-longer-simulation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4537a64
Require Pytask >= 0.1.0
roecla 634d35b
Update vacations.
roecla 3f4cc18
Update COSMO data on frequency of rapid tests.
roecla e18afff
Remove unused module.
roecla 464d3bd
Extend how long time series are plotted and extend some time series.
roecla c4cf454
Add new time period and summer baseline scenario.
roecla 6ec43c4
Adjust share of tests going to symptomatics to new RKI format. Make 2…
roecla ef7aa8f
Plot new scenario.
roecla eca0a58
Add that only individuals that have not received a PCR test within th…
roecla c187ab2
Update policies.
roecla 89264f7
Plot difference between simulated and empirical incidence for the com…
roecla 4442125
Remove old other multiplier entries.
roecla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
src/plotting/task_plot_difference_btw_simulated_and_empirical_incidences.py
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,48 @@ | ||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
import pytask | ||
|
||
from src.config import BLD | ||
from src.config import SRC | ||
from src.plotting.plotting import BLUE | ||
from src.plotting.plotting import plot_incidences | ||
from src.simulation.scenario_config import create_path_to_scenario_outcome_time_series | ||
|
||
_DEPENDENCIES = { | ||
"scenario_config.py": SRC / "simulation" / "scenario_config.py", | ||
"plotting.py": SRC / "plotting" / "plotting.py", | ||
"empirical": BLD / "data" / "empirical_data_for_plotting.pkl", | ||
} | ||
|
||
|
||
SIM_DATA_PATH = create_path_to_scenario_outcome_time_series( | ||
scenario_name="combined_baseline", entry="new_known_case" | ||
) | ||
|
||
if SIM_DATA_PATH.exists(): | ||
_DEPENDENCIES["simulated"] = SIM_DATA_PATH | ||
|
||
|
||
@pytask.mark.skipif( | ||
not SIM_DATA_PATH.exists(), reason="combined_baseline data does not exist." | ||
) | ||
@pytask.mark.depends_on(_DEPENDENCIES) | ||
@pytask.mark.produces( | ||
BLD / "figures" / "diff_btw_simulated_and_empirical_case_numbers.pdf" | ||
) | ||
def task_plot_difference_btw_official_and_simulated_cases(depends_on, produces): | ||
empirical = pd.read_pickle(depends_on["empirical"]) | ||
simulated = pd.read_pickle(depends_on["simulated"]) | ||
diff = simulated.subtract(empirical.loc[simulated.index, "new_known_case"], axis=0) | ||
fig, ax = plot_incidences( | ||
incidences={"": diff}, | ||
title="Difference Between Simulated and Empirical Case Numbers", | ||
ylabel="difference between simulated and empirical case numbers", | ||
name_to_label={"": ""}, | ||
colors=[BLUE], | ||
n_single_runs=-1, | ||
) | ||
ax.set_xlim(pd.Timestamp("2020-09-01"), pd.Timestamp("2021-07-01")) | ||
fig.tight_layout() | ||
fig.savefig(produces) | ||
plt.close() |
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This possible problem came up in a review on sid today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which problem are you referring to?