{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Health care facilities - study steps\n", "------------------------------------\n", "This notebook runs a simulation with only a few people, just to show the study steps." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pysimpactcyan\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Setting data directory to /usr/local/share/simpact-cyan/\n" ] } ], "source": [ "# First, we'll need to tell the Simpact simulation engine to use the MaxART-specific simulation\n", "simpact = pysimpactcyan.PySimpactCyan()\n", "simpact.setSimulationPrefix(\"maxart\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Using identifier 'maxart-2016-03-08-16-36-10_6931_aWfQzxYG-'\n", "Results will be stored in directory '/tmp/simptest'\n", "Running simpact executable...\n", "Done.\n", "\n", "# read seed from /dev/urandom\n", "# Using seed 204635079\n", "# WARNING! Ignoring negative values when reading /usr/local/share/simpact-cyan/SWZ10adjv4.tif\n", "# Performing extra check on read configuration parameters\n", "# WARNING: ignoring consistency check for config key facilities.geo.coords (config value is '/usr/local/share/simpact-cyan/maxart-facilities.csv')\n", "# WARNING: ignoring consistency check for config key facilities.randomization (config value is '/tmp/maxart-randomization-fake_1.csv')\n", "# WARNING: ignoring consistency check for config key person.geo.dist2d.discrete.densfile (config value is '/usr/local/share/simpact-cyan/SWZ10adjv4.tif')\n", "# WARNING: ignoring consistency check for config key person.geo.dist2d.discrete.maskfile (config value is '/usr/local/share/simpact-cyan/hhohho_mask.tiff')\n", "# WARNING: ignoring consistency check for config key population.agedistfile (config value is '/usr/local/share/simpact-cyan/sa_2003.csv')\n", "# mNRM: using advanced algorithm\n", "# Release version\n", "# Simpact version is: 0.19.6testing\n", "# Current simulation time is 15\n", "# Number of events executed is 2415\n", "# Started with 200 people, ending with 184 (difference is -16)\n" ] } ], "source": [ "# We configure the simulation to use one of the files with fake randomization data\n", "# (which should have been saved to /tmp/maxart-randomization-fake_1.csv for this\n", "# exact configuration to work)\n", "\n", "cfg = { \"facilities.randomization\": \"/tmp/maxart-randomization-fake_1.csv\" }\n", "r = simpact.run(cfg, \"/tmp/simptest\")\n", "\n", "# We then read the steps as they have been written to a CSV log file\n", "steps = pd.read_csv(r[\"logsteps\"])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | time | \n", "Bulandzeni Clinic | \n", "Herefords Clinic | \n", "Hhukwini Clinic | \n", "Horo Clinic | \n", "Maguga Clinic | \n", "Malandzela Nazarene Clinic | \n", "Mshingishingini Nazarene Clinic | \n", "Ndvwabangeni Nazarene Clinic | \n", "Ndzingeni Nazarene Clinic | \n", "Ntfonjeni Clinic | \n", "Peak Nazarene Clinic | \n", "Pigg's Peak Government Hospital | \n", "Sigangeni Clinic | \n", "Siphocosini Clinic | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "5.00000 | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "
1 | \n", "5.33333 | \n", "C | \n", "T | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "T | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "C | \n", "
2 | \n", "5.66667 | \n", "C | \n", "I | \n", "C | \n", "C | \n", "T | \n", "C | \n", "C | \n", "I | \n", "C | \n", "T | \n", "C | \n", "C | \n", "C | \n", "C | \n", "
3 | \n", "6.00000 | \n", "C | \n", "I | \n", "C | \n", "T | \n", "I | \n", "C | \n", "C | \n", "I | \n", "C | \n", "I | \n", "T | \n", "C | \n", "C | \n", "C | \n", "
4 | \n", "6.33333 | \n", "T | \n", "I | \n", "C | \n", "I | \n", "I | \n", "C | \n", "C | \n", "I | \n", "C | \n", "I | \n", "I | \n", "C | \n", "C | \n", "T | \n", "
5 | \n", "6.66667 | \n", "I | \n", "I | \n", "T | \n", "I | \n", "I | \n", "T | \n", "C | \n", "I | \n", "C | \n", "I | \n", "I | \n", "C | \n", "C | \n", "I | \n", "
6 | \n", "7.00000 | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "C | \n", "I | \n", "T | \n", "I | \n", "I | \n", "T | \n", "C | \n", "I | \n", "
7 | \n", "7.33333 | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "T | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "T | \n", "I | \n", "
8 | \n", "7.66667 | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "I | \n", "
9 | \n", "8.00000 | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "Post | \n", "