Skip to content
Open
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
28 changes: 14 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v6.0.0
hooks:
- id: check-added-large-files
args: ['--maxkb=25']
Expand All @@ -17,7 +17,7 @@ repos:
args: [--branch, main]
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
Expand All @@ -28,37 +28,37 @@ repos:
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.16.0
hooks:
- id: reorder-python-imports
types: [python]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.19.0
rev: v3.2.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/psf/black
rev: 21.10b0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.1.0
hooks:
- id: black
types: [python]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.1.1
rev: 1.9.1
hooks:
- id: nbqa-black
- id: nbqa-pyupgrade
- id: nbqa-isort
- repo: https://github.com/asottile/blacken-docs
rev: v1.11.0
rev: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies: [black]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 7.3.0
hooks:
- id: flake8
types: [python]
Expand All @@ -77,16 +77,16 @@ repos:
Pygments,
]
- repo: https://github.com/PyCQA/doc8
rev: 0.9.1
rev: v2.0.0
hooks:
- id: doc8
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
rev: 1.7.0
hooks:
- id: interrogate
args: [-v, --fail-under=25, src, tests]
- repo: https://github.com/mgedmin/check-manifest
rev: "0.47"
rev: "0.51"
hooks:
- id: check-manifest
- repo: meta
Expand Down
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
import sys


sys.path.insert(0, os.path.abspath("../.."))


Expand Down
10 changes: 2 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@ long_description = file: README.rst
long_description_content_type = text/x-rst
author = Janos Gabler, Tobias Raabe, Klara Röhrl
license = MIT
license_file = LICENSE
license_files = LICENSE
classifiers =
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

[options]
packages = find:
python_requires = >=3.6.1
python_requires = >=3.10
include_package_data = True
package_dir =
= .
Expand Down
1 change: 0 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from src import simulation


try:
from ._version import version as __version__
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
REMOVE EVERYTHING THAT IMPORTS THE VARIABLE YOU CHANGED.
"""

import warnings
from pathlib import Path

Expand Down
1 change: 0 additions & 1 deletion src/contact_models/contact_model_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from src.shared import from_epochs_to_timestamps


IS_POSITIVE_CASE = (
"knows_infectious | (knows_immune & symptomatic) "
"| (knows_immune & (cd_received_test_result_true >= -13))"
Expand Down
2 changes: 1 addition & 1 deletion src/contact_models/task_create_contact_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def measure_of_diff_btw_distributions(params, old_distribution, desired_total):
"""
assert (params.index == old_distribution.index).all()
params_deviation = params["value"].to_numpy() - old_distribution.to_numpy()
params_penalty = (params_deviation ** 2).sum()
params_penalty = (params_deviation**2).sum()
actual_total = params.index.to_numpy() @ params["value"].to_numpy()
total_contacts_penalty = (desired_total - actual_total) ** 2
cost = total_contacts_penalty + params_penalty
Expand Down
6 changes: 3 additions & 3 deletions src/create_initial_states/create_contact_model_group_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class with 23 individuals of the same age. Classes meet their peers and 3 pairs
df[educ_group_cols] = df[educ_group_cols].astype("category")

# the stays_home_when_schools_close variable is not used yet.
df[
"stays_home_when_schools_close"
] = _identify_adult_staying_home_when_schools_close(df)
df["stays_home_when_schools_close"] = (
_identify_adult_staying_home_when_schools_close(df)
)

df = df.drop(columns=["pos_in_group", "one", "group_size"])
return df
Expand Down
1 change: 1 addition & 0 deletions src/create_initial_states/create_group_transition_probs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This module is copied from sid commit 206886a14eeb3257deb71db91aba4e7fb2385fc2.
"""

import string

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/create_initial_states/create_vaccination_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
- shares of each group: https://bit.ly/3cb5uUQ
"""

import numpy as np
import pandas as pd

Expand Down
6 changes: 3 additions & 3 deletions src/create_initial_states/task_build_full_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ def _add_rapid_test_reaction_params(params):
"""
params = params.copy(deep=True)
params.loc[
("rapid_test_demand", "reaction", "hh_contacts_multiplier"), "value"
] = 0.7
params.loc[("rapid_test_demand", "reaction", "hh_contacts_multiplier"), "value"] = (
0.7
)
params.loc[
("rapid_test_demand", "reaction", "not_hh_contacts_multiplier"), "value"
] = 0.15
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create a synthetic population that is representative of Germany."""

from pathlib import Path

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion src/plotting/msm_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from src.plotting.plotting import format_date_axis


