From 41052eba6ff4a8f15570d0f9cfa63818fb8e34cf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 12:27:38 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../_static/images/make_infectiousness_period.ipynb | 2 +- docs/source/_static/images/make_time_until_death.ipynb | 2 +- .../_static/images/make_time_until_icu_recovery.ipynb | 2 +- docs/source/explanations/assortative_matching.ipynb | 1 - docs/source/reference_guides/events.rst | 1 - docs/source/tutorials/how_to_model_immunity.ipynb | 2 -- setup.cfg | 8 ++------ src/sid/contacts.py | 1 - src/sid/initial_conditions.py | 1 - src/sid/msm.py | 2 +- src/sid/update_states.py | 2 +- 11 files changed, 7 insertions(+), 17 deletions(-) diff --git a/docs/source/_static/images/make_infectiousness_period.ipynb b/docs/source/_static/images/make_infectiousness_period.ipynb index 98714fd3..511d3c14 100644 --- a/docs/source/_static/images/make_infectiousness_period.ipynb +++ b/docs/source/_static/images/make_infectiousness_period.ipynb @@ -126,7 +126,7 @@ "source": [ "dist_mean = 2 * 0.12 + 4 * 0.29 + 6 * 0.47 + 10 * 0.12\n", "dist_var = (\n", - " 2 ** 2 * 0.12 + 4 ** 2 * 0.29 + 6 ** 2 * 0.47 + 10 ** 2 * 0.12 - dist_mean ** 2\n", + " 2**2 * 0.12 + 4**2 * 0.29 + 6**2 * 0.47 + 10**2 * 0.12 - dist_mean**2\n", ")\n", "dist_std = np.sqrt(dist_var)\n", "dist_mean, dist_std" diff --git a/docs/source/_static/images/make_time_until_death.ipynb b/docs/source/_static/images/make_time_until_death.ipynb index 2b256418..c156451e 100644 --- a/docs/source/_static/images/make_time_until_death.ipynb +++ b/docs/source/_static/images/make_time_until_death.ipynb @@ -41,7 +41,7 @@ "source": [ "mean = 11.74\n", "std = 8.79\n", - "var = 8.79 ** 2\n", + "var = 8.79**2\n", "\n", "print(mean, std)" ] diff --git a/docs/source/_static/images/make_time_until_icu_recovery.ipynb b/docs/source/_static/images/make_time_until_icu_recovery.ipynb index acbe7ad4..59159f00 100644 --- a/docs/source/_static/images/make_time_until_icu_recovery.ipynb +++ b/docs/source/_static/images/make_time_until_icu_recovery.ipynb @@ -41,7 +41,7 @@ "source": [ "mean = 18.8\n", "std = 12.21\n", - "var = std ** 2\n", + "var = std**2\n", "\n", "print(mean, std)" ] diff --git a/docs/source/explanations/assortative_matching.ipynb b/docs/source/explanations/assortative_matching.ipynb index b44da555..cbfa0407 100644 --- a/docs/source/explanations/assortative_matching.ipynb +++ b/docs/source/explanations/assortative_matching.ipynb @@ -331,7 +331,6 @@ "\n", "data = {}\n", "for value in assortative_matching_params:\n", - "\n", " # Change assortative matching in params.\n", " params.loc[(\"assortative_matching\", \"meet_people\", \"group\"), \"value\"] = value\n", "\n", diff --git a/docs/source/reference_guides/events.rst b/docs/source/reference_guides/events.rst index e312166a..0df07c51 100644 --- a/docs/source/reference_guides/events.rst +++ b/docs/source/reference_guides/events.rst @@ -66,7 +66,6 @@ day from contacts and multiple events are merged with a logical OR. newly_infected = pd.Series(data=False, index=states.index) if date == date_of_carnival_session: - adults_in_heinsberg = states.query( "county == 'Kreis Heinsberg' and age_group >= '10 - 19'" ).index diff --git a/docs/source/tutorials/how_to_model_immunity.ipynb b/docs/source/tutorials/how_to_model_immunity.ipynb index d8e0f3ba..2f443355 100644 --- a/docs/source/tutorials/how_to_model_immunity.ipynb +++ b/docs/source/tutorials/how_to_model_immunity.ipynb @@ -583,7 +583,6 @@ "\n", "df_dict = {}\n", "for value in resistance_factors:\n", - "\n", " # update the immunity resistance factor\n", " params.loc[(\"virus_strain\", \"b117\", \"immunity_resistance_factor\"), \"value\"] = value\n", "\n", @@ -636,7 +635,6 @@ "value_to_ax = {0: 5, 0.5: 6, 1: 7}\n", "\n", "for value, color in [(0, \"tab:blue\"), (0.5, \"tab:green\"), (1, \"tab:orange\")]:\n", - "\n", " df_dict[value].resample(\"D\", on=\"date\")[\"ever_infected\"].mean().plot(\n", " ax=axs[0], color=color, label=value\n", " )\n", diff --git a/setup.cfg b/setup.cfg index 85391e77..a03fc2e3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ url = https://github.com/covid-19-impact-lab/sid author = Janos Gabler, Tobias Raabe, Klara Roehrl author_email = janos.gabler@gmail.com license = MIT -license_file = LICENSE +license_files = LICENSE platforms = any classifiers = Development Status :: 3 - Alpha @@ -16,10 +16,6 @@ classifiers = Operating System :: OS Independent 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 Topic :: Scientific/Engineering project_urls = Changelog = https://sid-dev.readthedocs.io/en/latest/changes.html @@ -41,7 +37,7 @@ install_requires = python-snappy seaborn tqdm -python_requires = >=3.6 +python_requires = >=3.8 include_package_data = True package_dir = =src diff --git a/src/sid/contacts.py b/src/sid/contacts.py index c3399e88..f7ca4dd6 100644 --- a/src/sid/contacts.py +++ b/src/sid/contacts.py @@ -740,7 +740,6 @@ def _sum_preserving_round(arr): deviation = 0 for i in range(len(arr)): - floor_value = int(arr[i]) deviation += arr[i] - floor_value diff --git a/src/sid/initial_conditions.py b/src/sid/initial_conditions.py index c7fb79c3..8c8e19a3 100644 --- a/src/sid/initial_conditions.py +++ b/src/sid/initial_conditions.py @@ -255,7 +255,6 @@ def sample_initial_distribution_of_infections_and_immunity( states = update_derived_state_variables(states, derived_state_variables) for burn_in_date in initial_conditions["burn_in_periods"]: - states["date"] = burn_in_date states["period"] = timestamp_to_sid_period(burn_in_date) diff --git a/src/sid/msm.py b/src/sid/msm.py index 175e5b92..11ac6c0d 100644 --- a/src/sid/msm.py +++ b/src/sid/msm.py @@ -156,7 +156,7 @@ def _msm( moment_errors = flat_simulated_moments - flat_empirical_moments root_contribs = np.sqrt(np.diagonal(weighting_matrix)) * moment_errors - value = np.sum(root_contribs ** 2) + value = np.sum(root_contribs**2) out = { "value": value, diff --git a/src/sid/update_states.py b/src/sid/update_states.py index 36ac3819..468f8873 100644 --- a/src/sid/update_states.py +++ b/src/sid/update_states.py @@ -289,7 +289,7 @@ def _get_waning_immunity_coefficients( ("immunity", "immunity_waning", f"slope_after_maximum_{event}"), "value" ] - slope_before_maximum = maximum_immunity / (time_to_reach_maximum ** 3) + slope_before_maximum = maximum_immunity / (time_to_reach_maximum**3) intercept_after_maximum = ( maximum_immunity - slope_after_maximum * time_to_reach_maximum )