Package: atomica
AtomicaAtomica 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, visithttps://atomica.tools/docsInstallationAtomica 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 viaScirisin places where order matters). Therefore, we onlyofficiallysupport 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 tomasterbranch of this repository. To install via PyPI, it is only necessary to runpip install atomicaInstallation ofnumpy,scipyandmatplotlibwill automatically take place viapipbecause 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 installmklfirst, before installingnumpyetc. to improve performance. So for example:conda install mkl
conda install numpy scipy matplotlibGit installationIf 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 usinggit clone https://github.com/atomicateam/atomica.git
cd atomica
pip install -e .Running testsAtomica includes a suite of tests, some of which get automatically run and others that are used manually. The automated test suite can be executed withpytest, and can be run from within an isolated environment usingtox. 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 thetestsdirectory with commands like:python tests/testworkflow.pyNote that many of the tests openmatplotlibfigures 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 thematplotlibbackend toaggwhich allows the calls to succeed with a display present. For example, runexport MPLBACKEND=agg
python tests/testworkflow.pyTo run the automated suite, install the test dependencies usingpip install -r requirements.txtwhich will install the additional development dependencies. Then, to run the automated suite, from the root directory (the one containingREADME.md) run:pytestTo run the tests in an isolated virtual environment, from the root directory, runtoxIf you don't havetox, install it usingpip 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 totoxe.g.tox -e py37to test Python 3.7 only.TroubleshootingInstallation fails due to missingnumpyIf runningpip install -e .in a new environment,numpymust be installed prior toscipy. In some cases,
installingnumpymay fail due to missing compiler options. In that case, you may wish to installnumpyvia Anaconda
(by installing Python through Anaconda, and usingconda install numpy scipy matplotlib). In general, our experience
has been that it is easier to set up the C binaries fornumpyand the QT dependencies formatplotlibvia Anaconda
rather than doing this via the system, which involves different steps on every platform.Figure plotting hangsOn some systems, the defaultmatplotlibbackend may hang - this is not an issue withatomica. To resolve, try changing the backend by includingimport 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 yourmatplotlibrcfile.