# Atomica
[![Build Status](https://dev.azure.com/AtomicaTeam/Atomica/_apis/build/status/atomicateam.atomica?branchName=master)](https://dev.azure.com/AtomicaTeam/Atomica/_build/latest?definitionId=1&branchName=master)
[![PyPi version](https://badgen.net/pypi/v/atomica/)](https://pypi.com/project/atomica)
Atomica is a simulation engine for compartmental models. It can be used to simulate disease epidemics, health care cascades, and many other things.
For detailed documentation, visit [https://atomica.tools/docs](https://atomica.tools/docs)
## Installation
Atomica is available for Python 3 only. Because we develop using Python 3.7, it is possible that dictionary order is relevant (although we endeavour to use ordered dictionaries via `Sciris` in places where order matters). Therefore, we only _officially_ support Python 3.7, as this is the first Python release that guarantees ordering of all dictionaries.
Atomica is distributed via PyPI, and the PyPI version corresponds to `master` branch of this repository. To install via PyPI, it is only necessary to run
```
pip install atomica
```
Installation of `numpy`, `scipy` and `matplotlib` will automatically take place via `pip` because they are dependencies of Atomica. However, in practice these packages may require system-level setup so it is usually easiest to install them separately beforehand. We recommend using Anaconda, which facilitates getting the binaries and dependencies like QT installed in a platform-agnostic manner. We also recommend working within an Anaconda environment.
You may also wish to install `mkl` first, before installing `numpy` etc. to improve performance. So for example:
```
conda install mkl
conda install numpy scipy matplotlib
```
## Git installation
If you want to install a different branch of Atomica, or plan to make changes to the Atomica source code, you will need to install Atomica via Git rather than via PyPI. This can be performed using
```
git clone https://github.com/atomicateam/atomica.git
cd atomica
pip install -e .
```
## Running tests
Atomica includes a suite of tests, some of which get automatically run and others that are used manually. The automated test suite can be executed with `pytest`, and can be run from within an isolated environment using `tox`. To use the tests, you will need to follow the steps above to perform a 'Git installation' because the tests are not included in the PyPI distribution. After installation, you can run individual test scripts from the `tests` directory with commands like:
```
python tests/testworkflow.py
```
Note that many of the tests open `matplotlib` figures as part of the test. If the test script is run on a machine without a display available, the error
```
_tkinter.TclError: couldn't connect to display "localhost:0.0"
```
will be raised. In that case, simply set the `matplotlib` backend to `agg` which allows the calls to succeed with a display present. For example, run
```
export MPLBACKEND=agg
python tests/testworkflow.py
```
To run the automated suite, install the test dependencies using
```
pip install -r requirements.txt
```
which will install the additional development dependencies. Then, to run the automated suite, from the root directory (the one containing `README.md`) run:
```
pytest
```
To run the tests in an isolated virtual environment, from the root directory, run
```
tox
```
If you don't have `tox`, install it using `pip install tox`. The default configuration expects Python 3.6 and Python 3.7 to be on your system - to test only against a specific version, pass the python version as an argument to `tox` e.g.
```
tox -e py37
```
to test Python 3.7 only.
## Troubleshooting
### Installation fails due to missing `numpy`
If running `pip install -e .` in a new environment, `numpy` must be installed prior to `scipy`. In some cases,
installing `numpy` may fail due to missing compiler options. In that case, you may wish to install `numpy` via Anaconda
(by installing Python through Anaconda, and using `conda install numpy scipy matplotlib`). In general, our experience
has been that it is easier to set up the C binaries for `numpy` and the QT dependencies for `matplotlib` via Anaconda
rather than doing this via the system, which involves different steps on every platform.
### Figure plotting hangs
On some systems, the default `matplotlib` backend may hang - this is not an issue with `atomica`. To resolve, try changing the backend by including
```
import matplotlib
matplotlib.use("Qt5Agg")
```
at the very start of your script. A different backend may be required for your system. You can make the change persistant by setting the backend in your `matplotlibrc` file.
Raw data
{
"_id": null,
"home_page": "https://atomica.tools",
"name": "atomica",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "dynamic, compartment, optimization, disease",
"author": "Atomica Team",
"author_email": "info@atomica.tools",
"download_url": "https://files.pythonhosted.org/packages/7a/90/87e26c1692c7962ed17ee9651b0fbdff455c21986bdcc0562ef786d6e6ef/atomica-1.28.5.tar.gz",
"platform": "OS Independent",
"description": "# Atomica\n\n[![Build Status](https://dev.azure.com/AtomicaTeam/Atomica/_apis/build/status/atomicateam.atomica?branchName=master)](https://dev.azure.com/AtomicaTeam/Atomica/_build/latest?definitionId=1&branchName=master)\n\n[![PyPi version](https://badgen.net/pypi/v/atomica/)](https://pypi.com/project/atomica)\n\nAtomica is a simulation engine for compartmental models. It can be used to simulate disease epidemics, health care cascades, and many other things.\n\nFor detailed documentation, visit [https://atomica.tools/docs](https://atomica.tools/docs)\n\n## Installation\n\nAtomica is available for Python 3 only. Because we develop using Python 3.7, it is possible that dictionary order is relevant (although we endeavour to use ordered dictionaries via `Sciris` in places where order matters). Therefore, we only _officially_ support Python 3.7, as this is the first Python release that guarantees ordering of all dictionaries.\n\nAtomica is distributed via PyPI, and the PyPI version corresponds to `master` branch of this repository. To install via PyPI, it is only necessary to run\n\n```\npip install atomica\n```\n\nInstallation of `numpy`, `scipy` and `matplotlib` will automatically take place via `pip` because they are dependencies of Atomica. However, in practice these packages may require system-level setup so it is usually easiest to install them separately beforehand. We recommend using Anaconda, which facilitates getting the binaries and dependencies like QT installed in a platform-agnostic manner. We also recommend working within an Anaconda environment.\n\nYou may also wish to install `mkl` first, before installing `numpy` etc. to improve performance. So for example:\n\n```\nconda install mkl\nconda install numpy scipy matplotlib\n```\n\n## Git installation\n\nIf you want to install a different branch of Atomica, or plan to make changes to the Atomica source code, you will need to install Atomica via Git rather than via PyPI. This can be performed using\n\n```\ngit clone https://github.com/atomicateam/atomica.git\ncd atomica\npip install -e .\n```\n\n## Running tests\n\nAtomica includes a suite of tests, some of which get automatically run and others that are used manually. The automated test suite can be executed with `pytest`, and can be run from within an isolated environment using `tox`. To use the tests, you will need to follow the steps above to perform a 'Git installation' because the tests are not included in the PyPI distribution. After installation, you can run individual test scripts from the `tests` directory with commands like:\n\n```\npython tests/testworkflow.py\n```\n\nNote that many of the tests open `matplotlib` figures as part of the test. If the test script is run on a machine without a display available, the error\n\n```\n_tkinter.TclError: couldn't connect to display \"localhost:0.0\"\n```\n\nwill be raised. In that case, simply set the `matplotlib` backend to `agg` which allows the calls to succeed with a display present. For example, run\n\n```\nexport MPLBACKEND=agg\npython tests/testworkflow.py\n```\n\nTo run the automated suite, install the test dependencies using\n\n```\npip install -r requirements.txt\n```\n\nwhich will install the additional development dependencies. Then, to run the automated suite, from the root directory (the one containing `README.md`) run:\n\n```\npytest\n```\n\nTo run the tests in an isolated virtual environment, from the root directory, run\n\n```\ntox\n```\n\nIf you don't have `tox`, install it using `pip install tox`. The default configuration expects Python 3.6 and Python 3.7 to be on your system - to test only against a specific version, pass the python version as an argument to `tox` e.g.\n\n```\ntox -e py37\n```\n\nto test Python 3.7 only. \n\n## Troubleshooting\n\n### Installation fails due to missing `numpy`\n\nIf running `pip install -e .` in a new environment, `numpy` must be installed prior to `scipy`. In some cases,\ninstalling `numpy` may fail due to missing compiler options. In that case, you may wish to install `numpy` via Anaconda\n(by installing Python through Anaconda, and using `conda install numpy scipy matplotlib`). In general, our experience\nhas been that it is easier to set up the C binaries for `numpy` and the QT dependencies for `matplotlib` via Anaconda\nrather than doing this via the system, which involves different steps on every platform.\n\n### Figure plotting hangs\n\nOn some systems, the default `matplotlib` backend may hang - this is not an issue with `atomica`. To resolve, try changing the backend by including \n\n```\nimport matplotlib\nmatplotlib.use(\"Qt5Agg\")\n```\n\nat the very start of your script. A different backend may be required for your system. You can make the change persistant by setting the backend in your `matplotlibrc` file.\n",
"bugtrack_url": null,
"license": null,
"summary": "Toolbox for compartment-based dynamic systems with costing and optimization",
"version": "1.28.5",
"project_urls": {
"Homepage": "https://atomica.tools"
},
"split_keywords": [
"dynamic",
" compartment",
" optimization",
" disease"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ef7e79834f700907718fd2da66b18b1e6cf32d5d1b0f39fd441f260f3d30c95e",
"md5": "9210ffae2c3ec08c8ec0823e5227422e",
"sha256": "bf39dbc475493d7eb36275c5d19e4c717a8480e368782e283dd348488e7c54b8"
},
"downloads": -1,
"filename": "atomica-1.28.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9210ffae2c3ec08c8ec0823e5227422e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1596629,
"upload_time": "2024-06-30T23:08:13",
"upload_time_iso_8601": "2024-06-30T23:08:13.054144Z",
"url": "https://files.pythonhosted.org/packages/ef/7e/79834f700907718fd2da66b18b1e6cf32d5d1b0f39fd441f260f3d30c95e/atomica-1.28.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7a9087e26c1692c7962ed17ee9651b0fbdff455c21986bdcc0562ef786d6e6ef",
"md5": "f1e86ab065e3126a17e36f8163711d4c",
"sha256": "ae59413cd4d0eeae7c226afdaf44a5c3f9a8459820365160cc29eb0b05bd1f69"
},
"downloads": -1,
"filename": "atomica-1.28.5.tar.gz",
"has_sig": false,
"md5_digest": "f1e86ab065e3126a17e36f8163711d4c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1578667,
"upload_time": "2024-06-30T23:08:16",
"upload_time_iso_8601": "2024-06-30T23:08:16.419477Z",
"url": "https://files.pythonhosted.org/packages/7a/90/87e26c1692c7962ed17ee9651b0fbdff455c21986bdcc0562ef786d6e6ef/atomica-1.28.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-30 23:08:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "atomica"
}