Preparing the data for the Virus
Simulation¶
In order to run this simulation we have to create an XML file for the Action attributes, as well as a DAT file for the positions and fields of the initial population.
We will use a torus grid of dimensions 200x200.
The timestep for the simulations is one day.
To run our simulation we will use two sets of agents - uninfected and infected. By means of the configuration file we can add the infected agents at the beginning of the simulation or at a later time.
An XML Population File¶
This is an exxample of an XML File (VirusHost.xml
) for the virus simulation.
Note that the times in the modules ATanDeath
and Fertility
are given in days.
Also, the values in the module``Verhulst`` are much smaller compared to the values used in tutorieal 05.
<class name="VirusHostPop" species_name="sapiens" species_id="104">
<module name="ATanDeath">
<param name="ATanDeath_max_age" value="22000.0"/>
<param name="ATanDeath_range" value="2500.0"/>
<param name="ATanDeath_slope" value="1.0"/>
</module>
<module name="RandomMove">
<param name="RandomMove_prob" value="0.01"/>
</module>
<module name="Fertility">
<param name="Fertility_interbirth" value="800.0"/>
<param name="Fertility_max_age" value="18000.0"/>
<param name="Fertility_min_age" value="5000.0"/>
</module>
<module name="Verhulst">
<param name="Verhulst_b0" value="0.5" />
<param name="Verhulst_d0" value="0.00001" />
<param name="Verhulst_theta" value="0.001" />
<param name="Verhulst_K" value="40" />
</module>
<module name="Virus">
<param name="InfectionProb" value="0.9" />
<param name="InitialLoad" value="0.1" />
<param name="GrowthRate" value="0.05" />
<param name="ContagionLevel" value="0.12" />
<param name="LethalityLevel" value="0.9" />
</module>
<priorities>
<prio name="GetOld" value="8"/>
<prio name="ATanDeath" value="10"/>
<prio name="RandomMove" value="7"/>
<prio name="Fertility" value="2"/>
<prio name="RandomPair" value="3"/>
<prio name="Verhulst" value="6"/>
<prio name="Virus" value="7"/>
</priorities>
<vardefs>
<var name="MutationRate" value="0.00"/>
<var vname="ImmunityInheritance" value="min">
</vardefs>
</class>
Of particular interest are the values of the virus attributes in the module Virus
:
you’ll be experimenting with various values to see different outcomes.
This set of values describes a very infectious virus which takes a long time to kill its host.
In this example, the mutation rate is seto 0 (i.e. no random changes of the immunity levels, and the inheritance is set to “min”, which means a baby inherits the lesser of the immunity values of it’s parents.
A DAT File for a Healthy Population (no immunity)¶
Here is an example for a DAT file (uninfected.dat
) for uninfected agents that have an immunity level of 0.
(Remember that high immunity levels slow down the growth of the virus and reduces the infection risk).
Note that the birth times and ages are given in days - this means that our agents are almost 14 years old at the start of the simulation.
#Longitude;Latitude;LifeState;AgentID;BirthTime;Gender;Age;LastBirth;ViralLoad;Immunity
100;100;1; 1;-5000;0;5000;-1.0;0.0;0.0
100;100;1; 2;-5000;1;5000;-1.0;0.0;0.0
100;100;1; 3;-5000;0;5000;-1.0;0.0;0.0
100;100;1; 4;-5000;1;5000;-1.0;0.0;0.0
100;100;1; 5;-5000;0;5000;-1.0;0.0;0.0
100;100;1; 6;-5000;1;5000;-1.0;0.0;0.0
100;100;1; 7;-5000;0;5000;-1.0;0.0;0.0
100;100;1; 8;-5000;1;5000;-1.0;0.0;0.0
100;100;1; 9;-5000;1;5000;-1.0;0.0;0.0
100;100;1;10;-5000;1;5000;-1.0;0.0;0.0
100;100;1;11;-5000;0;5000;-1.0;0.0;0.0
100;100;1;12;-5000;1;5000;-1.0;0.0;0.0
100;100;1;13;-5000;0;5000;-1.0;0.0;0.0
100;100;1;14;-5000;1;5000;-1.0;0.0;0.0
100;100;1;15;-5000;1;5000;-1.0;0.0;0.0
100;100;1;16;-5000;1;5000;-1.0;0.0;0.0
100;100;1;17;-5000;0;5000;-1.0;0.0;0.0
100;100;1;18;-5000;1;5000;-1.0;0.0;0.0
100;100;1;19;-5000;0;5000;-1.0;0.0;0.0
100;100;1;20;-5000;1;5000;-1.0;0.0;0.0
A DAT File for a Infected Population (with immunity)¶
This DAT file, infected.dat
, defines slightly infectious and totally immune agents
which should be started after 60000 steps (all the agents will be more than 16 years old)
#Longitude;Latitude;LifeState;AgentID;BirthTime;Gender;Age;LastBirth;ViralLoad;Immunity
55;50;1;31;54000.0;0;6000.0:-1.0;0.23;1.0
55;50;1;32;54000.0;1;6000.0:-1.0;0.25;1.0
55;50;1;33;54000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;34;54000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;35;54000.0;0;6000.0:-1.0;0.27;1.0
55;50;1;36;54000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;37;54000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;38;54000.0;1;6000.0:-1.0;0.27;1.0
55;50;1;39;54000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;31;54000.0;0;6000.0:-1.0;0.23;1.0
55;50;1;32;54000.0;1;6000.0:-1.0;0.25;1.0
55;50;1;33;54000.0;0;6000.0:-1.0;0.20;1.0
55;50;1;34;54000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;35;54000.0;0;6000.0:-1.0;0.27;1.0
55;50;1;36;54000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;37;54000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;38;54000.0;1;6000.0:-1.0;0.27;1.0
55;50;1;39;54000.0;0;6000.0:-1.0;0.22;1.0
To be able to start the agents at step 0 you have to shift the birth times as in this DAT file (infected_0.dat
):
#Longitude;Latitude;LifeState;AgentID;BirthTime;Gender;Age;LastBirth;ViralLoad;Immunity
55;50;1;31;-6000.0;0;6000.0:-1.0;0.23;1.0
55;50;1;32;-6000.0;1;6000.0:-1.0;0.25;1.0
55;50;1;33;-6000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;34;-6000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;35;-6000.0;0;6000.0:-1.0;0.27;1.0
55;50;1;36;-6000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;37;-6000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;38;-6000.0;1;6000.0:-1.0;0.27;1.0
55;50;1;39;-6000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;31;-6000.0;0;6000.0:-1.0;0.23;1.0
55;50;1;32;-6000.0;1;6000.0:-1.0;0.25;1.0
55;50;1;33;-6000.0;0;6000.0:-1.0;0.20;1.0
55;50;1;34;-6000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;35;-6000.0;0;6000.0:-1.0;0.27;1.0
55;50;1;36;-6000.0;1;6000.0:-1.0;0.21;1.0
55;50;1;37;-6000.0;0;6000.0:-1.0;0.22;1.0
55;50;1;38;-6000.0;1;6000.0:-1.0;0.27;1.0
55;50;1;39;-6000.0;0;6000.0:-1.0;0.22;1.0
A Configuration File¶
--data-dirs=${QHG4_DIR}/tutorial_data/grids/
--events='write|grid+geo+pop:sapiens@1000,pop|sapiens:VirusHost.xml:infected.dat@[60000]'
--grid=torus_200x200.qdf
--log-file=tutorial_09_s0.log
--num-iters=100000
--output-dir=output/tutorial_09_s0
--output-prefix=vir
--pops='VirusHost.xml:uninfected.dat'
--shuffle=92244
With this configuration file the simulation starts with a colony of uninfected agents, which is later (after 60000 days) joined by a colony of infected agents.