In [1]:
import pickle as pkl
import pandas as pd

%matplotlib inline

In [2]:
! echo $PATH


/home/ericmjl/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/texlive/2015/bin/x86_64-linux:/home/ericmjl/pypy3/bin:/home/ericmjl/pypy/bin

In [3]:
! pypy3 simulation.py


n_hosts: 400, time:1.9110538959503174

In [4]:
! python simulation.py


n_hosts: 400, time:8.817363500595093

In [5]:
with open('results/simulation.pkl', 'rb') as f:
    results = pkl.load(f)

In [6]:
data = pd.DataFrame(results)

In [7]:
data.columns


Out[7]:
Index(['n_blue_immune', 'n_blue_virus', 'n_contacts', 'n_immune', 'n_infected',
       'n_mixed', 'n_original', 'n_red_immune', 'n_red_virus', 'n_uninfected'],
      dtype='object')

In [8]:
# Plot hosts
data[['n_blue_immune', 'n_red_immune', 'n_immune']].plot()


Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5aee193cc0>

In [9]:
# Plot viruses.
data[['n_blue_virus', 'n_red_virus', 'n_mixed']].plot()


Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5af5071358>

In [10]:
data[['n_contacts']].plot()


Out[10]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5af509f710>

In [ ]: