Steps to reproduce results#

Launching Jupyter Lab on BinderHub#

The model code can be executed without having to install anything on a local machine.

  1. Open the model code page of this book

  2. In the top right hand corner you will see that a rocket ship icon is added to the tool bar. Move the cursor over this rocket ship and select Binder from the drop down list

  3. Jupyter lab will now launch on BinderHub. This is a remote instance of Jupyter. You will be presented with a notebook containing the model code.

  4. From the Run menu select Run All. This will run all cells and reproduce the results of the study.

Launching a remote instance of Jupyter

Note that BinderHub will build a Docker image containing the required software and model code. If the instance has not been used for several days this will take several minutes to complete. The launch will speed up after an initial build. None of this is affected by the speed of your local machine.

Executing code in the book#

The model code can also be excuted directly from the pages of this book. To do this repeat steps 1-2 above, but select live code from the drop down menu. Blocks of code will now be converted to interactive and executable cells.

Executing the code on a local machine using Docker#

The model and software environment used to create it are available as a docker image.

You will need docker installed on your local machine from https://www.docker.com/products/docker-desktop

Downloading the image#

# pull the image containing the model from dockerhub 
docker pull tommonks01/treat_sim

Running the container and model.#

Open a terminal or cmd line

# run the docker image and map local port 8181 to port 80 on the container
docker run -p 8181:80 tommonks01/treat_sim

Launch a browser and navigate to:

localhost:8181

This launches Jupyter-Lab. The model can be found in the model.ipynb notebook.