starsim


Namestarsim JSON
Version 2.1.1 PyPI version JSON
download
home_pageNone
SummaryA fast, flexible agent-based disease modeling framework
upload_time2024-11-08 06:43:34
maintainerNone
docs_urlNone
authorCliff Kerr, Robyn Stuart, Romesh Abeysuriya, Paula Sanz-Leon, Jamie Cohen, Daniel Klein
requires_python>=3.8
licenseMIT License Copyright (c) 2023 - 2024 Bill & Melinda Gates Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords agent-based model simulation disease epidemiology
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Starsim
=======

Starsim is an agent-based modeling framework for simulating the spread of diseases among agents via dynamic transmission networks. Starsim supports the co-transmission of multiple diseases at once, capturing how they interact biologically and behaviorally. Users can also include non-infectious diseases either on their own or as factors affecting infectious diseases. Starsim allows detailed modeling of mother-child relationships from conception to study birth-related diseases. Additionally, Starsim lets users compare different intervention strategies, like vaccines or treatments, to see their impact through various delivery methods such as mass campaigns or targeted outreach.

Examples of diseases that have already been implemented in Starsim include sexually transmitted infections (HIV, HPV, and syphilis, including co-transmission), respiratory infections (tuberculosis and RSV), plus other diseases (Ebola and cholera) and underlying determinants of health (such as malnutrition).

Note: Starsim is a general-purpose, multi-disease framework that builds on our previous suite of disease-specific models, which included `Covasim <https://covasim.org>`_, `HPVsim <https://hpvsim.org>`_, and `FPsim <https://fpsim.org>`_. In cases where a distinction needs to be made, Starsim is also known as the "Starsim framework", while this collection of other models is known as the "Starsim suite".

For more information about Starsim, please see the `documentation <https://docs.starsim.org>`__.


Requirements
------------

Python 3.9-3.12.

We recommend, but do not require, installing Starsim in a virtual environment, such as `Anaconda <https://www.anaconda.com/products>`__.


Installation
------------

Starsim is most easily installed via PyPI: ``pip install starsim``.

