{"id":15761324,"url":"https://github.com/benmaier/gillepi","last_synced_at":"2025-03-13T19:32:07.497Z","repository":{"id":66124004,"uuid":"57154528","full_name":"benmaier/GillEpi","owner":"benmaier","description":"Provides classes to simulate epidemics on (potentially time-varying) networks using a Gillespie stochastic simulation algorithm or the classic agent based method.","archived":false,"fork":false,"pushed_at":"2019-10-22T08:11:52.000Z","size":37,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-11T11:07:47.665Z","etag":null,"topics":["agent-based-modeling","complex-networks","dynamic-networks","epidemics","si","simulate-epidemics","sir","sirs","sis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benmaier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-26T19:04:25.000Z","updated_at":"2023-10-29T13:24:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"b1f810c7-8f6d-4d3c-92d2-79339df6e815","html_url":"https://github.com/benmaier/GillEpi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2FGillEpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2FGillEpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2FGillEpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2FGillEpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benmaier","download_url":"https://codeload.github.com/benmaier/GillEpi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243469252,"owners_count":20295715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-based-modeling","complex-networks","dynamic-networks","epidemics","si","simulate-epidemics","sir","sirs","sis"],"created_at":"2024-10-04T11:02:17.074Z","updated_at":"2025-03-13T19:32:07.082Z","avatar_url":"https://github.com/benmaier.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"BEWARE: THIS PACKAGE IS DEPRECATED\n\nPlease use [tacoma](github.com/benmaier/tacoma) instead, which is maintained and works better in every way.\n\n# GillEpi\n\nProvides pure Python classes to simulate epidemics on (potentially time varying) networks using a Gillespie stochastic simulation algorithm or the standard ABM SIS, SIR models.\n\n## Install \n\n### Development version\n\n    $ make\n\n### Standard\n\n    $ make install\n\n## Examples\n\n### List of classes\n\n```python\nfrom GillEpi import SI, SIS, SIR, SIRS\nfrom GillEpi.agent_based_epidemics import SIR as AB_SIR\nfrom GillEpi.agent_based_epidemics import SIS as AB_SIS\n```\n\nFind out the functionality using Python's help function and the examples below.\n\n### Standard\n\n```python\nimport GillEpi\nimport matplotlib.pyplot as pl\nimport networkx as nx\n\nN = 100\nk = 8\np = k / (N-1.0)\nG = nx.fast_gnp_random_graph(N, p)\n\nR0 = 1.5\nrecovery_rate = 1.0\ninfection_rate = R0 * recovery_rate / k\ntmax = 1000\n\nsis = GillEpi.SIS(\n                  G,\n                  infection_rate = infection_rate,\n                  recovery_rate = recovery_rate,\n                 )\n\n# simulate\nsis.simulate(tmax)\n\n# plot infected cluster\ni, t = sis.get_i_of_t()\npl.step(t,i)\n\npl.show()\n```\n\n### Agent-based model\n\nI'm not a big fan of the node-centric ABM since the reaction `S+I - \u003e I+I` is not being reflected with the right rates.\n\n```python\nfrom GillEpi.agent_based_epidemics import SIS as ABM_SIS\nimport matplotlib.pyplot as pl\nimport numpy as np\nimport networkx as nx\n\nN = 100\nk = 8\np = k / (N-1.0)\nG = nx.fast_gnp_random_graph(N, p)\n\nR0 = 1.5\nrecovery_probability = 0.01\ninfection_probability = R0 * recovery_probability / k\ntmax = 1000\n\nsis = ABM_SIS(\n              G,\n              infection_probability = infection_probability,\n              recovery_probability = recovery_probability,\n              patients_zero = [0,1,2,45,34],\n             )\n\n# simulate\nsis.step(tmax)\n\n# plot infected cluster\ni = sis.I\nt = sis.time\n\npl.step(t, i)\n\npl.show()\n```\n\n### Dynamic network\n\nAs an example for time-varying networks, I use the flockwork model (https://github.com/benmaier/flockworks).\n\n```python\nfrom flockworks import flockwork\nimport GillEpi\nimport pylab as pl\n\n# initialize time-varying network\nF = flockwork(Q=0.7,N=100,k0=2)\nF.equilibrate()\n\n#initialize SIR simulation\nsir = GillEpi.SIR(\n                  F.G,\n                  infection_rate = 1.,\n                  recovery_rate = 1.,\n                  rewiring_rate = 1.,\n                  rewire_function = F.rewire,\n                  mean_degree_function = F.mean_degree\n                 )\n\n# simulate\nsir.simulate()\n\n# initialize analysis\nfig, ax = pl.subplots(2,1)\n\n# plot susceptible cluster\ns, t = sir.get_s_of_t()\nax[0].step(t,s)\n\n# plot resistant cluster\nr, t = sir.get_r_of_t()\nax[0].step(t,r)\n\n# plot infected cluster\ni, t = sir.get_i_of_t()\nax[0].step(t,i)\n\n# plot basic reproduction number\nR0,t = sir.get_R0_of_t()\nax[1].step(t,R0)\n\npl.show()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenmaier%2Fgillepi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenmaier%2Fgillepi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenmaier%2Fgillepi/lists"}