Skip to content

Commit

Permalink
lol
Browse files Browse the repository at this point in the history
  • Loading branch information
YouGuessedMyName committed Sep 11, 2024
1 parent d2d8742 commit 633bfb8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 249 deletions.
239 changes: 15 additions & 224 deletions notebooks/die.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,31 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-20T17:16:04.843781Z",
"iopub.status.busy": "2024-08-20T17:16:04.843535Z",
"iopub.status.idle": "2024-08-20T17:16:04.994056Z",
"shell.execute_reply": "2024-08-20T17:16:04.993455Z"
}
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import stormvogel.model\n",
"import stormvogel.visualization\n",
"import stormvogel.show\n",
"import stormvogel.communication_server\n",
"from stormvogel.layout import Layout, DEFAULT"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-20T17:16:04.996006Z",
"iopub.status.busy": "2024-08-20T17:16:04.995867Z",
"iopub.status.idle": "2024-08-20T17:16:05.125021Z",
"shell.execute_reply": "2024-08-20T17:16:05.124567Z"
}
},
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6f6379ce681543a3874dc3e64d59370e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(interactive(children=(Checkbox(value=True, description='Auto apply changes'), Output()), _dom_c\u2026"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a879e5fe72f544d9b9172a22502f33eb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(button_style='success', description='Save', style=ButtonStyle())"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f82e5949b4554ba1bda41c27cc4c3e30",
"model_id": "950b5e80d1cb415f9b51cdc29f07ff1d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
"VBox(children=(Output(),))"
]
},
"metadata": {},
Expand All @@ -75,183 +35,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2a28e8ffeef74279b8676fece8fcf613",
"model_id": "73f9921cb5b54244b714892dd6f61cce",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(button_style='info', description='Apply', style=ButtonStyle())"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "367ea22a9e254e098cea3e963db78acb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" <iframe\n",
" id=\"targetFrame\"\n",
" width=\"650\"\n",
" height=\"450\"\n",
" frameborder=\"0\"\n",
" srcdoc=\"\n",
"&lt;!DOCTYPE html&gt;\n",
"&lt;html lang=&quot;en&quot;&gt;\n",
" &lt;head&gt;\n",
" &lt;title&gt;Network&lt;/title&gt;\n",
" &lt;script\n",
" type=&quot;text/javascript&quot;\n",
" src=&quot;https://unpkg.com/vis-network/standalone/umd/vis-network.min.js&quot;\n",
" &gt;&lt;/script&gt;\n",
" &lt;style type=&quot;text/css&quot;&gt;\n",
" #mynetwork {\n",
" width: 600px;\n",
" height: 400px;\n",
" border: 1px solid lightgray;\n",
" }\n",
" &lt;/style&gt;\n",
" &lt;/head&gt;\n",
" &lt;body&gt;\n",
" &lt;div id=&quot;mynetwork&quot;&gt;&lt;/div&gt;\n",
" &lt;script type=&quot;text/javascript&quot;&gt;\n",
" \n",
" var nodes = new vis.DataSet([{ id: 0, label: `init\n",
"`, group: &quot;states&quot; },\n",
"{ id: 1, label: `rolled0\n",
"`, group: &quot;states&quot; },\n",
"{ id: 2, label: `rolled1\n",
"`, group: &quot;states&quot; },\n",
"{ id: 3, label: `rolled2\n",
"`, group: &quot;states&quot; },\n",
"{ id: 4, label: `rolled3\n",
"`, group: &quot;states&quot; },\n",
"{ id: 5, label: `rolled4\n",
"`, group: &quot;states&quot; },\n",
"{ id: 6, label: `rolled5\n",
"`, group: &quot;states&quot; },\n",
"]);\n",
" var edges = new vis.DataSet([{ from: 0, to: 1 },\n",
"{ from: 0, to: 2 },\n",
"{ from: 0, to: 3 },\n",
"{ from: 0, to: 4 },\n",
"{ from: 0, to: 5 },\n",
"{ from: 0, to: 6 },\n",
"{ from: 1, to: 1 },\n",
"{ from: 2, to: 2 },\n",
"{ from: 3, to: 3 },\n",
"{ from: 4, to: 4 },\n",
"{ from: 5, to: 5 },\n",
"{ from: 6, to: 6 },\n",
"]);\n",
" var options = {}\n",
" \n",
"var container = document.getElementById(&quot;mynetwork&quot;);\n",
"var data = {\n",
" nodes: nodes,\n",
" edges: edges,\n",
"};\n",
"var network = new vis.Network(container, data, options);\n",
" &lt;/script&gt; \n",
" &lt;/body&gt;\n",
"&lt;/html&gt;\n",
"\"\n",
" border:none !important;\n",
" allowfullscreen webkitallowfullscreen mozallowfullscreen\n",
" ></iframe>\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" id=\"targetFrame\"\n",
" width=\"650\"\n",
" height=\"450\"\n",
" frameborder=\"0\"\n",
" srcdoc=\"\n",
"&lt;!DOCTYPE html&gt;\n",
"&lt;html lang=&quot;en&quot;&gt;\n",
" &lt;head&gt;\n",
" &lt;title&gt;Network&lt;/title&gt;\n",
" &lt;script\n",
" type=&quot;text/javascript&quot;\n",
" src=&quot;https://unpkg.com/vis-network/standalone/umd/vis-network.min.js&quot;\n",
" &gt;&lt;/script&gt;\n",
" &lt;style type=&quot;text/css&quot;&gt;\n",
" #mynetwork {\n",
" width: 600px;\n",
" height: 400px;\n",
" border: 1px solid lightgray;\n",
" }\n",
" &lt;/style&gt;\n",
" &lt;/head&gt;\n",
" &lt;body&gt;\n",
" &lt;div id=&quot;mynetwork&quot;&gt;&lt;/div&gt;\n",
" &lt;script type=&quot;text/javascript&quot;&gt;\n",
" \n",
" var nodes = new vis.DataSet([{ id: 0, label: `init\n",
"`, group: &quot;states&quot; },\n",
"{ id: 1, label: `rolled0\n",
"`, group: &quot;states&quot; },\n",
"{ id: 2, label: `rolled1\n",
"`, group: &quot;states&quot; },\n",
"{ id: 3, label: `rolled2\n",
"`, group: &quot;states&quot; },\n",
"{ id: 4, label: `rolled3\n",
"`, group: &quot;states&quot; },\n",
"{ id: 5, label: `rolled4\n",
"`, group: &quot;states&quot; },\n",
"{ id: 6, label: `rolled5\n",
"`, group: &quot;states&quot; },\n",
"]);\n",
" var edges = new vis.DataSet([{ from: 0, to: 1 },\n",
"{ from: 0, to: 2 },\n",
"{ from: 0, to: 3 },\n",
"{ from: 0, to: 4 },\n",
"{ from: 0, to: 5 },\n",
"{ from: 0, to: 6 },\n",
"{ from: 1, to: 1 },\n",
"{ from: 2, to: 2 },\n",
"{ from: 3, to: 3 },\n",
"{ from: 4, to: 4 },\n",
"{ from: 5, to: 5 },\n",
"{ from: 6, to: 6 },\n",
"]);\n",
" var options = {}\n",
" \n",
"var container = document.getElementById(&quot;mynetwork&quot;);\n",
"var data = {\n",
" nodes: nodes,\n",
" edges: edges,\n",
"};\n",
"var network = new vis.Network(container, data, options);\n",
" &lt;/script&gt; \n",
" &lt;/body&gt;\n",
"&lt;/html&gt;\n",
"\"\n",
" border:none !important;\n",
" allowfullscreen webkitallowfullscreen mozallowfullscreen\n",
" ></iframe>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
"HBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<IPython.core.display.H\u2026"
]
},
"metadata": {},
Expand All @@ -262,6 +51,8 @@
"# Create a new model with the name \"Die\"\n",
"dtmc = stormvogel.model.new_dtmc(\"Die\")\n",
"\n",
"stormvogel.communication_server.server_port = 8081\n",
"\n",
"init = dtmc.get_initial_state()\n",
"\n",
"# From the initial state, add the transition to 6 new states with probability 1/6th.\n",
Expand All @@ -270,7 +61,7 @@
")\n",
"\n",
"# Show a visualization of the model.\n",
"vis = stormvogel.visualization.show(dtmc, show_editor=True, layout=DEFAULT())\n",
"vis = stormvogel.show.show(dtmc, show_editor=True, layout=DEFAULT())\n",
"# dtmc.new_state(\"test\")\n",
"# vis.update()\n",
"\n",
Expand Down Expand Up @@ -302,9 +93,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python (stormvogel)",
"language": "python",
"name": "python3"
"name": "stormvogel-env"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading

0 comments on commit 633bfb8

Please sign in to comment.