Giter Site home page Giter Site logo

clorton / cms-containerized Goto Github PK

View Code? Open in Web Editor NEW

This project forked from institutefordiseasemodeling/cms-containerized

0.0 1.0 0.0 1.83 MB

CMS in a Docker container with examples

License: MIT License

Scheme 96.34% Python 3.24% Dockerfile 0.42%

cms-containerized's Introduction

IDM Compartmental Modeling Software (CMS) in a Docker Container

Includes Python interface example using Python.NET

Quick Start with Docker

Get a local copy of the docker container image

Option 1- skip to examples below and let Docker pull the requisite image

Option 2- pull the image from Docker Hub:

docker pull clorton/idmcms:1.0

Option 3- build the image locally:

docker build --tag clorton/idmcms:1.0 .

Run a Model with CMS

Options:

Note: the examples below use Unix/Linux bash syntax to get the current directory, $(pwd). If running on Windows, explicitly list the current path in place of $(pwd).

  1. Run the default model/command in the container (python3 /cms/seir.py).
docker run --rm -it -v $(pwd):/host -w /host clorton/idmcms:1.1

This will write trajectory data to trajectories.net.csv and a plot to trajectory.png in the current directory, mapped to /host in the container. The model is not modifiable as this default command runs the model included in the container. See options 2 or 3 for running other models.

  1. _Run the model of your choice, written in EMODL, directly in CMS with the Mono .Net runtime.
docker run --rm -it -v $(pwd)/models:/host -w /host clorton/idmcms:1.1 mono /cms/compartments.exe --model seir.emodl --config seir.cfg
  • Replace $(pwd)/models with your model directory path.
  • Replace seir.emodl and seir.cfg with your model file and configuration, respectively.

This will write trajectory data to file specified in the configuration.

  1. Run a model, e.g. SEIR, with Python.
docker run --rm -it -v $(pwd)/models:/host -w /host clorton/idmcms:1.1 python3 seir.py --png

This example, called from the root of the repository on your machine or codespace, runs the example seir.py, SEIR model implemented in Python and writes trajectories.net.csv and trajectory.png into the mapped directory (./models in the example).

Sample Output

SEIR Trajectory Data (CMS)

FrameworkVersion,"1.0.176.23","clorton (CMS/Main/framework)"
sampletimes,0,1,2,3,...,179,180
S{0},990,983,979,975,...,372,375
E{0},0,5,7,7,...,0,0
I{0},10,10,12,10,...,0,0
R{0},0,2,2,8,...,628,625
cumulative{0},0,7,11,15,...,938,938
population{0},1000,1000,1000,1000,...,1000,1000

Note that CMS can run multiple realizations of the model in a single invocation. The realization index is appended to each column to differentiate results from separate realizations.

SEIR Trajectory Data (Python)

,S{0},E{0},I{0},R{0},cumulative{0},population{0}
0,990.0,0.0,10.0,0.0,0.0,1000.0
1,985.0,4.0,9.0,2.0,5.0,1000.0
2,982.0,6.0,9.0,3.0,8.0,1000.0
3,977.0,9.0,7.0,7.0,13.0,1000.0
...
178,292.0,0.0,0.0,708.0,1040.0,1000.0
179,294.0,0.0,0.0,706.0,1040.0,1000.0

Note that Python trajectory data comes from a Pandas Dataframe and omits the "index" column name in the first column of the first row.

SEIR Trajectory Plot (Python)

SEIR Trajectory Plot

Additional Information and Documentation

  • PyCMS : The initial motivation for packaging CMS in a container.
  • IDM-CMS : Source code and documentation for the CMS engine.

cms-containerized's People

Contributors

clorton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.