Virus Spread Simulation translation to Python

I’m trying to translate the simulation engine from Long Nguyen shown here into Python but I’m stuck.

This is how far I’ve gotten:
Virus.Epidemic.Simulator_Python.gh (21.4 KB)

Could anyone help?

Hi,

By coincidence, I just posted a contamination example in RhinoPython
Albeit not the type you are referencing here but maybe there is something of use in it.

-Willem

1 Like

I actually wanted to add similar motion to the points of Nguyen’s algorithm, but first I need to translate it from that terrible language. :wink:

1 Like

I’m sorry to be the usual heavy, but this is not a simulation of a pandemic because the environment (the point cloud) has no dynamics or behavior. It just doesn’t fit any semi-realistic model, where agents prone to get infected move and spread the pandemic to other areas. This model is only randomly diffusion with collisions and characterized as a pandemic. It’s interesting, I don’t mean to detract from it, just to name things. And by the way, in that case where the points don’t move, it would be more efficient to pre-calculate the neighborhood topology and use it instead of RTree as he does.

Reducing it, it has points that can have several states (healthy, infected, recovered and dead). For each healthy point, look for infected points near it, and if it has no obstacle in between it gets infected. For each infected point, time is running out on each iteration and if the virus dies before it does, it recovers, if not, by some chance, it dies.

Noone cares about this @Dani_Abalde, didn’t pick the name and really don’t care about this I just want to translate this in Python and modify it because c# especially inside the scripting component in GH is terribly non-comprehensible. Definiting variables after using them inside the RunScript :man_facepalming:.

Perhaps the main reason for me to not even try to use c# with GH is because the scripting component is badly designed. (understand bad for newcomers), there’s too much boilerplate confusing unnecessary code added.