File:R-luvun vaikutus tartuntojen kasvuun 1.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
Source: Wikipedia, the free encyclopedia.

Original file(SVG file, nominally 1,004 × 481 pixels, file size: 49 KB)

Summary

Description
Suomi: R-luvun vaikutus tartuntojen kasvuun.
Date
Source Own work
Author Merikanto

Python code to create this plotting

    1. covid 19 finland epidemy R0 and time to peak simu test
  1. 8.3.2021 0000.0001

import math as math import numpy as np import scipy as sp import matplotlib.pyplot as plt import pandas as pd

import matplotlib.dates as mdates from matplotlib.ticker import NullFormatter from matplotlib.dates import MonthLocator, DateFormatter


alkupaivamaara='2021-03-05' ## simulaation alkupvm

aikamaara=46 tapauksia_alussa=750

times1 = pd.date_range(alkupaivamaara , periods=aikamaara, freq='D')

    1. very basic exponential r0 calculation

def calculate_r0(time1, time2, val1, val2): k=0 td=time2-time1 gr0=math.log(val2/val1) gr=gr0/td if(gr!=0): td= math.log(2.0)/gr else: return(1)

tau=5.0

k=math.log(2.0)/td


r0=math.exp(k*tau) if(r0==32): r0=1

if(r0>32): r0=4

return(r0)


  1. exp(gr0)=val2/val1


  1. maara=60

maara=aikamaara


  1. quit(0)

x=np.linspace(0,maara,maara) y=np.linspace(0,maara,maara) dy=np.linspace(0,maara,maara) cy=np.linspace(0,maara,maara) ppy=np.linspace(0,maara,maara) pky=np.linspace(0,maara,maara) psy=np.linspace(0,maara,maara) pty=np.linspace(0,maara,maara) py=np.linspace(0,maara,maara) ky=np.linspace(0,maara,maara) sy=np.linspace(0,maara,maara) ty=np.linspace(0,maara,maara) ssy=np.linspace(0,maara,maara) tty=np.linspace(0,maara,maara)

for n in range(0, aikamaara): ssy[n]=0 sy[n]=0 psy[n]=0 ky[n]=0 pky[n]=0 tty[n]=0 ty[n]=0 pty[n]=0


  1. tapauksia=1
  2. huippuaika=40
  3. ro=2.0
  4. laskuro=0.8


tapauksia=tapauksia_alussa

huippuaika=40 ro=1.35 laskuro=1.35

tau=5.0

tapauksiayhteensa=[]

ax = plt.gca()

fig = plt.gcf() fig.set_size_inches(11, 7, forward=True)

for m in range(0, 3): ro=1.15+0.1*m laskuro=ro tapauksia=750

for n in range(0, aikamaara): dndt=tapauksia*(math.log(ro)/tau) tapauksia=tapauksia+dndt #print(n,int(tapauksia), int(dndt), ro) if(n>huippuaika): ro=laskuro dy[n]=dndt y[n]=tapauksia cy[n]=tapauksia if (n>9): cy[n]=cy[n-1]+tapauksia pky[n]=0 ky[n]=0

paivays1=times1[n].strftime("%d.%m.") jono1="R "+str(round(ro,3))+ " Tartuntoja "+paivays1 +" : "+str(int(y[n])) + " tartuntoja yht. "+str(int(cy[n-1]) ) tapauksiayhteensa.append(int(cy[n-1])) plt.plot(times1,y, label=jono1)


  1. plt.plot(x,dy)
  2. plt.plot(x,y)

laapeli1="Tartuntoja alussa "+str(tapauksia_alussa)


plt.title("R-luvun vaikutus tartuntojen kasvuun", fontsize=20) plt.suptitle(laapeli1, fontsize=14,y=1)

plt.xlabel("Päivämäärä ", fontsize=16) plt.ylabel("Tartuntoja päivässä", fontsize=16) plt.xticks(fontsize=15 ) plt.yticks(fontsize=15 ) ax.xaxis.set_major_formatter(mdates.DateFormatter('%d.%m.'))


plt.legend(fontsize=14) plt.show()



Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

8 March 2021

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current10:42, 8 March 2021Thumbnail for version as of 10:42, 8 March 20211,004 × 481 (49 KB)MerikantoUpdate
08:54, 8 March 2021Thumbnail for version as of 08:54, 8 March 2021900 × 560 (46 KB)MerikantoUploaded own work with UploadWizard
No pages on the English Wikipedia use this file (pages on other projects are not listed).

Metadata