Starsim can also be installed locally. To do this, clone first this repository, then run ``pip install -e .`` (don't forget the dot at the end!).

*Note:* Starsim leverages Intel's `short vector math library <https://numba.readthedocs.io/en/stable/user/performance-tips.html#intel-svml>`_. If you want to use this (for a ~10% speed improvement), install via `conda install intel-cmplr-lib-rt`.


Usage and documentation
-----------------------

Full documentation, including tutorials and an API reference, is available at https://docs.starsim.org. 

You can run a simple demo via::

  import starsim as ss
  ss.demo()

Here is a slightly more realistic example of an SIR model with random connections between agents::

  import starsim as ss

  # Define the parameters
  pars = dict(
      n_agents = 5_000,     # Number of agents to simulate
      networks = dict(      # Networks define how agents interact w/ each other
          type = 'random',  # Here, we use a 'random' network
          n_contacts = 10   # Each person has 10 contacts with other people  
      ),
      diseases = dict(      # *Diseases* add detail on what diseases to model
          type = 'sir',     # Here, we're creating an SIR disease
          init_prev = 0.01, # Proportion of the population initially infected
          beta = 0.05,      # Probability of transmission between contacts
      )
  )

  # Make the sim, run and plot
  sim = ss.Sim(pars)
  sim.run()
  sim.plot() # Plot all the sim results
  sim.diseases.sir.plot() # Plot the standard SIR curves

More usage examples are available in the tutorials, as well as the ``tests`` folder.


Starsim structure
-----------------

All core model code is located in the ``starsim`` subfolder; standard usage is ``import starsim as ss``.

The model consists of core classes including ``Sim``, ``People``, ``Disease``, ``Network``, ``Intervention``, and more. These classes contain methods for running, building simple or dynamic networks, generating random numbers, calculating results, plotting, etc.

The submodules of the Starsim folder are as follows:

• ``arrays.py``: Classes to handle store and update states for people in networks in the simulation including living, mother, child, susceptible, infected, inoculated, recovered, etc.
• ``calibration.py``: Class to handle automated calibration of the model to data.
•	``demographics.py``: Classes to transform initial condition input parameters for use in building and utilizing networks.
•	``disease.py``: Classes to manage infection rate of spread, prevalence, waning effects, and other parameters for specific diseases.
•	``distributions.py``: Classes that handle statistical distributions used throughout Starsim to produce random numbers.
•	``interventions.py``: The Intervention class, for adding interventions and dynamically modifying parameters, and classes for each of the specific interventions derived from it. The Analyzers class (for performing analyses on the sim while it's running), and other classes and functions for analyzing simulations.
• ``loop.py``: The logic for the main simulation integration loop.
•	``modules.py``: Class to handle "module" logic, such as updates (diseases, networks, etc).
•	``networks.py``: Classes for creating simple and dynamic networks of people based on input parameters.
•	``parameters.py``: Classes for creating the simulation parameters.
•	``people.py``: The People class, for handling updates of state for each person.
•	``products.py``: Classes to manage the deployment of vaccines and treatments.
•	``results.py``: Classes to analyze and save results from simulations.
•	``run.py``: Classes for running simulations (e.g. parallel runs and the Scenarios and MultiSim classes).
•	``samples.py``: Class to store data from a large number of simulations.
•	``settings.py``: User-customizable options for Starsim (e.g. default font size).
•	``sim.py``: The Sim class, which performs most of the heavy lifting: initializing the model, running, and plotting.
• ``time.py``: The Time class, which coordinates time between the Sim and different modules.
•	``utils.py``: Helper functions.
•	``version.py``: Version, date, and license information.

The ``diseases`` folder within the Starsim package contains definitions of different types of diseases, including STIs, Ebola, and cholera.


Contributing
------------

Questions or comments can be directed to `info@starsim.org <mailto:info@starsim.org>`__ , or on this project’s `GitHub <https://github.com/starsimhub/starsim>`__ page. Full information about Starsim is provided in the `documentation <https://docs.starsim.org>`__.


Disclaimer
----------

The code in this repository was developed by `IDM <https://idmod.org>`_, the `Burnet Institute <https://burnet.edu.au>`_, and other collaborators to support our joint research on flexible agent-based modeling. We've made it publicly available under the MIT License to provide others with a better understanding of our research and an opportunity to build upon it for their own work. We make no representations that the code works as intended or that we will provide support, address issues that are found, or accept pull requests. You are welcome to create your own fork and modify the code to suit your own modeling needs as permitted under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "starsim",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "agent-based model, simulation, disease, epidemiology",
    "author": "Cliff Kerr, Robyn Stuart, Romesh Abeysuriya, Paula Sanz-Leon, Jamie Cohen, Daniel Klein",
    "author_email": "Starsim Development Team <info@starsim.org>",
    "download_url": "https://files.pythonhosted.org/packages/0f/b1/6d64b723a961a19343de5cfaa03abbb9a7ac10dcaa3b0cf15b0b1106e1f9/starsim-2.1.1.tar.gz",
    "platform": null,
    "description": "Starsim\n=======\n\nStarsim is an agent-based modeling framework for simulating the spread of diseases among agents via dynamic transmission networks. Starsim supports the co-transmission of multiple diseases at once, capturing how they interact biologically and behaviorally. Users can also include non-infectious diseases either on their own or as factors affecting infectious diseases. Starsim allows detailed modeling of mother-child relationships from conception to study birth-related diseases. Additionally, Starsim lets users compare different intervention strategies, like vaccines or treatments, to see their impact through various delivery methods such as mass campaigns or targeted outreach.\n\nExamples of diseases that have already been implemented in Starsim include sexually transmitted infections (HIV, HPV, and syphilis, including co-transmission), respiratory infections (tuberculosis and RSV), plus other diseases (Ebola and cholera) and underlying determinants of health (such as malnutrition).\n\nNote: Starsim is a general-purpose, multi-disease framework that builds on our previous suite of disease-specific models, which included `Covasim <https://covasim.org>`_, `HPVsim <https://hpvsim.org>`_, and `FPsim <https://fpsim.org>`_. In cases where a distinction needs to be made, Starsim is also known as the \"Starsim framework\", while this collection of other models is known as the \"Starsim suite\".\n\nFor more information about Starsim, please see the `documentation <https://docs.starsim.org>`__.\n\n\nRequirements\n------------\n\nPython 3.9-3.12.\n\nWe recommend, but do not require, installing Starsim in a virtual environment, such as `Anaconda <https://www.anaconda.com/products>`__.\n\n\nInstallation\n------------\n\nStarsim is most easily installed via PyPI: ``pip install starsim``.\n\nStarsim can also be installed locally. To do this, clone first this repository, then run ``pip install -e .`` (don't forget the dot at the end!).\n\n*Note:* Starsim leverages Intel's `short vector math library <https://numba.readthedocs.io/en/stable/user/performance-tips.html#intel-svml>`_. If you want to use this (for a ~10% speed improvement), install via `conda install intel-cmplr-lib-rt`.\n\n\nUsage and documentation\n-----------------------\n\nFull documentation, including tutorials and an API reference, is available at https://docs.starsim.org. \n\nYou can run a simple demo via::\n\n  import starsim as ss\n  ss.demo()\n\nHere is a slightly more realistic example of an SIR model with random connections between agents::\n\n  import starsim as ss\n\n  # Define the parameters\n  pars = dict(\n      n_agents = 5_000,     # Number of agents to simulate\n      networks = dict(      # Networks define how agents interact w/ each other\n          type = 'random',  # Here, we use a 'random' network\n          n_contacts = 10   # Each person has 10 contacts with other people  \n      ),\n      diseases = dict(      # *Diseases* add detail on what diseases to model\n          type = 'sir',     # Here, we're creating an SIR disease\n          init_prev = 0.01, # Proportion of the population initially infected\n          beta = 0.05,      # Probability of transmission between contacts\n      )\n  )\n\n  # Make the sim, run and plot\n  sim = ss.Sim(pars)\n  sim.run()\n  sim.plot() # Plot all the sim results\n  sim.diseases.sir.plot() # Plot the standard SIR curves\n\nMore usage examples are available in the tutorials, as well as the ``tests`` folder.\n\n\nStarsim structure\n-----------------\n\nAll core model code is located in the ``starsim`` subfolder; standard usage is ``import starsim as ss``.\n\nThe model consists of core classes including ``Sim``, ``People``, ``Disease``, ``Network``, ``Intervention``, and more. These classes contain methods for running, building simple or dynamic networks, generating random numbers, calculating results, plotting, etc.\n\nThe submodules of the Starsim folder are as follows:\n\n\u2022 ``arrays.py``: Classes to handle store and update states for people in networks in the simulation including living, mother, child, susceptible, infected, inoculated, recovered, etc.\n\u2022 ``calibration.py``: Class to handle automated calibration of the model to data.\n\u2022\t``demographics.py``: Classes to transform initial condition input parameters for use in building and utilizing networks.\n\u2022\t``disease.py``: Classes to manage infection rate of spread, prevalence, waning effects, and other parameters for specific diseases.\n\u2022\t``distributions.py``: Classes that handle statistical distributions used throughout Starsim to produce random numbers.\n\u2022\t``interventions.py``: The Intervention class, for adding interventions and dynamically modifying parameters, and classes for each of the specific interventions derived from it. The Analyzers class (for performing analyses on the sim while it's running), and other classes and functions for analyzing simulations.\n\u2022 ``loop.py``: The logic for the main simulation integration loop.\n\u2022\t``modules.py``: Class to handle \"module\" logic, such as updates (diseases, networks, etc).\n\u2022\t``networks.py``: Classes for creating simple and dynamic networks of people based on input parameters.\n\u2022\t``parameters.py``: Classes for creating the simulation parameters.\n\u2022\t``people.py``: The People class, for handling updates of state for each person.\n\u2022\t``products.py``: Classes to manage the deployment of vaccines and treatments.\n\u2022\t``results.py``: Classes to analyze and save results from simulations.\n\u2022\t``run.py``: Classes for running simulations (e.g. parallel runs and the Scenarios and MultiSim classes).\n\u2022\t``samples.py``: Class to store data from a large number of simulations.\n\u2022\t``settings.py``: User-customizable options for Starsim (e.g. default font size).\n\u2022\t``sim.py``: The Sim class, which performs most of the heavy lifting: initializing the model, running, and plotting.\n\u2022 ``time.py``: The Time class, which coordinates time between the Sim and different modules.\n\u2022\t``utils.py``: Helper functions.\n\u2022\t``version.py``: Version, date, and license information.\n\nThe ``diseases`` folder within the Starsim package contains definitions of different types of diseases, including STIs, Ebola, and cholera.\n\n\nContributing\n------------\n\nQuestions or comments can be directed to `info@starsim.org <mailto:info@starsim.org>`__ , or on this project\u2019s `GitHub <https://github.com/starsimhub/starsim>`__ page. Full information about Starsim is provided in the `documentation <https://docs.starsim.org>`__.\n\n\nDisclaimer\n----------\n\nThe code in this repository was developed by `IDM <https://idmod.org>`_, the `Burnet Institute <https://burnet.edu.au>`_, and other collaborators to support our joint research on flexible agent-based modeling. We've made it publicly available under the MIT License to provide others with a better understanding of our research and an opportunity to build upon it for their own work. We make no representations that the code works as intended or that we will provide support, address issues that are found, or accept pull requests. You are welcome to create your own fork and modify the code to suit your own modeling needs as permitted under the MIT License.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 - 2024 Bill & Melinda Gates Foundation  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A fast, flexible agent-based disease modeling framework",
    "version": "2.1.1",
    "project_urls": {
        "Source": "https://github.com/starsimhub/starsim/",
        "Website": "https://starsim.org"
    },
    "split_keywords": [
        "agent-based model",
        " simulation",
        " disease",
        " epidemiology"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "468fad8b301b9b4dc9da97a31b5753d9b416898c83f3cae7185b44bb82e78d8d",
                "md5": "7609d310cee8a14f68594f27b91fed51",
                "sha256": "2d9388d4c0da615648aff64cdc4064d153d4f00dd8dbe5d206c077cb88cbb8b9"
            },
            "downloads": -1,
            "filename": "starsim-2.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7609d310cee8a14f68594f27b91fed51",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 169337,
            "upload_time": "2024-11-08T06:43:30",
            "upload_time_iso_8601": "2024-11-08T06:43:30.790164Z",
            "url": "https://files.pythonhosted.org/packages/46/8f/ad8b301b9b4dc9da97a31b5753d9b416898c83f3cae7185b44bb82e78d8d/starsim-2.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0fb16d64b723a961a19343de5cfaa03abbb9a7ac10dcaa3b0cf15b0b1106e1f9",
                "md5": "47523268063c2e2a4640ee50c25b7677",
                "sha256": "f07623e95ae2cf4896518e9389a0aecf4aeb68029e4a8cb4add4c7a55a1dc64d"
            },
            "downloads": -1,
            "filename": "starsim-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "47523268063c2e2a4640ee50c25b7677",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 532722,
            "upload_time": "2024-11-08T06:43:34",
            "upload_time_iso_8601": "2024-11-08T06:43:34.603689Z",
            "url": "https://files.pythonhosted.org/packages/0f/b1/6d64b723a961a19343de5cfaa03abbb9a7ac10dcaa3b0cf15b0b1106e1f9/starsim-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-08 06:43:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "starsimhub",
    "github_project": "starsim",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "starsim"
}
        
Elapsed time: 9.71847s