Created
September 4, 2020 13:53
-
-
Save BenSchZA/c8aef315c2c25e347e2d0cd6fe489eed to your computer and use it in GitHub Desktop.
mc-run-hotfix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "%load_ext autoreload\n", | |
| "%autoreload 2\n", | |
| "\n", | |
| "import cadCAD\n", | |
| "cadCAD.__file__" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from cadCAD.configuration.utils import config_sim\n", | |
| "from cadCAD.configuration import Experiment\n", | |
| "from cadCAD.engine import ExecutionMode, ExecutionContext\n", | |
| "from cadCAD.engine import Executor\n", | |
| "\n", | |
| "import pandas as pd" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "system_params = {\n", | |
| " 'add': [10]\n", | |
| "}\n", | |
| "\n", | |
| "initial_state = {\n", | |
| " 'a': 0\n", | |
| "}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from numpy import random\n", | |
| "\n", | |
| "def update_a(params, substep, state_history, previous_state, policy_input, **kwargs):\n", | |
| " return 'a', previous_state['a'] + params['add'] * random.rand()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "psubs = [\n", | |
| " {\n", | |
| " 'policies': {},\n", | |
| " 'variables': {\n", | |
| " 'a': update_a\n", | |
| " }\n", | |
| " }\n", | |
| "]" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from cadCAD import configs\n", | |
| "del configs[:] # Clear any prior configs" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "[{'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 0, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 0, 'run_id': 0}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 0, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 0, 'run_id': 1}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 0, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 0, 'run_id': 2}]\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "exp = Experiment()\n", | |
| "\n", | |
| "sim_config = config_sim({\n", | |
| " \"N\": 3,\n", | |
| " \"T\": range(100),\n", | |
| " \"M\": system_params\n", | |
| "})\n", | |
| "# print(sim_config)\n", | |
| "\n", | |
| "exp.append_configs(\n", | |
| " initial_state = initial_state,\n", | |
| " partial_state_update_blocks = psubs,\n", | |
| " sim_configs = sim_config\n", | |
| ")\n", | |
| "# print(sim_config)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\n", | |
| " ___________ ____\n", | |
| " ________ __ ___/ / ____/ | / __ \\\n", | |
| " / ___/ __` / __ / / / /| | / / / /\n", | |
| "/ /__/ /_/ / /_/ / /___/ ___ |/ /_/ /\n", | |
| "\\___/\\__,_/\\__,_/\\____/_/ |_/_____/\n", | |
| "by cadCAD\n", | |
| "\n", | |
| "Execution Mode: local_proc\n", | |
| "Configuration Count: 1\n", | |
| "Dimensions of the first simulation: (Timesteps, Params, Runs, Vars) = (100, 1, 3, 1)\n", | |
| "Execution Method: local_simulations\n", | |
| "SimIDs : [0, 0, 0]\n", | |
| "SubsetIDs: [0, 0, 0]\n", | |
| "Ns : [0, 1, 2]\n", | |
| "ExpIDs : [0, 0, 0]\n", | |
| "Execution Mode: parallelized\n", | |
| "Total execution time: 0.03s\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "'multi_proc'" | |
| ] | |
| }, | |
| "execution_count": 8, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "exec_mode = ExecutionMode()\n", | |
| "local_mode_ctx = ExecutionContext(context=exec_mode.local_mode)\n", | |
| "\n", | |
| "simulation = Executor(exec_context=local_mode_ctx, configs=configs)\n", | |
| "\n", | |
| "raw_system_events, tensor_field, sessions = simulation.execute()\n", | |
| "\n", | |
| "exec_mode.multi_proc" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "[{'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=0_0',\n", | |
| " 'simulation_id': 0,\n", | |
| " 'run_id': 0,\n", | |
| " 'subset_id': 0,\n", | |
| " 'subset_window': deque([0, 0])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=0_1',\n", | |
| " 'simulation_id': 0,\n", | |
| " 'run_id': 1,\n", | |
| " 'subset_id': 0,\n", | |
| " 'subset_window': deque([0, 0])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=0_2',\n", | |
| " 'simulation_id': 0,\n", | |
| " 'run_id': 2,\n", | |
| " 'subset_id': 0,\n", | |
| " 'subset_window': deque([0, 0])}]" | |
| ] | |
| }, | |
| "execution_count": 9, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "sessions" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 10, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>7.201762</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>12.985155</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>13.807088</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>19.579460</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>...</th>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>298</th>\n", | |
| " <td>462.187262</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>96</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>299</th>\n", | |
| " <td>464.684905</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>97</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>300</th>\n", | |
| " <td>467.214356</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>98</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>301</th>\n", | |
| " <td>473.321282</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>99</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>302</th>\n", | |
| " <td>474.217380</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>100</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "<p>303 rows × 6 columns</p>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "0 0.000000 0 0 1 0 0\n", | |
| "1 7.201762 0 0 1 1 1\n", | |
| "2 12.985155 0 0 1 1 2\n", | |
| "3 13.807088 0 0 1 1 3\n", | |
| "4 19.579460 0 0 1 1 4\n", | |
| ".. ... ... ... ... ... ...\n", | |
| "298 462.187262 0 0 3 1 96\n", | |
| "299 464.684905 0 0 3 1 97\n", | |
| "300 467.214356 0 0 3 1 98\n", | |
| "301 473.321282 0 0 3 1 99\n", | |
| "302 474.217380 0 0 3 1 100\n", | |
| "\n", | |
| "[303 rows x 6 columns]" | |
| ] | |
| }, | |
| "execution_count": 10, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "simulation_result = pd.DataFrame(raw_system_events)\n", | |
| "simulation_result" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 11, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "df = simulation_result.copy()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 12, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>7.201762</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>12.985155</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>13.807088</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>19.579460</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "0 0.000000 0 0 1 0 0\n", | |
| "1 7.201762 0 0 1 1 1\n", | |
| "2 12.985155 0 0 1 1 2\n", | |
| "3 13.807088 0 0 1 1 3\n", | |
| "4 19.579460 0 0 1 1 4" | |
| ] | |
| }, | |
| "execution_count": 12, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df[df['run'] == 1].head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 13, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>101</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>102</th>\n", | |
| " <td>1.139284</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>103</th>\n", | |
| " <td>4.291707</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>104</th>\n", | |
| " <td>5.452919</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>105</th>\n", | |
| " <td>11.419502</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "101 0.000000 0 0 2 0 0\n", | |
| "102 1.139284 0 0 2 1 1\n", | |
| "103 4.291707 0 0 2 1 2\n", | |
| "104 5.452919 0 0 2 1 3\n", | |
| "105 11.419502 0 0 2 1 4" | |
| ] | |
| }, | |
| "execution_count": 13, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df[df['run'] == 2].head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 14, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>202</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>203</th>\n", | |
| " <td>6.796407</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>204</th>\n", | |
| " <td>12.630302</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>205</th>\n", | |
| " <td>13.932469</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>206</th>\n", | |
| " <td>20.626006</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "202 0.000000 0 0 3 0 0\n", | |
| "203 6.796407 0 0 3 1 1\n", | |
| "204 12.630302 0 0 3 1 2\n", | |
| "205 13.932469 0 0 3 1 3\n", | |
| "206 20.626006 0 0 3 1 4" | |
| ] | |
| }, | |
| "execution_count": 14, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df[df['run'] == 3].head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "---" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 15, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "system_params = {\n", | |
| " 'add': [10,10,10]\n", | |
| "}\n", | |
| "\n", | |
| "initial_state = {\n", | |
| " 'a': 0\n", | |
| "}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 16, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from numpy import random\n", | |
| "\n", | |
| "def update_a(params, substep, state_history, previous_state, policy_input, **kwargs):\n", | |
| " return 'a', previous_state['a'] + params['add'] * random.rand()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 17, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "psubs = [\n", | |
| " {\n", | |
| " 'policies': {},\n", | |
| " 'variables': {\n", | |
| " 'a': update_a\n", | |
| " }\n", | |
| " }\n", | |
| "]" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 18, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from cadCAD import configs\n", | |
| "del configs[:] # Clear any prior configs" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 19, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "[{'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 0, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 0, 'run_id': 0}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 0, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 0, 'run_id': 1}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 0, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 0, 'run_id': 2}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 1, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 1, 'run_id': 0}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 1, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 1, 'run_id': 1}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 1, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 1, 'run_id': 2}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 2, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 2, 'run_id': 0}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 2, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 2, 'run_id': 1}, {'N': 1, 'T': range(0, 100), 'M': {'add': 10}, 'subset_id': 2, 'subset_window': deque([0, None], maxlen=2), 'simulation_id': 2, 'run_id': 2}]\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "exp = Experiment()\n", | |
| "\n", | |
| "sim_config = config_sim({\n", | |
| " \"N\": 3,\n", | |
| " \"T\": range(100),\n", | |
| " \"M\": system_params\n", | |
| "})\n", | |
| "\n", | |
| "exp.append_configs(\n", | |
| " initial_state = initial_state,\n", | |
| " partial_state_update_blocks = psubs,\n", | |
| " sim_configs = sim_config\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 20, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\n", | |
| " ___________ ____\n", | |
| " ________ __ ___/ / ____/ | / __ \\\n", | |
| " / ___/ __` / __ / / / /| | / / / /\n", | |
| "/ /__/ /_/ / /_/ / /___/ ___ |/ /_/ /\n", | |
| "\\___/\\__,_/\\__,_/\\____/_/ |_/_____/\n", | |
| "by cadCAD\n", | |
| "\n", | |
| "Execution Mode: local_proc\n", | |
| "Configuration Count: 3\n", | |
| "Dimensions of the first simulation: (Timesteps, Params, Runs, Vars) = (100, 1, 3, 1)\n", | |
| "Execution Method: local_simulations\n", | |
| "SimIDs : [0, 0, 0, 1, 1, 1, 2, 2, 2]\n", | |
| "SubsetIDs: [0, 0, 0, 1, 1, 1, 2, 2, 2]\n", | |
| "Ns : [0, 1, 2, 0, 1, 2, 0, 1, 2]\n", | |
| "ExpIDs : [0, 0, 0, 0, 0, 0, 0, 0, 0]\n", | |
| "Execution Mode: parallelized\n", | |
| "Total execution time: 0.06s\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "exec_mode = ExecutionMode()\n", | |
| "local_mode_ctx = ExecutionContext(context=exec_mode.local_mode)\n", | |
| "\n", | |
| "simulation = Executor(exec_context=local_mode_ctx, configs=configs)\n", | |
| "\n", | |
| "raw_system_events, tensor_field, sessions = simulation.execute()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 21, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "[{'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=0_0',\n", | |
| " 'simulation_id': 0,\n", | |
| " 'run_id': 0,\n", | |
| " 'subset_id': 0,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=0_1',\n", | |
| " 'simulation_id': 0,\n", | |
| " 'run_id': 1,\n", | |
| " 'subset_id': 0,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=0_2',\n", | |
| " 'simulation_id': 0,\n", | |
| " 'run_id': 2,\n", | |
| " 'subset_id': 0,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=1_0',\n", | |
| " 'simulation_id': 1,\n", | |
| " 'run_id': 0,\n", | |
| " 'subset_id': 1,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=1_1',\n", | |
| " 'simulation_id': 1,\n", | |
| " 'run_id': 1,\n", | |
| " 'subset_id': 1,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=1_2',\n", | |
| " 'simulation_id': 1,\n", | |
| " 'run_id': 2,\n", | |
| " 'subset_id': 1,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=2_0',\n", | |
| " 'simulation_id': 2,\n", | |
| " 'run_id': 0,\n", | |
| " 'subset_id': 2,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=2_1',\n", | |
| " 'simulation_id': 2,\n", | |
| " 'run_id': 1,\n", | |
| " 'subset_id': 2,\n", | |
| " 'subset_window': deque([2, 2])},\n", | |
| " {'user_id': 'cadCAD_user',\n", | |
| " 'experiment_id': 0,\n", | |
| " 'session_id': 'cadCAD_user=2_2',\n", | |
| " 'simulation_id': 2,\n", | |
| " 'run_id': 2,\n", | |
| " 'subset_id': 2,\n", | |
| " 'subset_window': deque([2, 2])}]" | |
| ] | |
| }, | |
| "execution_count": 21, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "sessions" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 22, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>3.584995</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>8.837808</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>11.780959</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>21.201066</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>...</th>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>904</th>\n", | |
| " <td>484.280146</td>\n", | |
| " <td>2</td>\n", | |
| " <td>2</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>96</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>905</th>\n", | |
| " <td>491.913474</td>\n", | |
| " <td>2</td>\n", | |
| " <td>2</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>97</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>906</th>\n", | |
| " <td>497.662872</td>\n", | |
| " <td>2</td>\n", | |
| " <td>2</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>98</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>907</th>\n", | |
| " <td>502.692637</td>\n", | |
| " <td>2</td>\n", | |
| " <td>2</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>99</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>908</th>\n", | |
| " <td>512.387846</td>\n", | |
| " <td>2</td>\n", | |
| " <td>2</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>100</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "<p>909 rows × 6 columns</p>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "0 0.000000 0 0 1 0 0\n", | |
| "1 3.584995 0 0 1 1 1\n", | |
| "2 8.837808 0 0 1 1 2\n", | |
| "3 11.780959 0 0 1 1 3\n", | |
| "4 21.201066 0 0 1 1 4\n", | |
| ".. ... ... ... ... ... ...\n", | |
| "904 484.280146 2 2 3 1 96\n", | |
| "905 491.913474 2 2 3 1 97\n", | |
| "906 497.662872 2 2 3 1 98\n", | |
| "907 502.692637 2 2 3 1 99\n", | |
| "908 512.387846 2 2 3 1 100\n", | |
| "\n", | |
| "[909 rows x 6 columns]" | |
| ] | |
| }, | |
| "execution_count": 22, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "simulation_result = pd.DataFrame(raw_system_events)\n", | |
| "simulation_result" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 23, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "df = simulation_result.copy()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 24, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>3.584995</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>8.837808</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>11.780959</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>21.201066</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "0 0.000000 0 0 1 0 0\n", | |
| "1 3.584995 0 0 1 1 1\n", | |
| "2 8.837808 0 0 1 1 2\n", | |
| "3 11.780959 0 0 1 1 3\n", | |
| "4 21.201066 0 0 1 1 4" | |
| ] | |
| }, | |
| "execution_count": 24, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df[df['run'] == 1].head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 25, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>101</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>102</th>\n", | |
| " <td>6.824417</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>103</th>\n", | |
| " <td>10.798997</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>104</th>\n", | |
| " <td>14.146451</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>105</th>\n", | |
| " <td>17.351503</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>2</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "101 0.000000 0 0 2 0 0\n", | |
| "102 6.824417 0 0 2 1 1\n", | |
| "103 10.798997 0 0 2 1 2\n", | |
| "104 14.146451 0 0 2 1 3\n", | |
| "105 17.351503 0 0 2 1 4" | |
| ] | |
| }, | |
| "execution_count": 25, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df[df['run'] == 2].head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 26, | |
| "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 th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>a</th>\n", | |
| " <th>simulation</th>\n", | |
| " <th>subset</th>\n", | |
| " <th>run</th>\n", | |
| " <th>substep</th>\n", | |
| " <th>timestep</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>202</th>\n", | |
| " <td>0.000000</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>203</th>\n", | |
| " <td>8.853333</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>1</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>204</th>\n", | |
| " <td>10.047368</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>2</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>205</th>\n", | |
| " <td>13.588649</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>3</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>206</th>\n", | |
| " <td>16.557077</td>\n", | |
| " <td>0</td>\n", | |
| " <td>0</td>\n", | |
| " <td>3</td>\n", | |
| " <td>1</td>\n", | |
| " <td>4</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " a simulation subset run substep timestep\n", | |
| "202 0.000000 0 0 3 0 0\n", | |
| "203 8.853333 0 0 3 1 1\n", | |
| "204 10.047368 0 0 3 1 2\n", | |
| "205 13.588649 0 0 3 1 3\n", | |
| "206 16.557077 0 0 3 1 4" | |
| ] | |
| }, | |
| "execution_count": 26, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "df[df['run'] == 3].head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "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.5" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 4 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment