coming soon...
epidemics
- The Python module and files.epidemics/cantons
- Cantons models and cantons data preparation.epidemics/country
- Country models and country data preparation.epidemics/data
- Base classes for data representation and preprocessing.epidemics/data/downloads
- Raw files downloaded by the Python scripts.epidemics/data/cache
- Files processed by the Python scripts.src/epidemics
- The C++ code.src/epidemics/model/country
- C++ country-level model implementations.src/epidemics/model/cantons
- C++ canton-level model implementations.test/py
- Python unit tests.test/cpp
- C++ unit tests.
Install the boost library by following these instructions. In macOS you can run
brew install boost
From the repository root folder do:
pip3 install jinja2
git submodule update --init --recursive
mkdir -p build
cd build
cmake ..
make
To run the tests, run the following command (from the repository root):
cd tests
./run_all_tests.sh
To run only Python tests, run cd tests/py && ./run.sh
.
To run only C++ tests, run cd build && ./libepidemics_unittests
.
If the C++ code is crashing, try enabling the backward-cpp library for printing the stack trace:
cmake -DENABLE_BACKWARD_CPP=ON ..
make
Install yapf.
pip3 install yapf
Format a file in-place
yapf -i FILE
Format all python files recursively in a directory in-place
yapf -ir DIR
Install clang-format
as part of clang using your package manager
or download a
static build
Format a file in-place
clang-format -i FILE
If the changes in the code are not reflected in the results, try erasing epidemics/data/cache
and epidemica/data/downloads
folders.
The cache decorators attempt to detect changes in the code, but may not always be successful.
Follow these steps to create a new C++ country-level model. The steps are shown on an example of creating a XYZ model from the existing SIR model.
- Make a copy of
src/epidemics/models/country/sir.h
and name itxyz.h
. - Change the
sir
namespace toxyz
.
- Update the
Parameters
struct. - Update the
State
struct: change the number of states inStateBase
parent class, and customize named getters. - Update the model, the
Solver::rhs
function. - Edit
src/epidemics/bindings/generate_bindings.py
and add your model to themain
function in the generate_country or generate_canton function. - Edit
CMakeLists.txt
and add your model to theGENERATED_COUNTRY_BINDINGS
variable. - Create a
test/py/test_country_xyz.py
analoguous totest_country_sir.h
and test your code. You may skip testing the derivatives, since AD should already be tested.
In the case AD does not support some operation, add it in src/epidemics/utils/autodiff.h
.
Create a test in test/cpp/test_autodiff.cpp
!