In [1]:
from dzdy import *
import matplotlib.pyplot as plt

In [2]:
da = Director()
da.load_pc('scripts/pSIR.txt')
da.load_dc('scripts/SIR_bn.txt')

In [3]:
cfd = da.new_mc('ABM_SIR', 'ABM', tar_pc='pSIR', tar_dc='SIR_BN')
cfd.add_behaviour('cycle', be_type='Reincarnation', s_birth = 'Sus', s_death = 'Dead')
cfd.add_behaviour('transmission', be_type='ComFDShock', s_src = 'Inf', t_tar = 'Infect')
cfd.set_observations(states=['Sus', 'Inf', 'Rec'])

In [7]:
mod_src, out_src = da.simulate('ABM_SIR', y0= {'Sus': 95, 'Inf': 5}, to=5)
out_src.plot()
plt.show()



In [8]:
mod_new = da.copy_model(mod_src, intervention={'rec_rate': 100})
out_src = da.update(mod_src, 20)
out_src.plot()
out_new = da.update(mod_new, 20)
out_new.plot()
plt.show()