{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T12:41:48.007238Z",
     "start_time": "2017-10-19T14:41:47.980725+02:00"
    }
   },
   "source": [
    "# Soil Tutorial"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T16:44:14.120953Z",
     "start_time": "2017-07-02T18:44:14.117152+02:00"
    }
   },
   "source": [
    "## Introduction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "cell_style": "center",
    "collapsed": true
   },
   "source": [
    "This notebook is an introduction to the soil agent-based social network simulation framework.\n",
    "In particular, we will focus on a specific use case: studying the propagation of news in a social network.\n",
    "\n",
    "The steps we will follow are:\n",
    "\n",
    "* Modelling the behavior of agents\n",
    "* Running the simulation using different configurations\n",
    "* Analysing the results of each simulation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T13:38:48.052876Z",
     "start_time": "2017-07-03T15:38:48.044762+02:00"
    }
   },
   "source": [
    "But before that, let's import the soil module and networkx."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:58:13.451481Z",
     "start_time": "2017-11-03T11:58:12.643469+01:00"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The autoreload extension is already loaded. To reload it, use:\n",
      "  %reload_ext autoreload\n",
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    }
   ],
   "source": [
    "import soil\n",
    "import networkx as nx\n",
    " \n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "%pylab inline\n",
    "# To display plots in the notebooed_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T13:41:19.788717Z",
     "start_time": "2017-07-03T15:41:19.785448+02:00"
    }
   },
   "source": [
    "## Basic concepts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "There are three main elements in a soil simulation:\n",
    "    \n",
    "* The network topology. A simulation may use an existing NetworkX topology, or generate one on the fly\n",
    "* Agents. There are two types: 1) network agents, which are linked to a node in the topology, and 2) environment agents, which are freely assigned to the environment.\n",
    "* The environment. It assigns agents to nodes in the network, and stores the environment parameters (shared state for all agents).\n",
    "\n",
    "Soil is based on ``simpy``, which is an event-based network simulation library.\n",
    "Soil provides several abstractions over events to make developing agents easier.\n",
    "This means you can use events (timeouts, delays) in soil, but for the most part we will assume your models will be step-based.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T15:55:12.933978Z",
     "start_time": "2017-07-02T17:55:12.930860+02:00"
    }
   },
   "source": [
    "## Modeling behaviour"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T13:49:31.269687Z",
     "start_time": "2017-07-03T15:49:31.257850+02:00"
    }
   },
   "source": [
    "Our first step will be to model how every person in the social network reacts when it comes to news.\n",
    "We will follow a very simple model (a finite state machine).\n",
    "\n",
    "There are two types of people, those who have heard about a newsworthy event (infected) or those who have not (neutral).\n",
    "A neutral person may heard about the news either on the TV (with probability **prob_tv_spread**) or through their friends.\n",
    "Once a person has heard the news, they will spread it to their friends (with a probability **prob_neighbor_spread**).\n",
    "Some users do not have a TV, so they only rely on their friends.\n",
    "\n",
    "The spreading probabilities will change over time due to different factors.\n",
    "We will represent this variance using an environment agent."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Network Agents"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T14:03:07.171127Z",
     "start_time": "2017-07-03T16:03:07.165779+02:00"
    }
   },
   "source": [
    "A basic network agent in Soil would typically inherit from ``soil.agents.NetworkAgent``, and define its behaviour in every step of the simulation by implementing a ``run(self)`` method.\n",
    "The most important attributes of the agent are:\n",
    "\n",
    "* ``agent.state``, a dictionary with the state of the agent. This tate will be saved in every step of the simulation. It can be accessed from the agent as well:\n",
    "```py\n",
    "a = soil.agents.NetworkAgent(env=env)\n",
    "agent.state['hours_of_sleep'] = 10\n",
    "# is the same as\n",
    "a['hours_of_sleep'] = 10\n",
    "```\n",
    "  The state of the agent is stored in every step of the simulation:\n",
    "  ```py\n",
    "  print(a['hours_of_sleep', 10]) # hours of sleep before step #10\n",
    "  print(a[None, 0]) # whole state of the agent before step #0\n",
    "  ```\n",
    "\n",
    "* ``agent.env``, a reference to the environment. Most commonly used to get access to the environment parameters and the topology:\n",
    "    ```py\n",
    "    a.env.G.nodes() # Get all nodes ids in the topology\n",
    "    a.env['minimum_hours_of_sleep']\n",
    "\n",
    "    ```\n",
    "\n",
    "Since our model is a finite state machine, we will be basing it on ``soil.agents.FSM``.\n",
    "\n",
    "Agents that inherit from ``soil.agents.FSM`` do not need to specify a ``step`` method.\n",
    "Instead, we describe each finite state with a function.\n",
    "To change to another state, a function may return the new state, or the ``id`` of a state.\n",
    "If no state is returned, the state remains unchanged.\n",
    "\n",
    "The current state of the agent can be checked with ``agent.state['id']``. That state id can be used to look for other networks in that specific state\n",
    "\n",
    "\n",
    "Our agent will have of two states, ``neutral`` (default) and ``infected``.\n",
    "\n",
    "Here's the code:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:58:16.051690Z",
     "start_time": "2017-11-03T11:58:16.006044+01:00"
    }
   },
   "outputs": [],
   "source": [
    "import random\n",
    "\n",
    "class NewsSpread(soil.agents.FSM):\n",
    "    @soil.agents.default_state\n",
    "    @soil.agents.state\n",
    "    def neutral(self):\n",
    "        r = random.random()\n",
    "        if self['has_tv'] and r < self.env['prob_tv_spread']:\n",
    "                return self.infected\n",
    "        return\n",
    "    \n",
    "    @soil.agents.state\n",
    "    def infected(self):\n",
    "        prob_infect = self.env['prob_neighbor_spread']\n",
    "        for neighbor in self.get_neighboring_agents(state_id=self.neutral.id):\n",
    "            r = random.random()\n",
    "            if r < prob_infect:\n",
    "                neighbor.next_state(self.infected.id)\n",
    "        return\n",
    "        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T12:22:53.931963Z",
     "start_time": "2017-07-02T14:22:53.928340+02:00"
    }
   },
   "source": [
    "### Environment agents"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Environment agents allow us to control the state of the environment.\n",
    "In this case, we will use an environment agent to simulate a very viral event.\n",
    "\n",
    "When the event happens, the agent will modify the probability of spreading the rumor."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:58:17.653736Z",
     "start_time": "2017-11-03T11:58:17.612944+01:00"
    }
   },
   "outputs": [],
   "source": [
    "NEIGHBOR_FACTOR = 0.9\n",
    "TV_FACTOR = 0.5\n",
    "\n",
    "\n",
    "class NewsEnvironmentAgent(soil.agents.NetworkAgent):\n",
    "    def step(self):\n",
    "        if self.now == self['event_time']:\n",
    "            self.env['prob_tv_spread'] = 1\n",
    "            self.env['prob_neighbor_spread'] = 1\n",
    "        elif self.now > self['event_time']:\n",
    "            self.env['prob_tv_spread'] = self.env['prob_tv_spread'] * TV_FACTOR\n",
    "            self.env['prob_neighbor_spread'] = self.env['prob_neighbor_spread'] * NEIGHBOR_FACTOR"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T11:23:18.052235Z",
     "start_time": "2017-07-02T13:23:18.047452+02:00"
    }
   },
   "source": [
    "### Testing the agents"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T16:14:54.572431Z",
     "start_time": "2017-07-02T18:14:54.564095+02:00"
    }
   },
   "source": [
    "Feel free to skip this section if this is your first time with soil."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Testing agents is not easy, and this is not a thorough testing process for agents.\n",
    "Rather, this section is aimed to show you how to access internal pats of soil so you can test your agents."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "cell_style": "split"
   },
   "source": [
    "First of all, let's check if our network agent has the states we would expect:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:58:19.781155Z",
     "start_time": "2017-11-03T11:58:19.754362+01:00"
    },
    "cell_style": "split"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'neutral': <function __main__.NewsSpread.neutral(self)>,\n",
       " 'infected': <function __main__.NewsSpread.infected(self)>}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "NewsSpread.states"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "cell_style": "split"
   },
   "source": [
    "Now, let's run a simulation on a simple network. It is comprised of three nodes:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:58:20.791777Z",
     "start_time": "2017-11-03T11:58:20.565173+01:00"
    },
    "cell_style": "split",
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 6608 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "G = nx.Graph()\n",
    "G.add_edge(0, 1)\n",
    "G.add_edge(0, 2)\n",
    "G.add_edge(2, 3)\n",
    "G.add_node(4)\n",
    "pos = nx.spring_layout(G)\n",
    "nx.draw_networkx(G, pos, node_color='red')\n",
    "nx.draw_networkx(G, pos, nodelist=[0], node_color='blue')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T11:53:30.997756Z",
     "start_time": "2017-07-03T13:53:30.989609+02:00"
    },
    "cell_style": "split"
   },
   "source": [
    "Let's run a simple simulation that assigns a NewsSpread agent to all the nodes in that network.\n",
    "Notice how node 0 is the only one with a TV."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<module 'soil.agents' from '/home/j/git/lab.gsi/soil/soil/soil/agents/__init__.py'>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import importlib\n",
    "importlib.reload(soil.agents)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:58:55.517768Z",
     "start_time": "2017-11-03T11:58:55.424083+01:00"
    },
    "cell_style": "split"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:soil:Using exporters: [<class 'soil.exporters.default'>]\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Unnamed at 21:51:19.\n",
      "INFO:soil:NOT dumping results\n",
      "INFO:soil:Starting Simulation Unnamed trial Unnamed_trial_1605822679-0170248 at 21:51:19.\n",
      "INFO:soil:Finished Simulation Unnamed trial Unnamed_trial_1605822679-0170248 at 21:51:19 in 0.006684064865112305 seconds\n",
      "INFO:soil:Finished simulation Unnamed at 21:51:19 in 0.011702775955200195 seconds\n"
     ]
    }
   ],
   "source": [
    "env_params = {'prob_tv_spread': 0,\n",
    "             'prob_neighbor_spread': 0}\n",
    "\n",
    "MAX_TIME = 100\n",
    "EVENT_TIME = 10\n",
    "\n",
    "sim = soil.Simulation(topology=G,\n",
    "                      num_trials=1,\n",
    "                      max_time=MAX_TIME,\n",
    "                      environment_agents=[{'agent_type': NewsEnvironmentAgent,\n",
    "                                           'state': {\n",
    "                                           'event_time': EVENT_TIME\n",
    "                                         }}],\n",
    "                      network_agents=[{'agent_type': NewsSpread,\n",
    "                                      'weight': 1}],\n",
    "                      states={0: {'has_tv': True}},\n",
    "                      default_state={'has_tv': False},\n",
    "                      environment_params=env_params)\n",
    "env = sim.run_simulation(dry_run=True)[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "cell_style": "split"
   },
   "source": [
    "Now we can access the results of the simulation and compare them to our expected results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-03T10:59:01.577474Z",
     "start_time": "2017-11-03T11:59:01.414215+01:00"
    },
    "cell_style": "split",
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "agents = list(env.network_agents)\n",
    "\n",
    "# Until the event, all agents are neutral\n",
    "for t in range(10):\n",
    "    for a in agents:\n",
    "        assert a['id', t] == a.neutral.id\n",
    "\n",
    "# After the event, the node with a TV is infected, the rest are not\n",
    "assert agents[0]['id', 11] == NewsSpread.infected.id\n",
    "assert agents[2]['id', 11] == NewsSpread.neutral.id\n",
    "\n",
    "\n",
    "# At the end, the agents connected to the infected one will probably be infected, too.\n",
    "assert agents[1]['id', MAX_TIME] == NewsSpread.infected.id\n",
    "assert agents[2]['id', MAX_TIME] == NewsSpread.infected.id\n",
    "\n",
    "# But the node with no friends should not be affected\n",
    "assert agents[4]['id', MAX_TIME] == NewsSpread.neutral.id\n",
    "        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T16:41:09.110652Z",
     "start_time": "2017-07-02T18:41:09.106966+02:00"
    },
    "cell_style": "split"
   },
   "source": [
    "Lastly, let's see if the probabilities have decreased as expected:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-01T14:07:55.288616Z",
     "start_time": "2017-11-01T15:07:55.241116+01:00"
    },
    "cell_style": "split"
   },
   "outputs": [],
   "source": [
    "assert abs(env.environment_params['prob_neighbor_spread'] - (NEIGHBOR_FACTOR**(MAX_TIME-1-10))) < 10e-4\n",
    "assert abs(env.environment_params['prob_tv_spread'] - (TV_FACTOR**(MAX_TIME-1-10))) < 10e-6"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Running the simulation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T11:20:28.566944Z",
     "start_time": "2017-07-03T13:20:28.561052+02:00"
    },
    "cell_style": "split"
   },
   "source": [
    "To run a simulation, we need a configuration.\n",
    "Soil can load configurations from python dictionaries as well as JSON and YAML files.\n",
    "For this demo, we will use a python dictionary:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-01T14:07:57.008940Z",
     "start_time": "2017-11-01T15:07:56.966433+01:00"
    },
    "cell_style": "split"
   },
   "outputs": [],
   "source": [
    "config = {\n",
    "    'name': 'ExampleSimulation',\n",
    "    'max_time': 20,\n",
    "    'interval': 1,\n",
    "    'num_trials': 1,\n",
    "    'network_params': {\n",
    "       'generator': 'complete_graph',\n",
    "        'n': 500,\n",
    "    },\n",
    "    'network_agents': [\n",
    "        {\n",
    "            'agent_type': NewsSpread,\n",
    "            'weight': 1,\n",
    "            'state': {\n",
    "                'has_tv': False\n",
    "            }\n",
    "        },\n",
    "        {\n",
    "            'agent_type': NewsSpread,\n",
    "            'weight': 2,\n",
    "            'state': {\n",
    "                'has_tv': True\n",
    "            }\n",
    "        }\n",
    "    ],\n",
    "    'environment_agents':[\n",
    "        {'agent_type': NewsEnvironmentAgent,\n",
    "         'state': {\n",
    "             'event_time': 10\n",
    "         }\n",
    "        }\n",
    "    ],\n",
    "    'states': [ {'has_tv': True} ],\n",
    "    'environment_params':{\n",
    "        'prob_tv_spread': 0.01,\n",
    "        'prob_neighbor_spread': 0.5\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T11:57:34.219618Z",
     "start_time": "2017-07-03T13:57:34.213817+02:00"
    },
    "cell_style": "split"
   },
   "source": [
    "Let's run our simulation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-01T14:08:34.312637Z",
     "start_time": "2017-11-01T15:07:57.774458+01:00"
    },
    "cell_style": "split"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:soil:Using config(s): ExampleSimulation\n",
      "INFO:soil:Using exporters: [<class 'soil.exporters.default'>]\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation ExampleSimulation at 21:51:20.\n",
      "INFO:soil:NOT dumping results\n",
      "INFO:soil:Starting Simulation ExampleSimulation trial ExampleSimulation_trial_1605822680-0185008 at 21:51:20.\n",
      "INFO:soil:Finished Simulation ExampleSimulation trial ExampleSimulation_trial_1605822680-0185008 at 21:51:22 in 1.9917693138122559 seconds\n",
      "INFO:soil:Finished simulation ExampleSimulation at 21:51:22 in 2.4902079105377197 seconds\n"
     ]
    }
   ],
   "source": [
    "soil.simulation.run_from_config(config, dry_run=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T12:03:32.183588Z",
     "start_time": "2017-07-03T14:03:32.167797+02:00"
    },
    "cell_style": "split",
    "collapsed": true
   },
   "source": [
    "In real life, you probably want to run several simulations, varying some of the parameters so that you can compare and answer your research questions.\n",
    "\n",
    "For instance:\n",
    "    \n",
    "* Does the outcome depend on the structure of our network? We will use different generation algorithms to compare them (Barabasi-Albert and Erdos-Renyi)\n",
    "* How does neighbor spreading probability affect my simulation? We will try probability values in the range of [0, 0.4], in intervals of 0.1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-01T14:10:38.099667Z",
     "start_time": "2017-11-01T15:10:06.008314+01:00"
    },
    "cell_style": "split",
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:soil:Using config(s): Spread_erdos_renyi_graph_prob_0.0\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_erdos_renyi_graph_prob_0.0 at 21:51:22.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.0\n",
      "INFO:soil:Starting Simulation Spread_erdos_renyi_graph_prob_0.0 trial Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892 at 21:51:24.\n",
      "INFO:soil:Finished Simulation Spread_erdos_renyi_graph_prob_0.0 trial Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892 at 21:51:24 in 0.2903263568878174 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_erdos_renyi_graph_prob_0.0 trial Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892 at 21:51:24.\n",
      "INFO:soil:Finished Dumping simulation Spread_erdos_renyi_graph_prob_0.0 trial Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892 at 21:51:24 in 0.0013904571533203125 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.0 trial Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.0 at 21:51:24.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.0 trial Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.0 at 21:51:24 in 0.00780940055847168 seconds\n",
      "INFO:soil:Finished simulation Spread_erdos_renyi_graph_prob_0.0 at 21:51:24 in 1.8845770359039307 seconds\n",
      "INFO:soil:Using config(s): Spread_erdos_renyi_graph_prob_0.1\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_erdos_renyi_graph_prob_0.1 at 21:51:24.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.1\n",
      "INFO:soil:Starting Simulation Spread_erdos_renyi_graph_prob_0.1 trial Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185 at 21:51:26.\n",
      "INFO:soil:Finished Simulation Spread_erdos_renyi_graph_prob_0.1 trial Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185 at 21:51:26 in 0.4628722667694092 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_erdos_renyi_graph_prob_0.1 trial Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185 at 21:51:26.\n",
      "INFO:soil:Finished Dumping simulation Spread_erdos_renyi_graph_prob_0.1 trial Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185 at 21:51:26 in 0.0014166831970214844 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.1 trial Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.1 at 21:51:26.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.1 trial Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.1 at 21:51:26 in 0.007503986358642578 seconds\n",
      "INFO:soil:Finished simulation Spread_erdos_renyi_graph_prob_0.1 at 21:51:26 in 2.144615888595581 seconds\n",
      "INFO:soil:Using config(s): Spread_erdos_renyi_graph_prob_0.2\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_erdos_renyi_graph_prob_0.2 at 21:51:26.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.2\n",
      "INFO:soil:Starting Simulation Spread_erdos_renyi_graph_prob_0.2 trial Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787 at 21:51:28.\n",
      "INFO:soil:Finished Simulation Spread_erdos_renyi_graph_prob_0.2 trial Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787 at 21:51:28 in 0.37325096130371094 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_erdos_renyi_graph_prob_0.2 trial Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787 at 21:51:28.\n",
      "INFO:soil:Finished Dumping simulation Spread_erdos_renyi_graph_prob_0.2 trial Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787 at 21:51:28 in 0.0016696453094482422 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.2 trial Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.2 at 21:51:28.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.2 trial Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.2 at 21:51:28 in 0.007451057434082031 seconds\n",
      "INFO:soil:Finished simulation Spread_erdos_renyi_graph_prob_0.2 at 21:51:28 in 1.9053213596343994 seconds\n",
      "INFO:soil:Using config(s): Spread_erdos_renyi_graph_prob_0.3\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_erdos_renyi_graph_prob_0.3 at 21:51:28.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.3\n",
      "INFO:soil:Starting Simulation Spread_erdos_renyi_graph_prob_0.3 trial Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263 at 21:51:30.\n",
      "INFO:soil:Finished Simulation Spread_erdos_renyi_graph_prob_0.3 trial Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263 at 21:51:30 in 0.397489070892334 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_erdos_renyi_graph_prob_0.3 trial Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263 at 21:51:30.\n",
      "INFO:soil:Finished Dumping simulation Spread_erdos_renyi_graph_prob_0.3 trial Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263 at 21:51:30 in 0.0012001991271972656 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.3 trial Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.3 at 21:51:30.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.3 trial Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.3 at 21:51:30 in 0.007926225662231445 seconds\n",
      "INFO:soil:Finished simulation Spread_erdos_renyi_graph_prob_0.3 at 21:51:30 in 2.0851120948791504 seconds\n",
      "INFO:soil:Using config(s): Spread_erdos_renyi_graph_prob_0.4\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_erdos_renyi_graph_prob_0.4 at 21:51:30.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.4\n",
      "INFO:soil:Starting Simulation Spread_erdos_renyi_graph_prob_0.4 trial Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287 at 21:51:32.\n",
      "INFO:soil:Finished Simulation Spread_erdos_renyi_graph_prob_0.4 trial Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287 at 21:51:32 in 0.3599538803100586 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_erdos_renyi_graph_prob_0.4 trial Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287 at 21:51:32.\n",
      "INFO:soil:Finished Dumping simulation Spread_erdos_renyi_graph_prob_0.4 trial Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287 at 21:51:32 in 0.0013287067413330078 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.4 trial Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.4 at 21:51:32.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_erdos_renyi_graph_prob_0.4 trial Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_erdos_renyi_graph_prob_0.4 at 21:51:32 in 0.007839202880859375 seconds\n",
      "INFO:soil:Finished simulation Spread_erdos_renyi_graph_prob_0.4 at 21:51:32 in 2.00582218170166 seconds\n",
      "INFO:soil:Using config(s): Spread_barabasi_albert_graph_prob_0.0\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_barabasi_albert_graph_prob_0.0 at 21:51:32.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.0\n",
      "INFO:soil:Starting Simulation Spread_barabasi_albert_graph_prob_0.0 trial Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196 at 21:51:33.\n",
      "INFO:soil:Finished Simulation Spread_barabasi_albert_graph_prob_0.0 trial Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196 at 21:51:33 in 0.08920121192932129 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_barabasi_albert_graph_prob_0.0 trial Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196 at 21:51:33.\n",
      "INFO:soil:Finished Dumping simulation Spread_barabasi_albert_graph_prob_0.0 trial Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196 at 21:51:33 in 0.002248525619506836 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.0 trial Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.0 at 21:51:33.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.0 trial Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.0 at 21:51:33 in 0.008725643157958984 seconds\n",
      "INFO:soil:Finished simulation Spread_barabasi_albert_graph_prob_0.0 at 21:51:33 in 0.27675533294677734 seconds\n",
      "INFO:soil:Using config(s): Spread_barabasi_albert_graph_prob_0.1\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_barabasi_albert_graph_prob_0.1 at 21:51:33.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.1\n",
      "INFO:soil:Starting Simulation Spread_barabasi_albert_graph_prob_0.1 trial Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936 at 21:51:33.\n",
      "INFO:soil:Finished Simulation Spread_barabasi_albert_graph_prob_0.1 trial Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936 at 21:51:33 in 0.10021758079528809 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_barabasi_albert_graph_prob_0.1 trial Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936 at 21:51:33.\n",
      "INFO:soil:Finished Dumping simulation Spread_barabasi_albert_graph_prob_0.1 trial Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936 at 21:51:33 in 0.0017764568328857422 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.1 trial Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.1 at 21:51:33.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.1 trial Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.1 at 21:51:33 in 0.009679555892944336 seconds\n",
      "INFO:soil:Finished simulation Spread_barabasi_albert_graph_prob_0.1 at 21:51:33 in 0.34103941917419434 seconds\n",
      "INFO:soil:Using config(s): Spread_barabasi_albert_graph_prob_0.2\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_barabasi_albert_graph_prob_0.2 at 21:51:33.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.2\n",
      "INFO:soil:Starting Simulation Spread_barabasi_albert_graph_prob_0.2 trial Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543 at 21:51:33.\n",
      "INFO:soil:Finished Simulation Spread_barabasi_albert_graph_prob_0.2 trial Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543 at 21:51:33 in 0.10449576377868652 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_barabasi_albert_graph_prob_0.2 trial Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543 at 21:51:33.\n",
      "INFO:soil:Finished Dumping simulation Spread_barabasi_albert_graph_prob_0.2 trial Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543 at 21:51:33 in 0.0013310909271240234 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.2 trial Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.2 at 21:51:33.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.2 trial Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.2 at 21:51:33 in 0.008279085159301758 seconds\n",
      "INFO:soil:Finished simulation Spread_barabasi_albert_graph_prob_0.2 at 21:51:33 in 0.3049919605255127 seconds\n",
      "INFO:soil:Using config(s): Spread_barabasi_albert_graph_prob_0.3\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_barabasi_albert_graph_prob_0.3 at 21:51:33.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.3\n",
      "INFO:soil:Starting Simulation Spread_barabasi_albert_graph_prob_0.3 trial Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245 at 21:51:34.\n",
      "INFO:soil:Finished Simulation Spread_barabasi_albert_graph_prob_0.3 trial Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245 at 21:51:34 in 0.10204219818115234 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_barabasi_albert_graph_prob_0.3 trial Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245 at 21:51:34.\n",
      "INFO:soil:Finished Dumping simulation Spread_barabasi_albert_graph_prob_0.3 trial Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245 at 21:51:34 in 0.0013041496276855469 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.3 trial Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.3 at 21:51:34.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.3 trial Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.3 at 21:51:34 in 0.007649898529052734 seconds\n",
      "INFO:soil:Finished simulation Spread_barabasi_albert_graph_prob_0.3 at 21:51:34 in 0.33296704292297363 seconds\n",
      "INFO:soil:Using config(s): Spread_barabasi_albert_graph_prob_0.4\n",
      "INFO:soil:Using exporters: ['default', 'csv']\n",
      "INFO:soil:Output directory: None\n",
      "INFO:soil:Starting simulation Spread_barabasi_albert_graph_prob_0.4 at 21:51:34.\n",
      "INFO:soil:Dumping results to /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.4\n",
      "INFO:soil:Starting Simulation Spread_barabasi_albert_graph_prob_0.4 trial Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724 at 21:51:34.\n",
      "INFO:soil:Finished Simulation Spread_barabasi_albert_graph_prob_0.4 trial Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724 at 21:51:34 in 0.10178518295288086 seconds\n",
      "INFO:soil:Starting Dumping simulation Spread_barabasi_albert_graph_prob_0.4 trial Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724 at 21:51:34.\n",
      "INFO:soil:Finished Dumping simulation Spread_barabasi_albert_graph_prob_0.4 trial Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724 at 21:51:34 in 0.0014145374298095703 seconds\n",
      "INFO:soil:Starting [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.4 trial Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.4 at 21:51:34.\n",
      "INFO:soil:Finished [CSV] Dumping simulation Spread_barabasi_albert_graph_prob_0.4 trial Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724 @ dir /home/j/git/lab.gsi/soil/soil/examples/tutorial/soil_output/Spread_barabasi_albert_graph_prob_0.4 at 21:51:34 in 0.007404804229736328 seconds\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:soil:Finished simulation Spread_barabasi_albert_graph_prob_0.4 at 21:51:34 in 0.2759675979614258 seconds\n"
     ]
    }
   ],
   "source": [
    "network_1 = {\n",
    "       'generator': 'erdos_renyi_graph',\n",
    "        'n': 500,\n",
    "        'p': 0.1\n",
    "}\n",
    "network_2 = {\n",
    "       'generator': 'barabasi_albert_graph',\n",
    "        'n': 500,\n",
    "        'm': 2\n",
    "}\n",
    "\n",
    "\n",
    "for net in [network_1, network_2]:\n",
    "    for i in range(5):\n",
    "        prob = i / 10\n",
    "        config['environment_params']['prob_neighbor_spread'] = prob\n",
    "        config['network_params'] = net\n",
    "        config['name'] = 'Spread_{}_prob_{}'.format(net['generator'], prob)\n",
    "        s = soil.simulation.run_from_config(config, exporters=['default', 'csv'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T11:05:18.043194Z",
     "start_time": "2017-07-03T13:05:18.034699+02:00"
    },
    "cell_style": "center"
   },
   "source": [
    "The results are conveniently stored in sqlite (history of agent and environment state) and the configuration is saved in a YAML file.\n",
    "\n",
    "You can also export the results to GEXF format (dynamic network) and CSV using .`run_from_config(config, dump=['gexf', 'csv'])` or the command line flags `--graph --csv`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-11-01T14:05:56.404540Z",
     "start_time": "2017-11-01T15:05:56.122876+01:00"
    },
    "cell_style": "split",
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[01;34msoil_output\u001b[00m\r\n",
      "├── \u001b[01;34mSpread_barabasi_albert_graph_prob_0.0\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml@2020-10-20_02.13.09\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml@2020-11-19_17.07.59\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml@2020-11-19_22.21.31\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml@2020-11-19_22.27.50\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml@2020-11-19_22.30.03\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml@2020-11-19_22.37.58\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0_trial_0.csv@2020-10-20_02.13.09\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.0_trial_0.sqlite@2020-10-20_02.13.09\r\n",
      "│   │   └── Spread_barabasi_albert_graph_prob_0.0_trial_0.stats.csv@2020-10-20_02.13.09\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.0.dumped.yml\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.0_trial_0.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.0_trial_0.db.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.0_trial_0.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.0_trial_0.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605820891-4782693.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605820891-4782693.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605820891-4782693.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821270-8135355.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821270-8135355.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821270-8135355.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821403-9184299.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821403-9184299.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821403-9184299.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821878-07332.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821878-07332.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605821878-07332.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-0_trial_1605822693-02196.stats.csv\r\n",
      "│   └── Spread_barabasi_albert_graph_prob_0-0_trial_1*.sqlite\r\n",
      "├── \u001b[01;34mSpread_barabasi_albert_graph_prob_0.1\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml@2020-10-20_02.13.09\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml@2020-11-19_17.07.59\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml@2020-11-19_22.21.31\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml@2020-11-19_22.27.51\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml@2020-11-19_22.30.04\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml@2020-11-19_22.37.58\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1_trial_0.csv@2020-10-20_02.13.10\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.1_trial_0.sqlite@2020-10-20_02.13.10\r\n",
      "│   │   └── Spread_barabasi_albert_graph_prob_0.1_trial_0.stats.csv@2020-10-20_02.13.10\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.1.dumped.yml\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.1_trial_0.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.1_trial_0.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.1_trial_0.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605820891-7942905.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605820891-7942905.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605820891-7942905.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821271-1282487.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821271-1282487.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821271-1282487.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821404-2597992.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821404-2597992.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821404-2597992.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821878-3834527.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821878-3834527.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605821878-3834527.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936.sqlite\r\n",
      "│   └── Spread_barabasi_albert_graph_prob_0-1_trial_1605822693-3600936.stats.csv\r\n",
      "├── \u001b[01;34mSpread_barabasi_albert_graph_prob_0.2\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml@2020-10-20_02.13.10\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml@2020-11-19_17.07.59\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml@2020-11-19_22.21.32\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml@2020-11-19_22.27.51\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml@2020-11-19_22.30.04\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml@2020-11-19_22.37.58\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2_trial_0.csv@2020-10-20_02.13.10\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.2_trial_0.sqlite@2020-10-20_02.13.10\r\n",
      "│   │   └── Spread_barabasi_albert_graph_prob_0.2_trial_0.stats.csv@2020-10-20_02.13.10\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.2.dumped.yml\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.2_trial_0.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.2_trial_0.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.2_trial_0.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605820892-0839.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605820892-0839.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605820892-0839.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821271-4662864.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821271-4662864.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821271-4662864.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821404-5465293.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821404-5465293.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821404-5465293.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821878-6511369.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821878-6511369.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605821878-6511369.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543.sqlite\r\n",
      "│   └── Spread_barabasi_albert_graph_prob_0-2_trial_1605822693-6736543.stats.csv\r\n",
      "├── \u001b[01;34mSpread_barabasi_albert_graph_prob_0.3\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml@2020-10-20_02.13.10\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml@2020-11-19_17.08.00\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml@2020-11-19_22.21.32\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml@2020-11-19_22.27.51\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml@2020-11-19_22.30.04\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml@2020-11-19_22.37.58\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3_trial_0.csv@2020-10-20_02.13.10\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.3_trial_0.sqlite@2020-10-20_02.13.10\r\n",
      "│   │   └── Spread_barabasi_albert_graph_prob_0.3_trial_0.stats.csv@2020-10-20_02.13.10\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.3.dumped.yml\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.3_trial_0.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.3_trial_0.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.3_trial_0.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605820892-4140177.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605820892-4140177.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605820892-4140177.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821271-7566118.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821271-7566118.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821271-7566118.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821404-8982599.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821404-8982599.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821404-8982599.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821878-9966376.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821878-9966376.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605821878-9966376.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245.sqlite\r\n",
      "│   └── Spread_barabasi_albert_graph_prob_0-3_trial_1605822693-98245.stats.csv\r\n",
      "├── \u001b[01;34mSpread_barabasi_albert_graph_prob_0.4\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml@2020-10-20_02.13.11\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml@2020-11-19_17.08.00\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml@2020-11-19_22.21.32\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml@2020-11-19_22.27.52\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml@2020-11-19_22.30.05\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml@2020-11-19_22.37.59\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4_trial_0.csv@2020-10-20_02.13.11\r\n",
      "│   │   ├── Spread_barabasi_albert_graph_prob_0.4_trial_0.sqlite@2020-10-20_02.13.11\r\n",
      "│   │   └── Spread_barabasi_albert_graph_prob_0.4_trial_0.stats.csv@2020-10-20_02.13.11\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.4.dumped.yml\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.4_trial_0.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.4_trial_0.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0.4_trial_0.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605820892-7289681.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605820892-7289681.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605820892-7289681.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821272-094621.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821272-094621.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821272-094621.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821405-182661.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821405-182661.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821405-182661.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821879-2909274.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821879-2909274.sqlite\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605821879-2909274.stats.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724.csv\r\n",
      "│   ├── Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724.sqlite\r\n",
      "│   └── Spread_barabasi_albert_graph_prob_0-4_trial_1605822694-3096724.stats.csv\r\n",
      "├── \u001b[01;34mSpread_erdos_renyi_graph_prob_0.0\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml@2020-10-20_02.13.01\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml@2020-11-19_17.07.50\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml@2020-11-19_22.21.23\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml@2020-11-19_22.27.42\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml@2020-11-19_22.29.55\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml@2020-11-19_22.37.49\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0_trial_0.csv@2020-10-20_02.13.01\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.0_trial_0.sqlite@2020-10-20_02.13.01\r\n",
      "│   │   └── Spread_erdos_renyi_graph_prob_0.0_trial_0.stats.csv@2020-10-20_02.13.01\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.0.dumped.yml\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.0_trial_0.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.0_trial_0.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.0_trial_0.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605820883-06455.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605820883-06455.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605820883-06455.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821262-320959.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821262-320959.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821262-320959.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821395-1533184.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821395-1533184.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821395-1533184.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821869-3048918.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821869-3048918.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605821869-3048918.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892.sqlite\r\n",
      "│   └── Spread_erdos_renyi_graph_prob_0-0_trial_1605822684-0959892.stats.csv\r\n",
      "├── \u001b[01;34mSpread_erdos_renyi_graph_prob_0.1\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml@2020-10-20_02.13.03\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml@2020-11-19_17.07.52\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml@2020-11-19_22.21.24\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml@2020-11-19_22.27.44\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml@2020-11-19_22.29.57\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml@2020-11-19_22.37.51\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1_trial_0.csv@2020-10-20_02.13.03\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.1_trial_0.sqlite@2020-10-20_02.13.03\r\n",
      "│   │   └── Spread_erdos_renyi_graph_prob_0.1_trial_0.stats.csv@2020-10-20_02.13.03\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.1.dumped.yml\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.1_trial_0.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.1_trial_0.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.1_trial_0.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605820884-9897068.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605820884-9897068.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605820884-9897068.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821264-2528372.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821264-2528372.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821264-2528372.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821397-0991232.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821397-0991232.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821397-0991232.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821871-3203213.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821871-3203213.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605821871-3203213.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185.sqlite\r\n",
      "│   └── Spread_erdos_renyi_graph_prob_0-1_trial_1605822686-1504185.stats.csv\r\n",
      "├── \u001b[01;34mSpread_erdos_renyi_graph_prob_0.2\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml@2020-10-20_02.13.05\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml@2020-11-19_17.07.54\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml@2020-11-19_22.21.26\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml@2020-11-19_22.27.46\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml@2020-11-19_22.29.59\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml@2020-11-19_22.37.53\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2_trial_0.csv@2020-10-20_02.13.05\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.2_trial_0.sqlite@2020-10-20_02.13.05\r\n",
      "│   │   └── Spread_erdos_renyi_graph_prob_0.2_trial_0.stats.csv@2020-10-20_02.13.05\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.2.dumped.yml\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.2_trial_0.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.2_trial_0.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.2_trial_0.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605820886-9976044.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605820886-9976044.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605820886-9976044.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821266-2571487.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821266-2571487.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821266-2571487.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821399-2090585.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821399-2090585.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821399-2090585.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821873-299152.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821873-299152.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605821873-299152.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787.sqlite\r\n",
      "│   └── Spread_erdos_renyi_graph_prob_0-2_trial_1605822688-204787.stats.csv\r\n",
      "├── \u001b[01;34mSpread_erdos_renyi_graph_prob_0.3\u001b[00m\r\n",
      "│   ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml@2020-10-20_02.13.07\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml@2020-11-19_17.07.56\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml@2020-11-19_22.21.28\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml@2020-11-19_22.27.48\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml@2020-11-19_22.30.01\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml@2020-11-19_22.37.55\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3_trial_0.csv@2020-10-20_02.13.07\r\n",
      "│   │   ├── Spread_erdos_renyi_graph_prob_0.3_trial_0.sqlite@2020-10-20_02.13.07\r\n",
      "│   │   └── Spread_erdos_renyi_graph_prob_0.3_trial_0.stats.csv@2020-10-20_02.13.07\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.3.dumped.yml\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.3_trial_0.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.3_trial_0.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0.3_trial_0.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605820888-9462104.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605820888-9462104.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605820888-9462104.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821268-2217143.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821268-2217143.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821268-2217143.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821401-1938107.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821401-1938107.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821401-1938107.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821875-4654636.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821875-4654636.sqlite\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605821875-4654636.stats.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263.csv\r\n",
      "│   ├── Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263.sqlite\r\n",
      "│   └── Spread_erdos_renyi_graph_prob_0-3_trial_1605822690-3038263.stats.csv\r\n",
      "└── \u001b[01;34mSpread_erdos_renyi_graph_prob_0.4\u001b[00m\r\n",
      "    ├── \u001b[01;34mbackup\u001b[00m\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml@2020-10-20_02.13.09\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml@2020-11-19_17.07.58\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml@2020-11-19_22.21.30\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml@2020-11-19_22.27.50\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml@2020-11-19_22.30.03\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml@2020-11-19_22.37.57\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4_trial_0.csv@2020-10-20_02.13.09\r\n",
      "    │   ├── Spread_erdos_renyi_graph_prob_0.4_trial_0.sqlite@2020-10-20_02.13.09\r\n",
      "    │   └── Spread_erdos_renyi_graph_prob_0.4_trial_0.stats.csv@2020-10-20_02.13.09\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0.4.dumped.yml\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0.4_trial_0.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0.4_trial_0.sqlite\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0.4_trial_0.stats.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605820890-8584282.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605820890-8584282.sqlite\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605820890-8584282.stats.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821270-1897953.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821270-1897953.sqlite\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821270-1897953.stats.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821403-3238373.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821403-3238373.sqlite\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821403-3238373.stats.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821877-5024807.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821877-5024807.sqlite\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605821877-5024807.stats.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287.csv\r\n",
      "    ├── Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287.sqlite\r\n",
      "    └── Spread_erdos_renyi_graph_prob_0-4_trial_1605822692-3893287.stats.csv\r\n",
      "\r\n",
      "20 directories, 282 files\r\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "364K\tsoil_output/Spread_barabasi_albert_graph_prob_0.0/backup\r\n",
      "1.2M\tsoil_output/Spread_barabasi_albert_graph_prob_0.0\r\n",
      "368K\tsoil_output/Spread_barabasi_albert_graph_prob_0.1/backup\r\n",
      "1.2M\tsoil_output/Spread_barabasi_albert_graph_prob_0.1\r\n",
      "364K\tsoil_output/Spread_barabasi_albert_graph_prob_0.2/backup\r\n",
      "1.2M\tsoil_output/Spread_barabasi_albert_graph_prob_0.2\r\n",
      "368K\tsoil_output/Spread_barabasi_albert_graph_prob_0.3/backup\r\n",
      "1.2M\tsoil_output/Spread_barabasi_albert_graph_prob_0.3\r\n",
      "364K\tsoil_output/Spread_barabasi_albert_graph_prob_0.4/backup\r\n",
      "1.2M\tsoil_output/Spread_barabasi_albert_graph_prob_0.4\r\n",
      "2.5M\tsoil_output/Spread_erdos_renyi_graph_prob_0.0/backup\r\n",
      "3.6M\tsoil_output/Spread_erdos_renyi_graph_prob_0.0\r\n",
      "2.5M\tsoil_output/Spread_erdos_renyi_graph_prob_0.1/backup\r\n",
      "3.6M\tsoil_output/Spread_erdos_renyi_graph_prob_0.1\r\n",
      "2.5M\tsoil_output/Spread_erdos_renyi_graph_prob_0.2/backup\r\n",
      "3.6M\tsoil_output/Spread_erdos_renyi_graph_prob_0.2\r\n",
      "2.5M\tsoil_output/Spread_erdos_renyi_graph_prob_0.3/backup\r\n",
      "3.6M\tsoil_output/Spread_erdos_renyi_graph_prob_0.3\r\n",
      "2.5M\tsoil_output/Spread_erdos_renyi_graph_prob_0.4/backup\r\n",
      "3.6M\tsoil_output/Spread_erdos_renyi_graph_prob_0.4\r\n"
     ]
    }
   ],
   "source": [
    "!tree soil_output\n",
    "!du -xh soil_output/*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-02T10:40:14.384177Z",
     "start_time": "2017-07-02T12:40:14.381885+02:00"
    }
   },
   "source": [
    "## Analysing the results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Loading data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Once the simulations are over, we can use soil to analyse the results.\n",
    "\n",
    "Soil allows you to load results for specific trials, or for a set of trials if you specify a pattern. The specific methods are:\n",
    "\n",
    "* `analysis.read_data(<directory pattern>)` to load all the results from a directory. e.g. `read_data('my_simulation/')`. For each trial it finds in each folder matching the pattern, it will return the dumped configuration for the simulation, the results of the trial, and the configuration itself. By default, it will try to load data from the sqlite database. \n",
    "* `analysis.read_csv(<csv_file>)` to load all the results from a CSV file. e.g. `read_csv('my_simulation/my_simulation_trial0.environment.csv')`\n",
    "* `analysis.read_sql(<sqlite_file>)` to load all the results from a sqlite database . e.g. `read_sql('my_simulation/my_simulation_trial0.db.sqlite')`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-07-03T14:44:30.978223Z",
     "start_time": "2017-07-03T16:44:30.971952+02:00"
    }
   },
   "source": [
    "Let's see it in action by loading the stored results into a pandas dataframe:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:57:43.662893Z",
     "start_time": "2017-10-19T17:57:43.632252+02:00"
    },
    "cell_style": "center"
   },
   "outputs": [],
   "source": [
    "from soil import analysis\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:57:44.101253Z",
     "start_time": "2017-10-19T17:57:44.039710+02:00"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>key</th>\n",
       "      <th>SEED</th>\n",
       "      <th>agents.model_count.NewsSpread</th>\n",
       "      <th>agents.state_count.infected</th>\n",
       "      <th>agents.state_count.neutral</th>\n",
       "      <th>event_time</th>\n",
       "      <th colspan=\"5\" halign=\"left\">has_tv</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"6\" halign=\"left\">id</th>\n",
       "      <th>network .n_edges</th>\n",
       "      <th>network .n_nodes</th>\n",
       "      <th>prob_neighbor_spread</th>\n",
       "      <th>prob_tv_spread</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>agent_id</th>\n",
       "      <th>env</th>\n",
       "      <th>stats</th>\n",
       "      <th>stats</th>\n",
       "      <th>stats</th>\n",
       "      <th>NewsEnvironmentAgent</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>10</th>\n",
       "      <th>100</th>\n",
       "      <th>101</th>\n",
       "      <th>...</th>\n",
       "      <th>94</th>\n",
       "      <th>95</th>\n",
       "      <th>96</th>\n",
       "      <th>97</th>\n",
       "      <th>98</th>\n",
       "      <th>99</th>\n",
       "      <th>stats</th>\n",
       "      <th>stats</th>\n",
       "      <th>env</th>\n",
       "      <th>env</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>t_step</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.9</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.81</td>\n",
       "      <td>0.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.7290000000000001</td>\n",
       "      <td>0.125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.6561000000000001</td>\n",
       "      <td>0.0625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.5904900000000002</td>\n",
       "      <td>0.03125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.5314410000000002</td>\n",
       "      <td>0.015625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.47829690000000014</td>\n",
       "      <td>0.0078125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.43046721000000016</td>\n",
       "      <td>0.00390625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.38742048900000015</td>\n",
       "      <td>0.001953125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_0</td>\n",
       "      <td>500</td>\n",
       "      <td>480</td>\n",
       "      <td>20</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>500</td>\n",
       "      <td>500</td>\n",
       "      <td>0.38742048900000015</td>\n",
       "      <td>0.001953125</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>21 rows × 1009 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "key                                                SEED  \\\n",
       "agent_id                                            env   \n",
       "t_step                                                    \n",
       "0         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "1         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "2         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "3         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "4         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "5         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "6         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "7         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "8         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "9         Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "10        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "11        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "12        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "13        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "14        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "15        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "16        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "17        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "18        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "19        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "20        Spread_barabasi_albert_graph_prob_0.0_trial_0   \n",
       "\n",
       "key      agents.model_count.NewsSpread agents.state_count.infected  \\\n",
       "agent_id                         stats                       stats   \n",
       "t_step                                                               \n",
       "0                                  NaN                         NaN   \n",
       "1                                  NaN                         NaN   \n",
       "2                                  NaN                         NaN   \n",
       "3                                  NaN                         NaN   \n",
       "4                                  NaN                         NaN   \n",
       "5                                  NaN                         NaN   \n",
       "6                                  NaN                         NaN   \n",
       "7                                  NaN                         NaN   \n",
       "8                                  NaN                         NaN   \n",
       "9                                  NaN                         NaN   \n",
       "10                                 NaN                         NaN   \n",
       "11                                 NaN                         NaN   \n",
       "12                                 NaN                         NaN   \n",
       "13                                 NaN                         NaN   \n",
       "14                                 NaN                         NaN   \n",
       "15                                 NaN                         NaN   \n",
       "16                                 NaN                         NaN   \n",
       "17                                 NaN                         NaN   \n",
       "18                                 NaN                         NaN   \n",
       "19                                 NaN                         NaN   \n",
       "20                                 500                         480   \n",
       "\n",
       "key      agents.state_count.neutral           event_time has_tv              \\\n",
       "agent_id                      stats NewsEnvironmentAgent      0     1    10   \n",
       "t_step                                                                        \n",
       "0                               NaN                   10   True  True  True   \n",
       "1                               NaN                   10   True  True  True   \n",
       "2                               NaN                   10   True  True  True   \n",
       "3                               NaN                   10   True  True  True   \n",
       "4                               NaN                   10   True  True  True   \n",
       "5                               NaN                   10   True  True  True   \n",
       "6                               NaN                   10   True  True  True   \n",
       "7                               NaN                   10   True  True  True   \n",
       "8                               NaN                   10   True  True  True   \n",
       "9                               NaN                   10   True  True  True   \n",
       "10                              NaN                   10   True  True  True   \n",
       "11                              NaN                   10   True  True  True   \n",
       "12                              NaN                   10   True  True  True   \n",
       "13                              NaN                   10   True  True  True   \n",
       "14                              NaN                   10   True  True  True   \n",
       "15                              NaN                   10   True  True  True   \n",
       "16                              NaN                   10   True  True  True   \n",
       "17                              NaN                   10   True  True  True   \n",
       "18                              NaN                   10   True  True  True   \n",
       "19                              NaN                   10   True  True  True   \n",
       "20                               20                   10   True  True  True   \n",
       "\n",
       "key                   ...        id                                          \\\n",
       "agent_id   100   101  ...        94        95        96        97        98   \n",
       "t_step                ...                                                     \n",
       "0         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "1         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "2         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "3         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "4         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "5         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "6         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "7         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "8         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "9         True  True  ...   neutral   neutral   neutral   neutral   neutral   \n",
       "10        True  True  ...   neutral   neutral  infected  infected  infected   \n",
       "11        True  True  ...   neutral   neutral  infected  infected  infected   \n",
       "12        True  True  ...   neutral   neutral  infected  infected  infected   \n",
       "13        True  True  ...   neutral   neutral  infected  infected  infected   \n",
       "14        True  True  ...   neutral  infected  infected  infected  infected   \n",
       "15        True  True  ...   neutral  infected  infected  infected  infected   \n",
       "16        True  True  ...   neutral  infected  infected  infected  infected   \n",
       "17        True  True  ...   neutral  infected  infected  infected  infected   \n",
       "18        True  True  ...  infected  infected  infected  infected  infected   \n",
       "19        True  True  ...  infected  infected  infected  infected  infected   \n",
       "20        True  True  ...  infected  infected  infected  infected  infected   \n",
       "\n",
       "key                network .n_edges network .n_nodes prob_neighbor_spread  \\\n",
       "agent_id        99            stats            stats                  env   \n",
       "t_step                                                                      \n",
       "0          neutral              NaN              NaN                  0.0   \n",
       "1          neutral              NaN              NaN                  0.0   \n",
       "2          neutral              NaN              NaN                  0.0   \n",
       "3          neutral              NaN              NaN                  0.0   \n",
       "4          neutral              NaN              NaN                  0.0   \n",
       "5          neutral              NaN              NaN                  0.0   \n",
       "6          neutral              NaN              NaN                  0.0   \n",
       "7          neutral              NaN              NaN                  0.0   \n",
       "8          neutral              NaN              NaN                  0.0   \n",
       "9          neutral              NaN              NaN                  0.0   \n",
       "10        infected              NaN              NaN                    1   \n",
       "11        infected              NaN              NaN                  0.9   \n",
       "12        infected              NaN              NaN                 0.81   \n",
       "13        infected              NaN              NaN   0.7290000000000001   \n",
       "14        infected              NaN              NaN   0.6561000000000001   \n",
       "15        infected              NaN              NaN   0.5904900000000002   \n",
       "16        infected              NaN              NaN   0.5314410000000002   \n",
       "17        infected              NaN              NaN  0.47829690000000014   \n",
       "18        infected              NaN              NaN  0.43046721000000016   \n",
       "19        infected              NaN              NaN  0.38742048900000015   \n",
       "20        infected              500              500  0.38742048900000015   \n",
       "\n",
       "key      prob_tv_spread  \n",
       "agent_id            env  \n",
       "t_step                   \n",
       "0                  0.01  \n",
       "1                  0.01  \n",
       "2                  0.01  \n",
       "3                  0.01  \n",
       "4                  0.01  \n",
       "5                  0.01  \n",
       "6                  0.01  \n",
       "7                  0.01  \n",
       "8                  0.01  \n",
       "9                  0.01  \n",
       "10                    1  \n",
       "11                  0.5  \n",
       "12                 0.25  \n",
       "13                0.125  \n",
       "14               0.0625  \n",
       "15              0.03125  \n",
       "16             0.015625  \n",
       "17            0.0078125  \n",
       "18           0.00390625  \n",
       "19          0.001953125  \n",
       "20          0.001953125  \n",
       "\n",
       "[21 rows x 1009 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = analysis.read_csv('soil_output/Spread_barabasi_albert_graph_prob_0.0/Spread_barabasi_albert_graph_prob_0.0_trial_0.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Soil can also process the data for us and split the results into environment attributes and agent attributes:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "env, agents = analysis.split_processed(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>key</th>\n",
       "      <th>event_time</th>\n",
       "      <th colspan=\"9\" halign=\"left\">has_tv</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">id</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>agent_id</th>\n",
       "      <th>NewsEnvironmentAgent</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>10</th>\n",
       "      <th>100</th>\n",
       "      <th>101</th>\n",
       "      <th>102</th>\n",
       "      <th>103</th>\n",
       "      <th>104</th>\n",
       "      <th>105</th>\n",
       "      <th>...</th>\n",
       "      <th>90</th>\n",
       "      <th>91</th>\n",
       "      <th>92</th>\n",
       "      <th>93</th>\n",
       "      <th>94</th>\n",
       "      <th>95</th>\n",
       "      <th>96</th>\n",
       "      <th>97</th>\n",
       "      <th>98</th>\n",
       "      <th>99</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>t_step</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>21 rows × 1001 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "key                event_time has_tv                                      \\\n",
       "agent_id NewsEnvironmentAgent      0     1    10   100   101   102   103   \n",
       "t_step                                                                     \n",
       "0                          10   True  True  True  True  True  True  True   \n",
       "1                          10   True  True  True  True  True  True  True   \n",
       "2                          10   True  True  True  True  True  True  True   \n",
       "3                          10   True  True  True  True  True  True  True   \n",
       "4                          10   True  True  True  True  True  True  True   \n",
       "5                          10   True  True  True  True  True  True  True   \n",
       "6                          10   True  True  True  True  True  True  True   \n",
       "7                          10   True  True  True  True  True  True  True   \n",
       "8                          10   True  True  True  True  True  True  True   \n",
       "9                          10   True  True  True  True  True  True  True   \n",
       "10                         10   True  True  True  True  True  True  True   \n",
       "11                         10   True  True  True  True  True  True  True   \n",
       "12                         10   True  True  True  True  True  True  True   \n",
       "13                         10   True  True  True  True  True  True  True   \n",
       "14                         10   True  True  True  True  True  True  True   \n",
       "15                         10   True  True  True  True  True  True  True   \n",
       "16                         10   True  True  True  True  True  True  True   \n",
       "17                         10   True  True  True  True  True  True  True   \n",
       "18                         10   True  True  True  True  True  True  True   \n",
       "19                         10   True  True  True  True  True  True  True   \n",
       "20                         10   True  True  True  True  True  True  True   \n",
       "\n",
       "key                   ...        id                                         \\\n",
       "agent_id   104   105  ...        90        91       92        93        94   \n",
       "t_step                ...                                                    \n",
       "0         True  True  ...   neutral   neutral  neutral   neutral   neutral   \n",
       "1         True  True  ...   neutral   neutral  neutral   neutral   neutral   \n",
       "2         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "3         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "4         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "5         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "6         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "7         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "8         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "9         True  True  ...   neutral  infected  neutral   neutral   neutral   \n",
       "10        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "11        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "12        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "13        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "14        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "15        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "16        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "17        True  True  ...  infected  infected  neutral  infected   neutral   \n",
       "18        True  True  ...  infected  infected  neutral  infected  infected   \n",
       "19        True  True  ...  infected  infected  neutral  infected  infected   \n",
       "20        True  True  ...  infected  infected  neutral  infected  infected   \n",
       "\n",
       "key                                                         \n",
       "agent_id        95        96        97        98        99  \n",
       "t_step                                                      \n",
       "0          neutral   neutral   neutral   neutral   neutral  \n",
       "1          neutral   neutral   neutral   neutral   neutral  \n",
       "2          neutral   neutral   neutral   neutral   neutral  \n",
       "3          neutral   neutral   neutral   neutral   neutral  \n",
       "4          neutral   neutral   neutral   neutral   neutral  \n",
       "5          neutral   neutral   neutral   neutral   neutral  \n",
       "6          neutral   neutral   neutral   neutral   neutral  \n",
       "7          neutral   neutral   neutral   neutral   neutral  \n",
       "8          neutral   neutral   neutral   neutral   neutral  \n",
       "9          neutral   neutral   neutral   neutral   neutral  \n",
       "10         neutral  infected  infected  infected  infected  \n",
       "11         neutral  infected  infected  infected  infected  \n",
       "12         neutral  infected  infected  infected  infected  \n",
       "13         neutral  infected  infected  infected  infected  \n",
       "14        infected  infected  infected  infected  infected  \n",
       "15        infected  infected  infected  infected  infected  \n",
       "16        infected  infected  infected  infected  infected  \n",
       "17        infected  infected  infected  infected  infected  \n",
       "18        infected  infected  infected  infected  infected  \n",
       "19        infected  infected  infected  infected  infected  \n",
       "20        infected  infected  infected  infected  infected  \n",
       "\n",
       "[21 rows x 1001 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "agents"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-18T14:01:00.669671Z",
     "start_time": "2017-10-18T16:01:00.635624+02:00"
    }
   },
   "source": [
    "The index of the results are the simulation step. Hence, we can access the state of the simulation at a given step (e.g., 13): "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:57:47.132212Z",
     "start_time": "2017-10-19T17:57:47.084737+02:00"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "agent_id\n",
       "0      infected\n",
       "1      infected\n",
       "10     infected\n",
       "100    infected\n",
       "101    infected\n",
       "         ...   \n",
       "95      neutral\n",
       "96     infected\n",
       "97     infected\n",
       "98     infected\n",
       "99     infected\n",
       "Name: 13, Length: 500, dtype: object"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "agents.loc[13, 'id']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Or, we can perform more complex tasks such as showing the agents that have changed their state between two simulation steps (2 and 1):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(agents.loc[2]['id'] != agents.loc[1]['id']).sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To focus on specific agents, we can swap the levels of the index:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:57:49.046261Z",
     "start_time": "2017-10-19T17:57:49.019721+02:00"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>agent_id</th>\n",
       "      <th>NewsEnvironmentAgent</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>10</th>\n",
       "      <th>100</th>\n",
       "      <th>101</th>\n",
       "      <th>102</th>\n",
       "      <th>103</th>\n",
       "      <th>104</th>\n",
       "      <th>105</th>\n",
       "      <th>...</th>\n",
       "      <th>90</th>\n",
       "      <th>91</th>\n",
       "      <th>92</th>\n",
       "      <th>93</th>\n",
       "      <th>94</th>\n",
       "      <th>95</th>\n",
       "      <th>96</th>\n",
       "      <th>97</th>\n",
       "      <th>98</th>\n",
       "      <th>99</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>key</th>\n",
       "      <th>event_time</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>has_tv</th>\n",
       "      <th>...</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "      <th>id</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>t_step</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>21 rows × 1001 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "agent_id NewsEnvironmentAgent      0      1     10    100    101    102  \\\n",
       "key                event_time has_tv has_tv has_tv has_tv has_tv has_tv   \n",
       "t_step                                                                    \n",
       "0                          10   True   True   True   True   True   True   \n",
       "1                          10   True   True   True   True   True   True   \n",
       "2                          10   True   True   True   True   True   True   \n",
       "3                          10   True   True   True   True   True   True   \n",
       "4                          10   True   True   True   True   True   True   \n",
       "5                          10   True   True   True   True   True   True   \n",
       "6                          10   True   True   True   True   True   True   \n",
       "7                          10   True   True   True   True   True   True   \n",
       "8                          10   True   True   True   True   True   True   \n",
       "9                          10   True   True   True   True   True   True   \n",
       "10                         10   True   True   True   True   True   True   \n",
       "11                         10   True   True   True   True   True   True   \n",
       "12                         10   True   True   True   True   True   True   \n",
       "13                         10   True   True   True   True   True   True   \n",
       "14                         10   True   True   True   True   True   True   \n",
       "15                         10   True   True   True   True   True   True   \n",
       "16                         10   True   True   True   True   True   True   \n",
       "17                         10   True   True   True   True   True   True   \n",
       "18                         10   True   True   True   True   True   True   \n",
       "19                         10   True   True   True   True   True   True   \n",
       "20                         10   True   True   True   True   True   True   \n",
       "\n",
       "agent_id    103    104    105  ...        90        91       92        93  \\\n",
       "key      has_tv has_tv has_tv  ...        id        id       id        id   \n",
       "t_step                         ...                                          \n",
       "0          True   True   True  ...   neutral   neutral  neutral   neutral   \n",
       "1          True   True   True  ...   neutral   neutral  neutral   neutral   \n",
       "2          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "3          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "4          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "5          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "6          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "7          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "8          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "9          True   True   True  ...   neutral  infected  neutral   neutral   \n",
       "10         True   True   True  ...  infected  infected  neutral  infected   \n",
       "11         True   True   True  ...  infected  infected  neutral  infected   \n",
       "12         True   True   True  ...  infected  infected  neutral  infected   \n",
       "13         True   True   True  ...  infected  infected  neutral  infected   \n",
       "14         True   True   True  ...  infected  infected  neutral  infected   \n",
       "15         True   True   True  ...  infected  infected  neutral  infected   \n",
       "16         True   True   True  ...  infected  infected  neutral  infected   \n",
       "17         True   True   True  ...  infected  infected  neutral  infected   \n",
       "18         True   True   True  ...  infected  infected  neutral  infected   \n",
       "19         True   True   True  ...  infected  infected  neutral  infected   \n",
       "20         True   True   True  ...  infected  infected  neutral  infected   \n",
       "\n",
       "agent_id        94        95        96        97        98        99  \n",
       "key             id        id        id        id        id        id  \n",
       "t_step                                                                \n",
       "0          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "1          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "2          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "3          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "4          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "5          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "6          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "7          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "8          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "9          neutral   neutral   neutral   neutral   neutral   neutral  \n",
       "10         neutral   neutral  infected  infected  infected  infected  \n",
       "11         neutral   neutral  infected  infected  infected  infected  \n",
       "12         neutral   neutral  infected  infected  infected  infected  \n",
       "13         neutral   neutral  infected  infected  infected  infected  \n",
       "14         neutral  infected  infected  infected  infected  infected  \n",
       "15         neutral  infected  infected  infected  infected  infected  \n",
       "16         neutral  infected  infected  infected  infected  infected  \n",
       "17         neutral  infected  infected  infected  infected  infected  \n",
       "18        infected  infected  infected  infected  infected  infected  \n",
       "19        infected  infected  infected  infected  infected  infected  \n",
       "20        infected  infected  infected  infected  infected  infected  \n",
       "\n",
       "[21 rows x 1001 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "agents.swaplevel(axis=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T10:35:40.140920Z",
     "start_time": "2017-10-19T12:35:40.106265+02:00"
    }
   },
   "source": [
    "### Plotting data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you don't want to work with pandas, you can also use some pre-defined functions from soil to conveniently plot the results:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:57:52.271094Z",
     "start_time": "2017-10-19T17:57:51.102434+02:00"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 22120 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 21280 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 21616 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 21860 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 22360 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 22268 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "analysis.plot_all('soil_output/Spread_barabasi_albert_graph_prob_0.0/', analysis.get_count, 'id');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:57:57.982007Z",
     "start_time": "2017-10-19T17:57:52.273160+02:00"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23432 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 23756 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 23392 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 23468 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 23484 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 23372 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "analysis.plot_all('soil_output/Spread_barabasi_albert_graph_prob_0.3/', analysis.get_count, 'id');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:58:26.903783Z",
     "start_time": "2017-10-19T17:57:57.983957+02:00"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/j/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py:328: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n",
      "  fig = self.plt.figure(figsize=self.figsize)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 20324 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20324 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20324 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20324 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20324 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20324 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20260 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20260 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20260 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20260 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20260 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20260 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20240 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20240 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20240 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20240 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20240 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20240 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20308 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20308 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20308 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20308 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20308 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20308 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "analysis.plot_all('soil_output/Spread_erdos*', analysis.get_value, 'prob_tv_spread');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Manually plotting with pandas"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T11:00:37.003972Z",
     "start_time": "2017-10-19T13:00:36.983128+02:00"
    }
   },
   "source": [
    "Although the simplest way to visualize the results of a simulation is to use the built-in methods in the analysis module, sometimes the setup is more complicated and we need to explore the data a little further.\n",
    "\n",
    "For that, we can use native pandas over the results.\n",
    "\n",
    "Soil provides some convenience methods to simplify common operations:\n",
    "\n",
    "* `analysis.split_df` to separate a history dataframe into environment and agent parameters.\n",
    "* `analysis.get_count` to get a dataframe with the value counts for different attributes during the simulation.\n",
    "* `analysis.get_value` to get the evolution of the value of an attribute during the simulation.\n",
    "\n",
    "And, as we saw earlier, `analysis.process` can turn a dataframe in canonical form into a dataframe with a column per attribute.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:59:15.791793Z",
     "start_time": "2017-10-19T17:59:15.604960+02:00"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>key</th>\n",
       "      <th>SEED</th>\n",
       "      <th>event_time</th>\n",
       "      <th colspan=\"8\" halign=\"left\">has_tv</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"8\" halign=\"left\">id</th>\n",
       "      <th>prob_neighbor_spread</th>\n",
       "      <th>prob_tv_spread</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>agent_id</th>\n",
       "      <th>env</th>\n",
       "      <th>NewsEnvironmentAgent</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>10</th>\n",
       "      <th>100</th>\n",
       "      <th>101</th>\n",
       "      <th>102</th>\n",
       "      <th>103</th>\n",
       "      <th>104</th>\n",
       "      <th>...</th>\n",
       "      <th>92</th>\n",
       "      <th>93</th>\n",
       "      <th>94</th>\n",
       "      <th>95</th>\n",
       "      <th>96</th>\n",
       "      <th>97</th>\n",
       "      <th>98</th>\n",
       "      <th>99</th>\n",
       "      <th>env</th>\n",
       "      <th>env</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>t_step</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.900000</td>\n",
       "      <td>0.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.810000</td>\n",
       "      <td>0.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.729000</td>\n",
       "      <td>0.125000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.656100</td>\n",
       "      <td>0.062500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.590490</td>\n",
       "      <td>0.031250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.531441</td>\n",
       "      <td>0.015625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.478297</td>\n",
       "      <td>0.007812</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.430467</td>\n",
       "      <td>0.003906</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Spread_barabasi_albert_graph_prob_0.0_trial_Sp...</td>\n",
       "      <td>10</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>...</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>neutral</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>infected</td>\n",
       "      <td>0.387420</td>\n",
       "      <td>0.001953</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20 rows × 1004 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "key                                                    SEED  \\\n",
       "agent_id                                                env   \n",
       "t_step                                                        \n",
       "0         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "1         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "2         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "3         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "4         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "5         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "6         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "7         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "8         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "9         Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "10        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "11        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "12        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "13        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "14        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "15        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "16        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "17        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "18        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "19        Spread_barabasi_albert_graph_prob_0.0_trial_Sp...   \n",
       "\n",
       "key                event_time has_tv                                      \\\n",
       "agent_id NewsEnvironmentAgent      0     1    10   100   101   102   103   \n",
       "t_step                                                                     \n",
       "0                          10   True  True  True  True  True  True  True   \n",
       "1                          10   True  True  True  True  True  True  True   \n",
       "2                          10   True  True  True  True  True  True  True   \n",
       "3                          10   True  True  True  True  True  True  True   \n",
       "4                          10   True  True  True  True  True  True  True   \n",
       "5                          10   True  True  True  True  True  True  True   \n",
       "6                          10   True  True  True  True  True  True  True   \n",
       "7                          10   True  True  True  True  True  True  True   \n",
       "8                          10   True  True  True  True  True  True  True   \n",
       "9                          10   True  True  True  True  True  True  True   \n",
       "10                         10   True  True  True  True  True  True  True   \n",
       "11                         10   True  True  True  True  True  True  True   \n",
       "12                         10   True  True  True  True  True  True  True   \n",
       "13                         10   True  True  True  True  True  True  True   \n",
       "14                         10   True  True  True  True  True  True  True   \n",
       "15                         10   True  True  True  True  True  True  True   \n",
       "16                         10   True  True  True  True  True  True  True   \n",
       "17                         10   True  True  True  True  True  True  True   \n",
       "18                         10   True  True  True  True  True  True  True   \n",
       "19                         10   True  True  True  True  True  True  True   \n",
       "\n",
       "key             ...        id                                                  \\\n",
       "agent_id   104  ...        92       93        94        95       96        97   \n",
       "t_step          ...                                                             \n",
       "0         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "1         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "2         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "3         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "4         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "5         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "6         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "7         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "8         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "9         True  ...   neutral  neutral   neutral   neutral  neutral   neutral   \n",
       "10        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "11        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "12        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "13        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "14        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "15        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "16        True  ...  infected  neutral  infected  infected  neutral   neutral   \n",
       "17        True  ...  infected  neutral  infected  infected  neutral  infected   \n",
       "18        True  ...  infected  neutral  infected  infected  neutral  infected   \n",
       "19        True  ...  infected  neutral  infected  infected  neutral  infected   \n",
       "\n",
       "key                          prob_neighbor_spread prob_tv_spread  \n",
       "agent_id        98        99                  env            env  \n",
       "t_step                                                            \n",
       "0          neutral   neutral             0.000000       0.010000  \n",
       "1          neutral   neutral             0.000000       0.010000  \n",
       "2          neutral   neutral             0.000000       0.010000  \n",
       "3          neutral   neutral             0.000000       0.010000  \n",
       "4          neutral   neutral             0.000000       0.010000  \n",
       "5          neutral   neutral             0.000000       0.010000  \n",
       "6          neutral   neutral             0.000000       0.010000  \n",
       "7          neutral   neutral             0.000000       0.010000  \n",
       "8          neutral   neutral             0.000000       0.010000  \n",
       "9          neutral   neutral             0.000000       0.010000  \n",
       "10         neutral  infected             1.000000       1.000000  \n",
       "11         neutral  infected             0.900000       0.500000  \n",
       "12         neutral  infected             0.810000       0.250000  \n",
       "13         neutral  infected             0.729000       0.125000  \n",
       "14         neutral  infected             0.656100       0.062500  \n",
       "15         neutral  infected             0.590490       0.031250  \n",
       "16        infected  infected             0.531441       0.015625  \n",
       "17        infected  infected             0.478297       0.007812  \n",
       "18        infected  infected             0.430467       0.003906  \n",
       "19        infected  infected             0.387420       0.001953  \n",
       "\n",
       "[20 rows x 1004 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = analysis.read_sql('soil_output/Spread_barabasi_albert_graph_prob_0.0/Spread_barabasi_albert_graph_prob_0-0_trial_1605820891-4782693.sqlite')\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's look at the evolution of agent parameters in the simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:59:17.153282Z",
     "start_time": "2017-10-19T17:59:16.830872+02:00"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='t_step'>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 17248 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "df.plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T11:10:36.086913Z",
     "start_time": "2017-10-19T13:10:36.058547+02:00"
    }
   },
   "source": [
    "As we can see, `event_time` is cluttering our results, "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:59:18.418348Z",
     "start_time": "2017-10-19T17:59:18.143443+02:00"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='t_step'>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 21408 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "del df['event_time']\n",
    "df.plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `soil.analysis` module also provides convenient functions to count the number of agents in a given state:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T15:59:51.165806Z",
     "start_time": "2017-10-19T17:59:50.886780+02:00"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 19020 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "analysis.get_count(agents, 'id').plot();"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Dealing with bigger data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:18.148006Z",
     "start_time": "2017-10-19T18:00:18.117654+02:00"
    }
   },
   "outputs": [],
   "source": [
    "from soil import analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:18.636440Z",
     "start_time": "2017-10-19T18:00:18.504421+02:00"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "215M\t../rabbits/soil_output/rabbits_example/\r\n"
     ]
    }
   ],
   "source": [
    "!du -xsh ../rabbits/soil_output/rabbits_example/"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T11:22:22.301765Z",
     "start_time": "2017-10-19T13:22:22.281986+02:00"
    }
   },
   "source": [
    "If we tried to load the entire history, we would probably run out of memory. Hence, it is recommended that you also specify the attributes you are interested in."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:25.080582Z",
     "start_time": "2017-10-19T18:00:19.594165+02:00"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 26504 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "p = analysis.plot_all('../rabbits/soil_output/rabbits_example/', analysis.get_count, 'id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:38.434367Z",
     "start_time": "2017-10-19T18:00:33.645762+02:00"
    }
   },
   "outputs": [],
   "source": [
    "df = analysis.read_sql('../rabbits/soil_output/rabbits_example/rabbits_example_trial_1605825338-8931234.sqlite', keys=['id', 'rabbits_alive'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:39.160418Z",
     "start_time": "2017-10-19T18:00:38.436153+02:00"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='t_step'>"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 26144 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "states = analysis.get_count(df, 'id')\n",
    "states.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:39.515032Z",
     "start_time": "2017-10-19T18:00:39.162240+02:00"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='t_step'>"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 12668 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "alive = analysis.get_value(df, 'rabbits_alive', aggfunc='sum').apply(pd.to_numeric)\n",
    "alive.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2017-10-19T16:00:58.815038Z",
     "start_time": "2017-10-19T18:00:58.566807+02:00"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/j/.local/lib/python3.8/site-packages/pandas/core/reshape/merge.py:643: UserWarning: merging between different levels can give an unintended result (1 levels on the left,2 on the right)\n",
      "  warnings.warn(msg, UserWarning)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 30104 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "h = alive.join(states);\n",
    "h.plot();"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  },
  "toc": {
   "colors": {
    "hover_highlight": "#DAA520",
    "navigate_num": "#000000",
    "navigate_text": "#333333",
    "running_highlight": "#FF0000",
    "selected_highlight": "#FFD700",
    "sidebar_border": "#EEEEEE",
    "wrapper_background": "#FFFFFF"
   },
   "moveMenuLeft": true,
   "nav_menu": {
    "height": "31px",
    "width": "252px"
   },
   "navigate_menu": true,
   "number_sections": true,
   "sideBar": true,
   "threshold": 4,
   "toc_cell": false,
   "toc_position": {
    "height": "867px",
    "left": "0px",
    "right": "1670px",
    "top": "106px",
    "width": "250px"
   },
   "toc_section_display": "block",
   "toc_window_display": false,
   "widenNotebook": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