plt.rcParams.update(
{
"axes.spines.right": False,
Expand Down
1 change: 0 additions & 1 deletion src/plotting/task_create_empirical_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from src.config import BLD
from src.config import SRC


_DEPENDENCIES = {
"rki": BLD / "data" / "processed_time_series" / "rki.pkl",
"cosmo_ever_rapid_test": SRC
Expand Down
2 changes: 1 addition & 1 deletion src/plotting/task_plot_decomposition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module holds the code to compute marginal contributions and shapley values."""

from typing import Dict

import matplotlib
Expand All @@ -21,7 +22,6 @@
from src.simulation.scenario_config import get_available_scenarios
from src.simulation.scenario_config import get_named_scenarios


_CHANNEL_SCENARIOS_TO_MEMBERS = {
"spring_baseline": frozenset(["rapid_tests", "vaccinations", "seasonality"]),
"spring_without_rapid_tests_and_no_vaccinations": frozenset(["seasonality"]),
Expand Down
2 changes: 1 addition & 1 deletion src/plotting/task_plot_incidences_by_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""For each available scenario plot the incidences in each of the age groups."""

import matplotlib.pyplot as plt
import pandas as pd
import pytask
Expand All @@ -15,7 +16,6 @@
create_path_to_scenario_outcome_time_series,
)


_DEPENDENCIES = {
"calculate_moments.py": SRC / "calculate_moments.py",
"plotting.py": SRC / "plotting" / "plotting.py",
Expand Down
1 change: 0 additions & 1 deletion src/plotting/task_plot_scenario_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from src.simulation.scenario_config import get_available_scenarios
from src.simulation.scenario_config import get_named_scenarios


_MODULE_DEPENDENCIES = {
"plotting.py": SRC / "plotting" / "plotting.py",
"policy_tools.py": SRC / "policies" / "policy_tools.py",
Expand Down
1 change: 1 addition & 0 deletions src/plotting/task_plot_share_known_cases.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create plots, illustrating the share known cases over time."""

import matplotlib.pyplot as plt
import pandas as pd
import pytask
Expand Down
1 change: 0 additions & 1 deletion src/plotting/task_plot_vaccinated_shares.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from src.simulation.scenario_config import get_available_scenarios
from src.simulation.scenario_config import get_named_scenarios


NAMED_SCENARIOS = get_named_scenarios()
AVAILABLE_SCENARIOS = get_available_scenarios(NAMED_SCENARIOS)
VACCINATION_SCENARIOS = sorted(
Expand Down
1 change: 1 addition & 0 deletions src/policies/domain_level_policy_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
The functions here expect that the domain names are part of contact model names.
"""

from functools import partial

from src.policies.single_policy_functions import mixed_educ_policy
Expand Down
1 change: 1 addition & 0 deletions src/policies/policy_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools to work with policy dictionaries without accidentally modifying them."""

import itertools

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions src/policies/single_policy_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
All other arguments must be documented.
"""

import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
Expand Down
1 change: 1 addition & 0 deletions src/policies/task_create_work_multiplier_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
people still go to work.
"""

import warnings
from zipfile import ZipFile

Expand Down
1 change: 0 additions & 1 deletion src/policies/task_plot_multipliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from src.simulation.seasonality import create_seasonality_series
from src.testing.shared import get_piecewise_linear_interpolation


_DEPENDENCIES = {
# modules
"plotting.py": SRC / "plotting" / "plotting.py",
Expand Down
1 change: 0 additions & 1 deletion src/prepare_data/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pandas as pd
from sid.contacts import _sum_preserving_round


# ---------------------------------- Contact Models ----------------------------------


Expand Down
1 change: 0 additions & 1 deletion src/prepare_data/task_prepare_mossong_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from src.shared import create_age_groups
from src.shared import load_dataset


LOCATIONS = [
"cnt_home",
"cnt_work",
Expand Down
2 changes: 1 addition & 1 deletion src/prepare_data/task_prepare_rki_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- https://covid19-de-stats.sourceforge.io/rki-fall-tabelle.html

"""

from datetime import datetime
from datetime import timedelta

Expand All @@ -22,7 +23,6 @@

from src.config import BLD


DROPPPED_COLUMNS = [
"IdBundesland",
"Landkreis",
Expand Down
1 change: 0 additions & 1 deletion src/prepare_data/task_prepare_vaccination_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from src.config import POPULATION_GERMANY
from src.plotting.plotting import style_plot


plt.rcParams.update(
{
"axes.spines.right": False,
Expand Down
1 change: 0 additions & 1 deletion src/prepare_data/task_prepare_virus_variant_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from src.config import SRC
from src.testing.shared import get_date_from_year_and_week


STRAIN_FILES = {
"rki_strains": BLD / "data" / "virus_strains" / "rki_strains.csv",
"virus_shares_dict": BLD / "data" / "virus_strains" / "virus_shares_dict.pkl",
Expand Down
1 change: 0 additions & 1 deletion src/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pandas as pd
from sid.contacts import _sum_preserving_round


# ---------------------------------- Contact Models ----------------------------------


Expand Down
1 change: 1 addition & 0 deletions src/simulation/scenario_simulation_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- rapid_test_reaction_models
"""

from functools import partial

import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion src/simulation/task_process_simulation_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from src.simulation.scenario_config import INCIDENCE_OUTCOMES
from src.simulation.scenario_config import NON_INCIDENCE_OUTCOMES


_MODULE_DEPENDENCIES = {
"calculate_moments.py": SRC / "calculate_moments.py",
"load_simulation_inputs.py": SRC / "simulation" / "load_simulation_inputs.py",
Expand Down
1 change: 1 addition & 0 deletions src/testing/rapid_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for rapid tests."""

import warnings

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/testing/testing_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PCR testing model for sid."""

import warnings

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion tests/test_params_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
)
from src.testing.shared import get_piecewise_linear_interpolation


SCENARIO_FUNCS = [func for name, func in get_params_scenarios()]


Expand Down
1 change: 0 additions & 1 deletion tests/test_testing_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from src.testing.testing_models import allocate_tests
from src.testing.testing_models import process_tests


DATE = pd.Timestamp("2020-10-10")


Expand Down
Loading