An Infectious Agent Simulation in PyGame

in #vaccine6 years ago

So in my messing around at school today I decided to build a little infectious agent simulation program with pygame. This is literally version 1 so it looks a little weird and stuff but I find it pretty cool to mess around with, especially to mess around with the config for it.

If the configuration there are 6 major things which I will explain below after you see an example config file.

config.txt
______________________________________
dvr = 0.1
vaccinated = 0.22
infected = 0.08
dinfect = 0.60
dcure = 0.05
vef = 3

This setup is actually the one used in this video. Anyways to explain some of the information present.


DVR

Delta Vaccination Rate: this is the rate at which unvaccinated cells (squares) become vaccinated. Depending on the vef (vaccination effectiveness) will change the importance of vaccination however more on that later. Generally I keep the vaccination rate below that of the infection rate but I have messed with it a couple of times to see what its like the other way.

vaccinated

% tries to vaccinate original population. So there is an initial population of 6400 with the current setup and this rate says that when each cell is initialized (created) it has that percentage of being vaccinated. Lets say it had a value of 0.22 (22%) then with each cell there is a 22% chance it will be vaccinated. This doesn't necessarily mean 22% of the population will be vaccinated but it is likely to be around that much.

infected

This is the same as the vaccinated except it is for the infected.

dinfect

This is the rate at which uninfected cells (in contact with infected cells) have a chance of being infected. So each generation (as I call it) will go and have a chance of being infected proportional to the number of its neighbours that are infected. So with a 60% chance, if a cell has 3 infected neighbours then its chance of being infected is 1-(1-0.6)3 or around 93%

dcure

This is the same as the previous except its the rate at which infected become cured.

vef

Vaccine Efficiency is a rate (direct multiplication) to calculate the rates of these things for vaccinated cells. For instance, with a vef of 3, a vaccinated cell is 3 times less likely to get infected and is 3 times more likely to be cured.

Everything in the config is static (doesn't change over time) though it wouldn't be hard to adjust that. I just thought it would be cool to do something like this and see the results. Originally there were 16384 cells but it had some wacky behaviour though so does this (those diagonal lines)

Honestly, each cell can only interact with the cells directly next to is (that is a total of 4 cells) so I think that the diagonal (and other odd behaviours) are due to an error in how I coded the interaction member function. That being said, the diagonal lines are not always running in the same direction (meaning it could be an honest implementation within the thing and not an error) however with a size allowing for 16384 causes X's to form, however smaller groups (400 cells) creates something more similar to random noise in their patterns.


Kryzsec's Steemit Board


Image Source from @nitesh9

Do you enjoy reading or writing topics related to STEM (Science, Technology, Engineering, and Mathematics) then I would suggest checking out @steemstem! They do wonderful work curating the best STEM related posts on Steemit. For more information check out the SteemStem chat room on steemit.chat or check out their Guidlines and start writing.

Sort:  

Mathematically speaking this is a discrete markov process. If you study the continuous version of these type of systems then by only given the rates you can prove what the eventual behaviour of the system is (from a measure theoretical perspective) . I guess your system is a just a contact process -> See 1.3 over here http://staff.utia.cas.cz/swart/lecture_notes/partic17_04_07.pdf over here.

Shh... I had that planned for another post to explain this system mathematically and nobody was supposed to know that yet!


Just kidding about the nobody was supposed to know part. I will definitely use that as another source when referencing the other post, though how it explains it in your resource is slightly different than how I had always seen the contact process explained (in other sources from reading up on it) so I still kind of learned something. As well mine is slightly more complex than just a simple contact process as it has both the vaccination rates and the infection rates and whether someone is vaccinated or not will affect the rate of spread of the infection along with some other things but still you are correct! I wish I could vote you for more.

Yeah it is a bit different from an ordinary contact process.

The theory for these kind of stuff that I am familiar with hold on lattices of the type ql_b70b76a8ac309bca08edc1a1142c9ebe_l3.png . Which is in some sense a lattice on RR.png So it might be fun to explore what kind of results you get if you implement this kind of stuff on a torus.

I could check it out and try the implementation though I am unsure about pygame in its ability to handle the 3rd dimension. I mean python already does O(nlogn) algorithms as O(n2)

So I will definitely look into it but it might take a little longer to implement this into 3d (for application) than it did for 2d

I mean a 2d torus (S x S). By identifying the opposite edges on a square you can create a torus.

Yes but it would be prettier to look at if it was a complete torus, as well I can just write it in C++ and have it work a lot faster

Nice! You should make one of these and share with the anti-vaccine community. :) Really stir up the pot. :)

I have an entire list of posts dedicated to stirring the pot of the antivac community... Even better though is when you piss off, I mean stir the post, with antivaccers you know personally.

These images skip the part where I had sent a very long list of scientific sources (with brief explanations of the conclusions in each)...

:) Why listen to scientific evidence. . :)

Exactly, especially when there is a guy that graduated from standford with an honours degree saying that vaccines cause autism (J.B. Hadley or something like that, B.A. honours in east asain studies) and obviously, since he went to standford his knows what he is talking about. Where do I get off thinking vaccines work?

"Science is nice and everything but... unsourced anti-vax facebook meme"

Screenshots from my phone. I mean what are the chances I could find a meme with someone talking to a person over facebook about this exact topic where they have the same spelling as me (most people with my name has it spelled as Brody, not Brodie...) and even then it isn't a super common name (at least not here)

I think you misunderstood, I'm making fun of the type of person I've run into numerous times on the internet who'll claim to 'love science' and then immediately use unsourced anti-vax memes/infographics in an argument.

Coin Marketplace

STEEM 0.32
TRX 0.11
JST 0.034
BTC 66654.57
ETH 3250.95
USDT 1.00
SBD 4.33