This github repository hosts both the cadCAD model for monitoring consensus pledge as well as the streamlit dashboard which displays it. Economic incentives can be explored through scenario analysis which cadCAD supports using monte carlo simulations
- Option 1 (CLI): Just pass
python -m consensus_pledge_model
This will generate an pickled file atdata/simulations/
using the default single run system parameters & initial state.- To perform a multiple run, pass
python -m consensus_pledge_model -e
- To perform a multiple run, pass
- Option 2 (cadCAD-tools easy run method): Import the objects at
consensus_pledge_model/__init__.py
and use them as arguments to thecadCAD_tools.execution.easy_run
method. Refer toconsensus_pledge_model/__main__.py
to an example. - Option 3 (Streamlit, local)
streamlit run app/main.py
- Option 4 (Streamlit, cloud)
- Fork the repo
- Go to https://share.streamlit.io/ and log in
- Create an app for the repo pointing to
app/main.py
- Make sure to use Python 3.9 on the Advanced Settings!
- Wait a bit and done!
.
├── LICENSE
├── README.md
├── SPEC.md
├── app: The `streamlit` app
│ ├── assets
│ │ ├── icon.png
│ │ └── logo.png
│ ├── chart.py
│ ├── const.yaml
│ ├── description.py
│ ├── glossary.py
│ ├── main.py
│ ├── model.py
│ └── utils.py
├── consensus_pledge_model: the `cadCAD` model as encapsulated by a Python Module
│ ├── __init__.py
│ ├── __main__.py
│ ├── experiment.py: Code for running experiments
│ ├── logic.py: All logic for substeps
│ ├── params.py: System parameters
│ ├── structure.py: The PSUB structure
│ └── types.py: Types used in model
├── notebooks: Notebooks for aiding in development
│ ├── Testing.ipynb
│ ├── nb_test_consensus_pledge_demo.py
│ └── simulation_eda.ipynb
├── profiling
│ ├── output.png
│ ├── output.pstats
│ └── profile_default_run.sh
├── requirements-dev.txt: Dev requirements
├── requirements.txt: Production requirements
└── tests: Test scenarios
├── __init__.py
└── test_scenario.py
1. Pre-installation Virtual Environments with venv
(Optional):
It's a good package managing practice to create an easy to use virtual environment to install cadCAD. You can use the built in venv
package.
Create a virtual environment:
$ python3 -m venv ~/cadcad
Activate an existing virtual environment:
$ source ~/cadcad/bin/activate
(cadcad) $
Deactivate virtual environment:
(cadcad) $ deactivate
$
Requires >= Python 3.6
Install Using pip
$ pip3 install cadcad==0.4.28
Install all packages with requirement.txt
$ pip3 install -r requirements.txt