File:Korona simulaatio R0 n vaikutus 1.svg

Original file(SVG file, nominally 964 × 482 pixels, file size: 77 KB)

Captions

Captions

Effect of R0 to covid-19 cases with simulated with SIRD model

Summary

edit
Description
Suomi: R0:n vaikutus SIRD-mallissa koronavirustapausten määriin
English: Effect of R0 to covid-19 cases with simulated with SIRD model
Date
Source Own work
Author Merikanto

Python source code to this SIRD simulation

    1. Covid-19 etc. SIRD model Python script
    2. attempt to simulate Covid-19 epidemy
  1. can simulate multiple rounds
    1. main params: R0,infection ceiling
    2. Note: this program is for educational purposes only
    3. not actual simulation of epidemies
    4. do not take account changes in R0 value
    5. due to lockdowns and other measures
    6. not times in icu etc

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

allit=[] tehollet=[] sairaalaant=[] kuoleet=[] imaxit=[] icumaxit=[]

g_ttt=[] g_sss=[] g_iii=[] g_rrr=[] g_ddd=[] g_icu=[] g_hosp=[] g_ddd2=[]

def sird_malli_koe_2(pitu,na,i,s,r,d,r0,rt,kontakt,gamma,beta,delta,khospi,kiku):

global allit global tehollet global sairaalaant global kuoleet

ttt=np.linspace(0,pitu,pitu) sss=np.linspace(0,pitu,pitu) iii=np.linspace(0,pitu,pitu) rrr=np.linspace(0,pitu,pitu) ddd=np.linspace(0,pitu,pitu) icu=np.linspace(0,pitu,pitu) hosp=np.linspace(0,pitu,pitu) ddd2=np.linspace(0,pitu,pitu)

for n in range(0,(pitu)): iii[n]=0 sss[n]=0 rrr[n]=0 iii[n]=0 ddd[n]=0 ddd2[n]=0 icu[n]=0 hosp[n]=0


diku=1.0/210.0 maxi=0 alli=0 iku=0 hospi=0 ik=0 ho=0 maxiku=0

## SIRD malli

for n in range(0,(pitu-0)): na=s+i+r+d bis=beta*i*s gi=gamma*i dddt=delta*i dsdt=(-1*bis)/na didt=(bis/na)-gi-dddt drdt=gi s=s+dsdt i=i+didt r=r+drdt d=d+dddt sss[n]=s iii[n]=i rrr[n]=r ddd[n]=d ddd2[n]=dddt alli=alli+i iku=i*kiku-i*diku hospi=i*khospi hosp[n]=hospi icu[n]=iku ik=ik+iku ho=ho+hospi if(i<maxi): beta=rt*gamma


if(iku>maxiku): maxiku=iku if(i>maxi): maxi=i


allit.append(alli) sairaalaant.append(int(ho)) tehollet.append(int(ik)) kuoleet.append(int(d)) icumaxit.append(int(maxiku)) imaxit.append(int(maxi))


g_ttt.append(ttt) g_sss.append(sss) g_iii.append(iii) g_rrr.append(rrr) g_ddd.append(ddd) g_icu.append(icu) g_hosp.append(hosp) g_ddd2.append(ddd2)


return

      1. main proge

malli=0 mallimaara=10

    1. oletus rt

rt=3.35

for malli in range(0,(mallimaara+1)):

#if (malli==0): ## kevään 2020 aalto pitu=180 na=1200 i=1 s=na-i r=0 d=0 #r0=3.35 r0=2.5+0.1*malli rt=r0 kontakt=0.5 gamma=0.1 beta=r0*gamma delta=0.047 ## kuolleisuus khospi=0.13 ## sairaalaan kerroin kiku=0.035 ## teholle kerroin

sird_malli_koe_2(pitu,na,i,s,r,d,r0,rt, kontakt,gamma,beta,delta,khospi,kiku)

print ("-------------------------") print ("Malli ", malli) print ("R0 ",r0, "Rt ",rt ) print ("Infektiokatto ",na)


alli=allit[malli] ho=sairaalaant[malli] ik=tehollet[malli] d=kuoleet[malli] maxteholla=int(icumaxit[malli]) maxinfektiot=int(imaxit[malli])

print ("Kaikki ",int(alli)) print ("Sairaalaan ", int(ho)) print ("Teholle ", int(ik)) print ("Kuolee ",int(d))

#laapeli0="Oletukset: Nousuaika "+str(a_huippuaika)+" päivää. Alussa R0="+str(a_ro)+ " Huipun jälkeen Rt="+str(a_laskuro) #laapeli1="Simu" #labelo="R0 "+str(r0)+ " Infektiokatto "+str(na)+ " : kuolee yhteensä "+str(int(d)) #labelo="R0 "+str(r0)+ " Infektiokatto "+str(na)+" Teholle maksimi "+str(int(maxteholla)) +" : teholla yhteensä "+str(int(ik)) #labelo="R0 "+str(r0)+ " Infektiokatto "+str(na)+" Päivittäiset maksimi "+str(int(maxinfektiot)) +" : tapauksia yhteensä "+str(int(alli)) labelo="R0 "+str(r0)+" : yhteensä "+str(int(alli))

ax = plt.gca()

plt.title("Koronainfektiot riippuen R0:n arvosta, simulaatio", fontsize=20) #plt.suptitle(laapeli0, fontsize=14,y=1)

plt.xlabel("Päivä", fontsize=16) #plt.ylabel("Päivittäin kuolleita", fontsize=16) plt.ylabel("Päivittäiset infektiot", fontsize=16) plt.xticks(fontsize=15 ) plt.yticks(fontsize=15 )

plt.plot(g_ttt[malli],g_iii[malli],label=labelo) #plt.plot(g_ttt[malli],g_ddd2[malli],label=labelo) #plt.plot(g_ttt[malli],g_icu[malli],label=labelo)

#g_sss #g_iii #g_rrr #g_ddd #g_icu #g_hosp #g_ddd2

plt.legend() plt.show()



Licensing

edit
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.

File history

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

Date/TimeThumbnailDimensionsUserComment
current17:20, 22 August 2020Thumbnail for version as of 17:20, 22 August 2020964 × 482 (77 KB)Merikanto (talk | contribs)Muokkaus
14:18, 20 August 2020Thumbnail for version as of 14:18, 20 August 2020980 × 491 (77 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata