Update notebooks/test.ipynb

This commit is contained in:
Markus 2018-12-11 15:50:42 -02:00
parent 980bba081a
commit 8a04f670b3
1 changed files with 19 additions and 137 deletions

View File

@ -2,145 +2,20 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 5,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
"outputs": [ "outputs": [
{ {
"name": "stdout", "ename": "ModuleNotFoundError",
"output_type": "stream", "evalue": "No module named 'simulation'",
"text": [ "output_type": "error",
"Simulation Run 1\n", "traceback": [
"\n", "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"single_proc: [<SimCAD.Configuration object at 0x10fc1a8d0>]\n", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"+----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------+\n", "\u001b[0;32m<ipython-input-5-6884438f1b6f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mSimCAD\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mengine\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mExecutionMode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mExecutionContext\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mExecutor\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0msimulation\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalidation\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconfig1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconfig2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mSimCAD\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconfigs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"| | mech_step | run | s1 | s2 | s3 | s4 | time_step | timestamp |\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'simulation'"
"|----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------|\n",
"| 0 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2018-10-01 15:16:24 |\n",
"| 1 | 1 | 1 | 1 | 4 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 2 | 2 | 1 | ab | 6 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 3 | 3 | 1 | ['c', 'd'] | [ 30 300] | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 4 | 1 | 1 | 1 | 4 | 9.94373 | 10.4365 | 2 | 2018-10-01 15:16:26 |\n",
"| 5 | 2 | 1 | ab | 6 | 9.94373 | 10.4365 | 2 | 2018-10-01 15:16:26 |\n",
"| 6 | 3 | 1 | ['c', 'd'] | [ 30 300] | 9.94373 | 10.4365 | 2 | 2018-10-01 15:16:26 |\n",
"| 7 | 1 | 1 | 1 | 4 | 7.81956 | 10.5372 | 3 | 2018-10-01 15:16:27 |\n",
"| 8 | 2 | 1 | ab | 6 | 7.81956 | 10.5372 | 3 | 2018-10-01 15:16:27 |\n",
"| 9 | 3 | 1 | ['c', 'd'] | [ 30 300] | 7.81956 | 10.5372 | 3 | 2018-10-01 15:16:27 |\n",
"| 10 | 1 | 1 | 1 | 4 | 9.10218 | 8.57362 | 4 | 2018-10-01 15:16:28 |\n",
"| 11 | 2 | 1 | ab | 6 | 9.10218 | 8.57362 | 4 | 2018-10-01 15:16:28 |\n",
"| 12 | 3 | 1 | ['c', 'd'] | [ 30 300] | 9.10218 | 8.57362 | 4 | 2018-10-01 15:16:28 |\n",
"| 13 | 1 | 1 | 1 | 4 | 7.46976 | 8.33579 | 5 | 2018-10-01 15:16:29 |\n",
"| 14 | 2 | 1 | ab | 6 | 7.46976 | 8.33579 | 5 | 2018-10-01 15:16:29 |\n",
"| 15 | 3 | 1 | ['c', 'd'] | [ 30 300] | 7.46976 | 8.33579 | 5 | 2018-10-01 15:16:29 |\n",
"| 16 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2018-10-01 15:16:24 |\n",
"| 17 | 1 | 2 | 1 | 4 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 18 | 2 | 2 | ab | 6 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 19 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 20 | 1 | 2 | 1 | 4 | 10.5029 | 9.91726 | 2 | 2018-10-01 15:16:26 |\n",
"| 21 | 2 | 2 | ab | 6 | 10.5029 | 9.91726 | 2 | 2018-10-01 15:16:26 |\n",
"| 22 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10.5029 | 9.91726 | 2 | 2018-10-01 15:16:26 |\n",
"| 23 | 1 | 2 | 1 | 4 | 9.19497 | 9.29545 | 3 | 2018-10-01 15:16:27 |\n",
"| 24 | 2 | 2 | ab | 6 | 9.19497 | 9.29545 | 3 | 2018-10-01 15:16:27 |\n",
"| 25 | 3 | 2 | ['c', 'd'] | [ 30 300] | 9.19497 | 9.29545 | 3 | 2018-10-01 15:16:27 |\n",
"| 26 | 1 | 2 | 1 | 4 | 8.22219 | 9.25471 | 4 | 2018-10-01 15:16:28 |\n",
"| 27 | 2 | 2 | ab | 6 | 8.22219 | 9.25471 | 4 | 2018-10-01 15:16:28 |\n",
"| 28 | 3 | 2 | ['c', 'd'] | [ 30 300] | 8.22219 | 9.25471 | 4 | 2018-10-01 15:16:28 |\n",
"| 29 | 1 | 2 | 1 | 4 | 7.47478 | 8.81306 | 5 | 2018-10-01 15:16:29 |\n",
"| 30 | 2 | 2 | ab | 6 | 7.47478 | 8.81306 | 5 | 2018-10-01 15:16:29 |\n",
"| 31 | 3 | 2 | ['c', 'd'] | [ 30 300] | 7.47478 | 8.81306 | 5 | 2018-10-01 15:16:29 |\n",
"+----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------+\n",
"\n",
"Simulation Run 2: Pairwise Execution\n",
"\n",
"multi_proc: [<SimCAD.Configuration object at 0x10fc1a8d0>, <SimCAD.Configuration object at 0x10fc1aeb8>]\n",
"+----+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----+\n",
"| | b1 | b2 | s1 | s2 | es1 | es2 | es3 | m |\n",
"|----+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----|\n",
"| 0 | <function b1m1 at 0x10faedd08> | <function b2m1 at 0x10fc230d0> | <function s1m1 at 0x10fc23378> | <function s2m1 at 0x10fc23400> | <function curried.<locals>._curried at 0x10fc23ae8> | <function curried.<locals>._curried at 0x10fc23b70> | <function curried.<locals>._curried at 0x10fc23bf8> | 1 |\n",
"| 1 | <function b1m2 at 0x10fc23158> | <function b2m2 at 0x10fc231e0> | <function s1m2 at 0x10fc23488> | <function s2m2 at 0x10fc23510> | <function curried.<locals>._curried at 0x10fc23ae8> | <function curried.<locals>._curried at 0x10fc23b70> | <function curried.<locals>._curried at 0x10fc23bf8> | 2 |\n",
"| 2 | <function b1m3 at 0x10fc23268> | <function b2m3 at 0x10fc232f0> | <function s1m3 at 0x10fc23598> | <function s2m3 at 0x10fc23620> | <function curried.<locals>._curried at 0x10fc23ae8> | <function curried.<locals>._curried at 0x10fc23b70> | <function curried.<locals>._curried at 0x10fc23bf8> | 3 |\n",
"+----+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----+\n",
"+----+--------------------------------+--------------------------------+--------------------------------+------------------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----+\n",
"| | b1 | b2 | s1 | s2 | es1 | es2 | es3 | m |\n",
"|----+--------------------------------+--------------------------------+--------------------------------+------------------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----|\n",
"| 0 | <function b1m1 at 0x10fc23d08> | <function b2m1 at 0x10fc23d90> | <function s1m1 at 0x10fc290d0> | <function state_identity.<locals>.<lambda> at 0x10d4f6598> | <function curried.<locals>._curried at 0x10fc29840> | <function curried.<locals>._curried at 0x10fc298c8> | <function curried.<locals>._curried at 0x10fc29950> | 1 |\n",
"| 1 | <function b1m2 at 0x10fc23e18> | <function b2m2 at 0x10fc23ea0> | <function s1m2 at 0x10fc291e0> | <function state_identity.<locals>.<lambda> at 0x10d4f6598> | <function curried.<locals>._curried at 0x10fc29840> | <function curried.<locals>._curried at 0x10fc298c8> | <function curried.<locals>._curried at 0x10fc29950> | 2 |\n",
"| 2 | <function b1m3 at 0x10fc23f28> | <function b2m3 at 0x10fc29048> | <function s1m3 at 0x10fc292f0> | <function s2m3 at 0x10fc29378> | <function curried.<locals>._curried at 0x10fc29840> | <function curried.<locals>._curried at 0x10fc298c8> | <function curried.<locals>._curried at 0x10fc29950> | 3 |\n",
"+----+--------------------------------+--------------------------------+--------------------------------+------------------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----------------------------------------------------+-----+\n",
"+----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------+\n",
"| | mech_step | run | s1 | s2 | s3 | s4 | time_step | timestamp |\n",
"|----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------|\n",
"| 0 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2018-10-01 15:16:24 |\n",
"| 1 | 1 | 1 | 1 | 4 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 2 | 2 | 1 | ab | 6 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 3 | 3 | 1 | ['c', 'd'] | [ 30 300] | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 4 | 1 | 1 | 1 | 4 | 12.2922 | 10.8846 | 2 | 2018-10-01 15:16:26 |\n",
"| 5 | 2 | 1 | ab | 6 | 12.2922 | 10.8846 | 2 | 2018-10-01 15:16:26 |\n",
"| 6 | 3 | 1 | ['c', 'd'] | [ 30 300] | 12.2922 | 10.8846 | 2 | 2018-10-01 15:16:26 |\n",
"| 7 | 1 | 1 | 1 | 4 | 12.3433 | 11.8439 | 3 | 2018-10-01 15:16:27 |\n",
"| 8 | 2 | 1 | ab | 6 | 12.3433 | 11.8439 | 3 | 2018-10-01 15:16:27 |\n",
"| 9 | 3 | 1 | ['c', 'd'] | [ 30 300] | 12.3433 | 11.8439 | 3 | 2018-10-01 15:16:27 |\n",
"| 10 | 1 | 1 | 1 | 4 | 10.9634 | 13.8687 | 4 | 2018-10-01 15:16:28 |\n",
"| 11 | 2 | 1 | ab | 6 | 10.9634 | 13.8687 | 4 | 2018-10-01 15:16:28 |\n",
"| 12 | 3 | 1 | ['c', 'd'] | [ 30 300] | 10.9634 | 13.8687 | 4 | 2018-10-01 15:16:28 |\n",
"| 13 | 1 | 1 | 1 | 4 | 11.5544 | 13.9381 | 5 | 2018-10-01 15:16:29 |\n",
"| 14 | 2 | 1 | ab | 6 | 11.5544 | 13.9381 | 5 | 2018-10-01 15:16:29 |\n",
"| 15 | 3 | 1 | ['c', 'd'] | [ 30 300] | 11.5544 | 13.9381 | 5 | 2018-10-01 15:16:29 |\n",
"| 16 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2018-10-01 15:16:24 |\n",
"| 17 | 1 | 2 | 1 | 4 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 18 | 2 | 2 | ab | 6 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 19 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 20 | 1 | 2 | 1 | 4 | 9.98087 | 9.45464 | 2 | 2018-10-01 15:16:26 |\n",
"| 21 | 2 | 2 | ab | 6 | 9.98087 | 9.45464 | 2 | 2018-10-01 15:16:26 |\n",
"| 22 | 3 | 2 | ['c', 'd'] | [ 30 300] | 9.98087 | 9.45464 | 2 | 2018-10-01 15:16:26 |\n",
"| 23 | 1 | 2 | 1 | 4 | 11.1536 | 7.9925 | 3 | 2018-10-01 15:16:27 |\n",
"| 24 | 2 | 2 | ab | 6 | 11.1536 | 7.9925 | 3 | 2018-10-01 15:16:27 |\n",
"| 25 | 3 | 2 | ['c', 'd'] | [ 30 300] | 11.1536 | 7.9925 | 3 | 2018-10-01 15:16:27 |\n",
"| 26 | 1 | 2 | 1 | 4 | 10.3195 | 8.77766 | 4 | 2018-10-01 15:16:28 |\n",
"| 27 | 2 | 2 | ab | 6 | 10.3195 | 8.77766 | 4 | 2018-10-01 15:16:28 |\n",
"| 28 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10.3195 | 8.77766 | 4 | 2018-10-01 15:16:28 |\n",
"| 29 | 1 | 2 | 1 | 4 | 10.3288 | 7.81118 | 5 | 2018-10-01 15:16:29 |\n",
"| 30 | 2 | 2 | ab | 6 | 10.3288 | 7.81118 | 5 | 2018-10-01 15:16:29 |\n",
"| 31 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10.3288 | 7.81118 | 5 | 2018-10-01 15:16:29 |\n",
"+----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------+\n",
"+----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------+\n",
"| | mech_step | run | s1 | s2 | s3 | s4 | time_step | timestamp |\n",
"|----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------|\n",
"| 0 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2018-10-01 15:16:24 |\n",
"| 1 | 1 | 1 | 1 | 0 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 2 | 2 | 1 | ab | 0 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 3 | 3 | 1 | ['c', 'd'] | [ 30 300] | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 4 | 1 | 1 | 1 | [ 30 300] | 9.94373 | 10.4365 | 2 | 2018-10-01 15:16:26 |\n",
"| 5 | 2 | 1 | ab | [ 30 300] | 9.94373 | 10.4365 | 2 | 2018-10-01 15:16:26 |\n",
"| 6 | 3 | 1 | ['c', 'd'] | [ 30 300] | 9.94373 | 10.4365 | 2 | 2018-10-01 15:16:26 |\n",
"| 7 | 1 | 1 | 1 | [ 30 300] | 7.81956 | 10.5372 | 3 | 2018-10-01 15:16:27 |\n",
"| 8 | 2 | 1 | ab | [ 30 300] | 7.81956 | 10.5372 | 3 | 2018-10-01 15:16:27 |\n",
"| 9 | 3 | 1 | ['c', 'd'] | [ 30 300] | 7.81956 | 10.5372 | 3 | 2018-10-01 15:16:27 |\n",
"| 10 | 1 | 1 | 1 | [ 30 300] | 9.10218 | 8.57362 | 4 | 2018-10-01 15:16:28 |\n",
"| 11 | 2 | 1 | ab | [ 30 300] | 9.10218 | 8.57362 | 4 | 2018-10-01 15:16:28 |\n",
"| 12 | 3 | 1 | ['c', 'd'] | [ 30 300] | 9.10218 | 8.57362 | 4 | 2018-10-01 15:16:28 |\n",
"| 13 | 1 | 1 | 1 | [ 30 300] | 7.46976 | 8.33579 | 5 | 2018-10-01 15:16:29 |\n",
"| 14 | 2 | 1 | ab | [ 30 300] | 7.46976 | 8.33579 | 5 | 2018-10-01 15:16:29 |\n",
"| 15 | 3 | 1 | ['c', 'd'] | [ 30 300] | 7.46976 | 8.33579 | 5 | 2018-10-01 15:16:29 |\n",
"| 16 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2018-10-01 15:16:24 |\n",
"| 17 | 1 | 2 | 1 | 0 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 18 | 2 | 2 | ab | 0 | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 19 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10 | 10 | 1 | 2018-10-01 15:16:25 |\n",
"| 20 | 1 | 2 | 1 | [ 30 300] | 10.5029 | 9.91726 | 2 | 2018-10-01 15:16:26 |\n",
"| 21 | 2 | 2 | ab | [ 30 300] | 10.5029 | 9.91726 | 2 | 2018-10-01 15:16:26 |\n",
"| 22 | 3 | 2 | ['c', 'd'] | [ 30 300] | 10.5029 | 9.91726 | 2 | 2018-10-01 15:16:26 |\n",
"| 23 | 1 | 2 | 1 | [ 30 300] | 9.19497 | 9.29545 | 3 | 2018-10-01 15:16:27 |\n",
"| 24 | 2 | 2 | ab | [ 30 300] | 9.19497 | 9.29545 | 3 | 2018-10-01 15:16:27 |\n",
"| 25 | 3 | 2 | ['c', 'd'] | [ 30 300] | 9.19497 | 9.29545 | 3 | 2018-10-01 15:16:27 |\n",
"| 26 | 1 | 2 | 1 | [ 30 300] | 8.22219 | 9.25471 | 4 | 2018-10-01 15:16:28 |\n",
"| 27 | 2 | 2 | ab | [ 30 300] | 8.22219 | 9.25471 | 4 | 2018-10-01 15:16:28 |\n",
"| 28 | 3 | 2 | ['c', 'd'] | [ 30 300] | 8.22219 | 9.25471 | 4 | 2018-10-01 15:16:28 |\n",
"| 29 | 1 | 2 | 1 | [ 30 300] | 7.47478 | 8.81306 | 5 | 2018-10-01 15:16:29 |\n",
"| 30 | 2 | 2 | ab | [ 30 300] | 7.47478 | 8.81306 | 5 | 2018-10-01 15:16:29 |\n",
"| 31 | 3 | 2 | ['c', 'd'] | [ 30 300] | 7.47478 | 8.81306 | 5 | 2018-10-01 15:16:29 |\n",
"+----+-------------+-------+------------+-----------+----------+----------+-------------+---------------------+\n",
"\n"
] ]
} }
], ],
@ -149,7 +24,7 @@
"from tabulate import tabulate\n", "from tabulate import tabulate\n",
"\n", "\n",
"from SimCAD.engine import ExecutionMode, ExecutionContext, Executor\n", "from SimCAD.engine import ExecutionMode, ExecutionContext, Executor\n",
"from sandboxUX import config1, config2\n", "from simulations.validation import config1, config2\n",
"from SimCAD import configs\n", "from SimCAD import configs\n",
"\n", "\n",
"# ToDo: pass ExecutionContext with execution method as ExecutionContext input\n", "# ToDo: pass ExecutionContext with execution method as ExecutionContext input\n",
@ -162,7 +37,7 @@
"single_proc_ctx = ExecutionContext(exec_mode.single_proc)\n", "single_proc_ctx = ExecutionContext(exec_mode.single_proc)\n",
"run1 = Executor(single_proc_ctx, single_config)\n", "run1 = Executor(single_proc_ctx, single_config)\n",
"run1_raw_result = run1.main()\n", "run1_raw_result = run1.main()\n",
"result = pd.DataFrame(run1_raw_result)\n", "result = pd.DataFrame(run1_raw_result[0])\n",
"print(tabulate(result, headers='keys', tablefmt='psql'))\n", "print(tabulate(result, headers='keys', tablefmt='psql'))\n",
"print()\n", "print()\n",
"\n", "\n",
@ -172,10 +47,17 @@
"run2 = Executor(multi_proc_ctx, configs)\n", "run2 = Executor(multi_proc_ctx, configs)\n",
"run2_raw_results = run2.main()\n", "run2_raw_results = run2.main()\n",
"for raw_result in run2_raw_results:\n", "for raw_result in run2_raw_results:\n",
" result = pd.DataFrame(raw_result)\n", " result = pd.DataFrame(raw_result[0])\n",
" print(tabulate(result, headers='keys', tablefmt='psql'))\n", " print(tabulate(result, headers='keys', tablefmt='psql'))\n",
"print()" "print()"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {