{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from tabulate import tabulate\n", "\n", "# The following imports NEED to be in the exact order\n", "from cadCAD.engine import ExecutionMode, ExecutionContext, Executor\n", "from validation import config1, config2, config3, config4\n", "from cadCAD import configs\n", "\n", "exec_mode = ExecutionMode()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "config[0]\n", "single_proc: []\n", " run s1 s2 s3 s4 substep timestep\n", "0 1 0 0 1 1 0 0\n", "1 1 1 4 5 1.178862847343031816649272514 1 1\n", "2 1 ab 6 5 1.178862847343031816649272514 2 1\n", "3 1 [c, d] [30, 300] 5 1.178862847343031816649272514 3 1\n", "4 1 1 4 5 1.230321371869816411424320371 1 2\n", "\n", "config[1]\n", "single_proc: []\n", " run s1 s2 s3 \\\n", "0 1 0 0 1 \n", "1 1 1 0 0.9583242152594528828757347583 \n", "2 1 a 0 0.9583242152594528828757347583 \n", "3 1 [c, d] [30, 300] 0.9583242152594528828757347583 \n", "4 1 1 [30, 300] 0.9529320289547716885340867310 \n", "\n", " s4 substep timestep \n", "0 1 0 0 \n", "1 1.178862847343031816649272514 1 1 \n", "2 1.178862847343031816649272514 2 1 \n", "3 1.178862847343031816649272514 3 1 \n", "4 1.230321371869816411424320371 1 2 \n", "\n", "config[2]\n", "single_proc: []\n", " run s1 s2 s3 s4 substep timestamp timestep\n", "0 1 0 0 1 1 0 2018-10-01 15:16:24 0\n", "1 1 [1] 0 1 1 1 2018-10-01 15:16:24 1\n", "2 1 [1] 0 1 1 1 2018-10-01 15:16:24 2\n", "3 1 [1] 0 1 1 1 2018-10-01 15:16:24 3\n", "4 1 [1] 0 1 1 1 2018-10-01 15:16:24 4\n", "\n", "config[3]\n", "single_proc: []\n", " run s1 s2 s3 s4 substep timestamp timestep\n", "0 1 0 0 1 1 0 2018-10-01 15:16:24 0\n", "1 1 0 0 1 1 1 2018-10-01 15:16:24 1\n", "2 1 0 0 1 1 1 2018-10-01 15:16:24 2\n", "3 1 0 0 1 1 1 2018-10-01 15:16:24 3\n", "4 1 0 0 1 1 1 2018-10-01 15:16:24 4\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Users/markusbkoch/Documents/GitHub/DiffyQ-SimCAD/cadCAD/utils/__init__.py:86: FutureWarning: The use of a dictionary to describe Partial State Update Blocks will be deprecated. Use a list instead.\n", " FutureWarning)\n" ] } ], "source": [ "for idx, c in enumerate(configs):\n", " print()\n", " print(f\"config[{idx}]\")\n", " single_proc_ctx = ExecutionContext(context=exec_mode.single_proc)\n", " run1 = Executor(exec_context=single_proc_ctx, configs=[c])\n", " run1_raw_result, raw_tensor_field = run1.main()\n", " result = pd.DataFrame(run1_raw_result)\n", " print(result.head())\n", "# tensor_field = pd.DataFrame(raw_tensor_field)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "multi_proc: [, , , , , ]\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Users/markusbkoch/Documents/GitHub/DiffyQ-SimCAD/cadCAD/utils/__init__.py:86: FutureWarning: The use of a dictionary to describe Partial State Update Blocks will be deprecated. Use a list instead.\n", " FutureWarning)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "result[0]\n", " run s1 s2 s3 s4 substep \\\n", "0 1 0 0 1 1 0 \n", "1 1 1 4 5 0.8686135246637317619544660374 1 \n", "2 1 ab 6 5 0.8686135246637317619544660374 2 \n", "3 1 [c, d] [30, 300] 5 0.8686135246637317619544660374 3 \n", "4 1 1 4 5 0.9454530210559482586784741082 1 \n", "\n", " timestep \n", "0 0 \n", "1 1 \n", "2 1 \n", "3 1 \n", "4 2 \n", "\n", "result[1]\n", " run s1 s2 s3 \\\n", "0 1 0 0 1 \n", "1 1 1 0 1.055145404454642443781153816 \n", "2 1 a 0 1.055145404454642443781153816 \n", "3 1 [c, d] [30, 300] 1.055145404454642443781153816 \n", "4 1 1 [30, 300] 1.297006679532223553389019665 \n", "\n", " s4 substep timestep \n", "0 1 0 0 \n", "1 0.8686135246637317619544660374 1 1 \n", "2 0.8686135246637317619544660374 2 1 \n", "3 0.8686135246637317619544660374 3 1 \n", "4 0.9454530210559482586784741082 1 2 \n", "\n", "result[2]\n", " run s1 s2 s3 s4 substep timestamp timestep\n", "0 1 0 0 1 1 0 2018-10-01 15:16:24 0\n", "1 1 [1] 0 1 1 1 2018-10-01 15:16:24 1\n", "2 1 [1] 0 1 1 1 2018-10-01 15:16:24 2\n", "3 1 [1] 0 1 1 1 2018-10-01 15:16:24 3\n", "4 1 [1] 0 1 1 1 2018-10-01 15:16:24 4\n", "\n", "result[3]\n", " run s1 s2 s3 s4 substep timestamp timestep\n", "0 1 0 0 1 1 0 2018-10-01 15:16:24 0\n", "1 1 0 0 1 1 1 2018-10-01 15:16:24 1\n", "2 1 0 0 1 1 1 2018-10-01 15:16:24 2\n", "3 1 0 0 1 1 1 2018-10-01 15:16:24 3\n", "4 1 0 0 1 1 1 2018-10-01 15:16:24 4\n", "\n", "result[4]\n", " run s1 s2 s3 s4 substep timestep\n", "0 1 0 0 1 1 0 0\n", "1 1 0 2 3 3 1 1\n", "2 1 2 2 3 3 2 1\n", "3 1 0 0 3 3 3 1\n", "4 1 0 2 3 3 1 2\n", "\n", "result[5]\n", " run s1 s2 s3 s4 substep timestep\n", "0 1 0 0 1 1 0 0\n", "1 1 0 5 4 4 1 1\n", "2 1 5 5 4 4 2 1\n", "3 1 0 0 4 4 3 1\n", "4 1 0 5 4 4 1 2\n" ] } ], "source": [ "from validation import sweep_config\n", "multi_proc_ctx = ExecutionContext(context=exec_mode.multi_proc)\n", "run2 = Executor(exec_context=multi_proc_ctx, configs=configs)\n", "results = []\n", "tensor_fields = []\n", "for raw_result, raw_tensor_field in run2.main():\n", " results.append(pd.DataFrame(raw_result))\n", " tensor_fields.append(pd.DataFrame(raw_tensor_field))\n", "\n", "for idx, r in enumerate(results):\n", " print()\n", " print(f\"result[{idx}]\")\n", " print(r.head())" ] } ], "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.6.5" } }, "nbformat": 4, "nbformat_minor": 1 }