Skip to content

Commit

Permalink
2020-04-15: new data, updated documentation on loglog, raten plot
Browse files Browse the repository at this point in the history
  • Loading branch information
koepferl committed Apr 15, 2020
1 parent 7fb9cc4 commit 7036cc3
Show file tree
Hide file tree
Showing 105 changed files with 45,442 additions and 10 deletions.
Binary file modified DT_Bavaria.pdf
Binary file not shown.
41 changes: 41 additions & 0 deletions Documentation_COVID19_Local.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@
"Note: The raw data contains the individal cases transmitted by the local authorities to the RKI. For certain counties the number of cases for a certain day are corrected afterwards. Therefore it is possible that the doubling time variates in the DT.pdf when comparing different days. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Log-Log Plot\n",
"\n",
"The number of total cases until a certain day (y axis) is plotted against the number of new cases in the past week for a certain day (x axis). Once there are fewer new infections the curve will drop downwards. Once this drops steep the uncontroled exponential growth is broken. You can see a beginning trend for with high DTs.\n",
" Compare with https://www.youtube.com/watch?v=54XLXg4fYsc and https://aatishb.com/covidtrends/\n",
" \n",
"=> see ``loglog_Bavaria.pdf`` on https://github.com/koepferl/COVID19Dahoam/blob/master/loglog_Bavaria.pdf \n",
"\n",
"![title](loglog_Bavaria.pdf)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -339,6 +353,33 @@
" The number of total cases until a certain day (y axis) is plotted against the number of new cases in the past week for a certain day (x axis). Once there are fewer new infections the curve will drop downwards. Once this drops steep the uncontroled exponential growth is broken. You can see a beginning trend for with high DTs.\n",
" Compare with https://www.youtube.com/watch?v=54XLXg4fYsc and https://aatishb.com/covidtrends/\n",
"\n",
"### Dataset downloaded 2020-04-15\n",
"\n",
"* DT evolution https://github.com/koepferl/COVID19Dahoam/blob/master/DT_Bavaria.pdf: \n",
" Most counties have now higher doubling times (average is 27.60 d), isolation works. Stay put.\n",
" * Counties smaller than 10 days (the larger the better): \n",
"\n",
" * 9.37 11.4 LK Altoetting\n",
" * 9.23 14.4 LK Amberg-Sulzbach\n",
" * 9.06 13.4 LK Dillingen a.d.Donau\n",
"\n",
" * Counties larger than 40 days (the larger the better):\n",
" * 54.39 14.4 LK Weilheim-Schongau\n",
" * 51.60 14.4 LK Fueth\n",
" * 49.50 14.4 LK Bamberg\n",
" * 45.49 13.4 SK Aschaffenburg\n",
" * 45.44 14.4 LK Cham\n",
" * 43.54 14.4 LK Fuestenfeldbruck\n",
" * 42.68 13.4 LK Miesbach\n",
"\n",
"\n",
"* Semi-log plots https://github.com/koepferl/COVID19Dahoam/tree/master/plots: \n",
"\n",
" Counties with very low DTs show also no flattening; with high DT almost a horizontal trend.\n",
" \n",
"* loglog plot https://github.com/koepferl/COVID19Dahoam/blob/master/loglog_Bavaria.pdf: \n",
"\n",
" \n",
"More interpretation follows tomorrow.\n",
"\n",
"## Recommendation\n",
Expand Down
38 changes: 37 additions & 1 deletion Documentation_COVID19_Local_German.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Vorsicht: Die ursprünglichen Daten setzen sich aus denn eigentlichen Fallmeldungen der Gesundheitsämter zusammen, welche an das RKI übermittelt werden. Einige Kreise korregieren die Fallzahlen nachträglich und manchmal erst nach einigen Tagen. Deshalb kann es passieren, dass die berechnete Verdopplungszeit in der DT.pdf variiert, wenn man die PDF der einzelnen Tage vergleicht. "
"Vorsicht: Die ursprünglichen Daten setzen sich aus denn eigentlichen Fallmeldungen der Gesundheitsämter zusammen, welche an das RKI übermittelt werden. Einige Kreise korregieren die Fallzahlen nachträglich und manchmal erst nach einigen Tagen. Deshalb kann es passieren, dass die berechnete Verdopplungszeit in der DT.pdf variiert, wenn man die PDF der einzelnen Tage vergleicht. \n",
"\n",
"## Log-log Diagramm\n",
"\n",
"Die Gesamtzahl der Fallzahlen an einem bestimmten Tag (y Achse) wurde gegen die Fallzahlen der letzten Woche für diesen Tag (x Achse) aufgetragen. Sobald es weniger Infektionen gibt fällt die Kurve ab. Ein besonders starker abfall wird erwartet, wenn das uncontrollierte exponentielle Wachstum beendet ist. Man sieht schon einen beginnenden Trend für Kreise mit sehr hohen DTs.\n",
" Siehe auch https://www.youtube.com/watch?v=54XLXg4fYsc and https://aatishb.com/covidtrends/\n",
" \n",
"=> siehe ``loglog_Bavaria.pdf`` auf https://github.com/koepferl/COVID19Dahoam/blob/master/loglog_Bavaria.pdf \n",
"\n",
"![title](loglog_Bavaria.pdf)"
]
},
{
Expand Down Expand Up @@ -325,6 +334,33 @@
" Die Gesamtzahl der Fallzahlen an einem bestimmten Tag (y Achse) wurde gegen die Fallzahlen der letzten Woche für diesen Tag (x Achse) aufgetragen. Sobald es weniger Infektionen gibt fällt die Kurve ab. Ein besonders starker abfall wird erwartet, wenn das uncontrollierte exponentielle Wachstum beendet ist. Man sieht schon einen beginnenden Trend für Kreise mit sehr hohen DTs.\n",
" Siehe auch https://www.youtube.com/watch?v=54XLXg4fYsc and https://aatishb.com/covidtrends/\n",
"\n",
"### Datendownload 2020-04-15\n",
"\n",
"* DT Entwicklung https://github.com/koepferl/COVID19Dahoam/blob/master/DT_Bavaria.pdf: \n",
" Die meisten Kreise haben höhere Verdopplungszeiten (Durchschnitt ist 27.60 Tage), Isolation funktioniert. Bleibt dahoam.\n",
" * Kreise mit Verdopplungszeiten (DT) kleiner als 10 Tage (je länger desto besser): \n",
" * 9.37 11.4 LK Altoetting\n",
" * 9.23 14.4 LK Amberg-Sulzbach\n",
" * 9.06 13.4 LK Dillingen a.d.Donau\n",
" * Kreise mit Verdopplungszeiten (DT) größer als 40 Tage (je länger desto besser):\n",
" * 54.39 14.4 LK Weilheim-Schongau\n",
" * 51.60 14.4 LK Fueth\n",
" * 49.50 14.4 LK Bamberg\n",
" * 45.49 13.4 SK Aschaffenburg\n",
" * 45.44 14.4 LK Cham\n",
" * 43.54 14.4 LK Fuestenfeldbruck\n",
" * 42.68 13.4 LK Miesbach\n",
"\n",
" \n",
"* Semi-log plots https://github.com/koepferl/COVID19Dahoam/tree/master/plots: \n",
"\n",
" Kreise mit sehr niedrigen DTs werden nicht/kaum flacher; mit sehr großen DTs ist der Verlauf fast horizontal. \n",
" \n",
" \n",
"* loglog plot https://github.com/koepferl/COVID19Dahoam/blob/master/loglog_Bavaria.pdf: \n",
"\n",
" Man sieht schon einen beginnenden Abwärtstrend für Kreise mit sehr hohen DTs.\n",
"\n",
"\n",
"Mehr Diskussion folgt morgen.\n",
"\n",
Expand Down
57 changes: 49 additions & 8 deletions cov19_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ def plot_corona(num_dic, day, month, name, ID, geraet_min=None, geraet_max=None,
val_DT : list
list containing the calculated day-depending doubling times
rates : list
list containing rates (mortality rate, recovery rate, still ill rate)
'''
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -396,8 +399,12 @@ def func(x, a, b):#, c):
#raise Exception('stop')


rates = {'death_rate': num_tod / num * 100,
'recover_rate': num_gesund / num * 100,
'ill_rate': (num - num_gesund - num_tod) / num * 100,
'day': day}

return [name, day[7:], DTs, Ntot_today, Ntot_week]
return [name, day[7:], DTs, Ntot_today, Ntot_week, rates]

#####################################
# Doubeling Time (Verdopplungszeit) #
Expand All @@ -423,6 +430,10 @@ def plot_DT(DT, state, ncol=4, nrow=3):
val_DT : list
list containing the calculated day-depending doubling times
rates : list
list containing rates (mortality rate, recovery rate, still ill rate)
state : list
output from load_RKI
Expand Down Expand Up @@ -484,6 +495,7 @@ def func(x, a, b):#, c):

fig, axs = plt.subplots(nrow, ncol, figsize=(28,21))
fig2, axs2 = plt.subplots(nrow, ncol, figsize=(28,21))
fig3, axs3 = plt.subplots(nrow, ncol, figsize=(28,21))
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0.1, hspace=0.1)
axs[0,0].set_title('Entwicklung der Verdopplungszeiten auf Kreisebene')
axs[0,1].set_title('Evolution of the Doubeling Time for German Counties')
Expand Down Expand Up @@ -523,61 +535,73 @@ def func(x, a, b):#, c):
if i in range(0, 8):
ax = axs[0,0]
ax2 = axs2[0,0]
ax3 = axs3[0,0]
line_col = 20 + 30 * (8 - i)

if i in range(8, 16):
ax = axs[0,1]
ax2 = axs2[0,1]
ax3 = axs3[0,1]
line_col = 20 + 30 * (16 - i)

if i in range(16,24):
ax = axs[0,2]
ax2 = axs2[0,2]
ax3 = axs3[0,2]
line_col = 20 + 30 * (24 - i)

if i in range(24,32):
ax = axs[0,3]
ax2 = axs2[0,3]
ax3 = axs3[0,3]
line_col = 20 + 30 * (32 - i)

if i in range(32,40):
ax = axs[1,0]
ax2 = axs2[1,0]
ax3 = axs3[1,0]
line_col = 20 + 30 * (40 - i)

if i in range(40,48):
ax = axs[1,1]
ax2 = axs2[1,1]
ax3 = axs3[1,1]
line_col = 20 + 30 * (48 - i)

if i in range(48,56):
ax = axs[1,2]
ax2 = axs2[1,2]
ax3 = axs3[1,2]
line_col = 20 + 30 * (56 - i)

if i in range(56,64):
ax = axs[1,3]
ax2 = axs2[1,3]
ax3 = axs3[1,3]
line_col = 20 + 30 * (64 - i)

if i in range(64,72):
ax = axs[2,0]
ax2 = axs2[2,0]
ax3 = axs3[2,0]
line_col = 20 + 30 * (72 - i)

if i in range(72,80):
ax = axs[2,1]
ax2 = axs2[2,1]
ax3 = axs3[2,1]
line_col = 20 + 30 * (80 - i)

if i in range(80,88):
ax = axs[2,2]
ax2 = axs2[2,2]
ax3 = axs3[2,2]
line_col = 20 + 30 * (88 - i)

if i in range(88,96):
ax = axs[2,3]
ax2 = axs2[2,3]
ax3 = axs3[2,3]
line_col = 20 + 30 * (96 - i)

key = sorted_keys[i]
Expand All @@ -591,6 +615,10 @@ def func(x, a, b):#, c):
ax2.loglog(DT[key][3], DT[key][4], '.-', c = cmap(line_col), label=DT[key][0])
print DT[key][2][-1], int(DT[key][1][-1]), DT[key][0]

ax3.plot(DT[key][5]['day'], DT[key][5]['death_rate'], '*-', c = cmap(line_col), label=DT[key][0])
#ax3.plot(DT[key][5]['day'], DT[key][5]['recover_rate'], 'o-', c = cmap(line_col), label=DT[key][0])
#ax3.plot(DT[key][5]['day'], DT[key][5]['ill_rate'], 'x-', c = cmap(line_col), label=DT[key][0])


######
# axis
Expand All @@ -599,6 +627,10 @@ def func(x, a, b):#, c):
axs[2,3].text(27, -4.6, 'This work is licensed under CC-BY-SA 4.0', fontsize=8)
axs[2,3].text(27, -5.6, 'Data: NPGEO-DE', fontsize=8)

link = axs3[2,3].text(27, -7, 'Christine Greif (http://www.usm.uni-muenchen.de/~koepferl)', fontsize=8)
axs3[2,3].text(27, -8, 'This work is licensed under CC-BY-SA 4.0', fontsize=8)
axs3[2,3].text(27, -9, 'Data: NPGEO-DE', fontsize=8)

link = axs2[2,3].text(35, 5, 'Christine Greif (http://www.usm.uni-muenchen.de/~koepferl)', fontsize=8)
axs2[2,3].text(35, 4.4, 'This work is licensed under CC-BY-SA 4.0', fontsize=8)
axs2[2,3].text(35, 3.8, 'Data: NPGEO-DE', fontsize=8)
Expand Down Expand Up @@ -642,17 +674,26 @@ def func(x, a, b):#, c):
if ax2 in [axs2[0,0], axs2[1,0], axs2[2,0]]:
ax2.set_ylabel('Fallzahlen in der letzten Woche (number of new cases last week)')

for ax3 in axs3.reshape(-1):
ax3.set_ylim(0,20.9)
ax3.set_xlim(13,50)

ax3.grid(True, which="both")
ax3.set_xticks(np.arange(14, 50, 2))
ax3.set_xticklabels([14, 16, 18, 20, 22, 24, 26, 28, 30, 1, 3, 5, 7, 9, 11, 13, 15, 17])
ax3.set_ylabel('Sterberaten in %')


ax3.legend(loc='upper left')

#if ax in [axs[2,0], axs[2,1], axs[2,2], axs[2,3]]:
ax3.text(13, -6, 'Maerz/March')
ax3.text(31, -6, 'April')



#plt.show()
fig.savefig('DT_' + state[2] + '.pdf', dpi=300, overwrite=True, bbox_inches='tight')
fig2.savefig('loglog_' + state[2] + '.pdf', dpi=300, overwrite=True, bbox_inches='tight')

#################
#plt.title(name)

for i in range(len(sorted_keys)):
plt.loglog()

fig3.savefig('rate_' + state[2] + '.pdf', dpi=300, overwrite=True, bbox_inches='tight')

1 change: 1 addition & 0 deletions data_RKI/12411-001.csv

Large diffs are not rendered by default.

Loading

0 comments on commit 7036cc3

Please sign in to comment.