fix: Replaced magic number herd immunity with variable
This commit is contained in:
parent
548eebfc96
commit
e13e8f1df6
1 changed files with 10 additions and 11 deletions
21
plot.py
21
plot.py
|
@ -103,10 +103,9 @@ def calculate_vaccination_data(data):
|
||||||
else:
|
else:
|
||||||
vaccinations_by_week[w] = v
|
vaccinations_by_week[w] = v
|
||||||
|
|
||||||
|
|
||||||
def extrapolate(rate, to_be_vaccinated):
|
def extrapolate(rate, to_be_vaccinated):
|
||||||
days_extrapolated = int(np.ceil(to_be_vaccinated / rate))
|
days_extrapolated = int(np.ceil(to_be_vaccinated / rate))
|
||||||
days_extrapolated_herd_immunity = int(np.ceil((einwohner_deutschland * 0.7 - total) / rate))
|
days_extrapolated_herd_immunity = int(np.ceil((einwohner_deutschland * herd_immunity - total) / rate))
|
||||||
|
|
||||||
weeks_extrapolated = int(np.ceil(days_extrapolated / 7))
|
weeks_extrapolated = int(np.ceil(days_extrapolated / 7))
|
||||||
weeks_extrapolated_herd_immunity = int(np.ceil(days_extrapolated_herd_immunity / 7))
|
weeks_extrapolated_herd_immunity = int(np.ceil(days_extrapolated_herd_immunity / 7))
|
||||||
|
@ -138,7 +137,7 @@ def calculate_vaccination_data(data):
|
||||||
mean_vaccination_rates_daily = np.round(cumulative / range(1, len(cumulative) + 1))
|
mean_vaccination_rates_daily = np.round(cumulative / range(1, len(cumulative) + 1))
|
||||||
vaccination_rates_daily_rolling_average = data.rolling(7).mean()
|
vaccination_rates_daily_rolling_average = data.rolling(7).mean()
|
||||||
|
|
||||||
vaccinations_missing_until_target = einwohner_deutschland * 0.7 - total
|
vaccinations_missing_until_target = einwohner_deutschland * herd_immunity - total
|
||||||
vaccination_rate_needed_for_target = vaccinations_missing_until_target / days_until_target
|
vaccination_rate_needed_for_target = vaccinations_missing_until_target / days_until_target
|
||||||
vaccination_rate_needed_for_target_percentage = mean_all_time / vaccination_rate_needed_for_target * 100
|
vaccination_rate_needed_for_target_percentage = mean_all_time / vaccination_rate_needed_for_target * 100
|
||||||
|
|
||||||
|
@ -678,8 +677,8 @@ def plot_vaccination_done_days():
|
||||||
)
|
)
|
||||||
d = data_first_vaccination
|
d = data_first_vaccination
|
||||||
|
|
||||||
days_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily']))
|
days_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily']))
|
||||||
days_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
|
days_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
|
||||||
|
|
||||||
ax.set_xlim(start_of_reporting_date, today)
|
ax.set_xlim(start_of_reporting_date, today)
|
||||||
ax.set_ylim(0, 2500)
|
ax.set_ylim(0, 2500)
|
||||||
|
@ -722,8 +721,8 @@ def plot_vaccination_done_weeks():
|
||||||
)
|
)
|
||||||
d = data_first_vaccination
|
d = data_first_vaccination
|
||||||
|
|
||||||
weeks_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily'])) / 7
|
weeks_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily'])) / 7
|
||||||
weeks_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) / 7
|
weeks_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) / 7
|
||||||
|
|
||||||
ax.set_xlim(datetime.date(2021, 3, 1), today)
|
ax.set_xlim(datetime.date(2021, 3, 1), today)
|
||||||
ax.set_ylim(0, 52)
|
ax.set_ylim(0, 52)
|
||||||
|
@ -765,8 +764,8 @@ def plot_vaccination_done_dates():
|
||||||
)
|
)
|
||||||
d = data_first_vaccination
|
d = data_first_vaccination
|
||||||
|
|
||||||
days_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily']))
|
days_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily']))
|
||||||
days_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
|
days_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
|
||||||
|
|
||||||
dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily]
|
dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily]
|
||||||
dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()]
|
dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()]
|
||||||
|
@ -811,8 +810,8 @@ def plot_vaccination_done_dates_detail():
|
||||||
)
|
)
|
||||||
d = data_first_vaccination
|
d = data_first_vaccination
|
||||||
|
|
||||||
days_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily']))
|
days_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily']))
|
||||||
days_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
|
days_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
|
||||||
|
|
||||||
dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily]
|
dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily]
|
||||||
dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()]
|
dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()]
|
||||||
|
|
Loading…
Reference in a new issue