cadCAD/notebooks/test.ipynb

85 lines
3.3 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": false
},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'simulation'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\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",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'simulation'"
]
}
],
"source": [
"import pandas as pd\n",
"from tabulate import tabulate\n",
"\n",
"from SimCAD.engine import ExecutionMode, ExecutionContext, Executor\n",
"from simulations.validation import config1, config2\n",
"from SimCAD import configs\n",
"\n",
"# ToDo: pass ExecutionContext with execution method as ExecutionContext input\n",
"\n",
"exec_mode = ExecutionMode()\n",
"\n",
"print(\"Simulation Run 1\")\n",
"print()\n",
"single_config = [configs[0]]\n",
"single_proc_ctx = ExecutionContext(exec_mode.single_proc)\n",
"run1 = Executor(single_proc_ctx, single_config)\n",
"run1_raw_result = run1.main()\n",
"result = pd.DataFrame(run1_raw_result[0])\n",
"print(tabulate(result, headers='keys', tablefmt='psql'))\n",
"print()\n",
"\n",
"print(\"Simulation Run 2: Pairwise Execution\")\n",
"print()\n",
"multi_proc_ctx = ExecutionContext(exec_mode.multi_proc)\n",
"run2 = Executor(multi_proc_ctx, configs)\n",
"run2_raw_results = run2.main()\n",
"for raw_result in run2_raw_results:\n",
" result = pd.DataFrame(raw_result[0])\n",
" print(tabulate(result, headers='keys', tablefmt='psql'))\n",
"print()"
]
},
{
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}