improve nb
This commit is contained in:
parent
989f49f81b
commit
fba7e1167e
1 changed files with 17 additions and 40 deletions
|
@ -16,7 +16,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": null,
|
||||||
"id": "e2abc871-bf82-4cf6-993e-cd904c7e7468",
|
"id": "e2abc871-bf82-4cf6-993e-cd904c7e7468",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"editable": true,
|
"editable": true,
|
||||||
|
@ -29,7 +29,8 @@
|
||||||
"source": [
|
"source": [
|
||||||
"import ipywidgets as widgets\n",
|
"import ipywidgets as widgets\n",
|
||||||
"from IPython import display\n",
|
"from IPython import display\n",
|
||||||
"import os"
|
"import os\n",
|
||||||
|
"import numpy as np"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": null,
|
||||||
"id": "529de80c-dd7f-45eb-b3c1-753b33d2bdb7",
|
"id": "529de80c-dd7f-45eb-b3c1-753b33d2bdb7",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"editable": true,
|
"editable": true,
|
||||||
|
@ -51,23 +52,7 @@
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
|
||||||
"model_id": "a65109866b884b0c8bde3165b2fb39fb",
|
|
||||||
"version_major": 2,
|
|
||||||
"version_minor": 0
|
|
||||||
},
|
|
||||||
"text/plain": [
|
|
||||||
"HBox(children=(VBox(children=(Dropdown(description='Région', options=(('Ville de Genève', 'geneva'), ('Région …"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 2,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"places = {\n",
|
"places = {\n",
|
||||||
" \"geneva\": {\"shorthand\": \"geneva\", \"friendly\": \"Ville de Genève\", \"label\": \"Geneva, Switzerland\", \"cars\": 44_000, \"node\": 2809410},\n",
|
" \"geneva\": {\"shorthand\": \"geneva\", \"friendly\": \"Ville de Genève\", \"label\": \"Geneva, Switzerland\", \"cars\": 44_000, \"node\": 2809410},\n",
|
||||||
|
@ -108,7 +93,6 @@
|
||||||
" import pandas as pd\n",
|
" import pandas as pd\n",
|
||||||
" import networkx as nx\n",
|
" import networkx as nx\n",
|
||||||
" import osmnx as ox\n",
|
" import osmnx as ox\n",
|
||||||
" import numpy as np\n",
|
|
||||||
" \n",
|
" \n",
|
||||||
" place = places[w_place.value]\n",
|
" place = places[w_place.value]\n",
|
||||||
" mot = mots[w_mot.value]\n",
|
" mot = mots[w_mot.value]\n",
|
||||||
|
@ -241,7 +225,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": null,
|
||||||
"id": "f4440649-731e-421e-b43d-17576bb8ad3f",
|
"id": "f4440649-731e-421e-b43d-17576bb8ad3f",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"editable": true,
|
"editable": true,
|
||||||
|
@ -250,29 +234,22 @@
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
|
||||||
"model_id": "d7f46e8330ab475481525e195b871224",
|
|
||||||
"version_major": 2,
|
|
||||||
"version_minor": 0
|
|
||||||
},
|
|
||||||
"text/plain": [
|
|
||||||
"HBox(children=(VBox(children=(HBox(children=(IntSlider(value=1, max=10, min=1),), layout=Layout(justify_conten…"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 3,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"slider = widgets.IntSlider(min=1, max=10, step=1)\n",
|
"slider = widgets.IntSlider(\n",
|
||||||
|
" min=1,\n",
|
||||||
|
" max=10,\n",
|
||||||
|
" step=1,\n",
|
||||||
|
" readout=False,\n",
|
||||||
|
" description='0 véhic.',\n",
|
||||||
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"image = widgets.Image(format='svg+xml')\n",
|
"image = widgets.Image(format='svg+xml')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def compute(*ignore):\n",
|
"def compute(*ignore):\n",
|
||||||
|
" \n",
|
||||||
|
" shoteach = np.ceil(places[w_place.value][\"cars\"] * mots[\"car\"][\"ppv\"] / mots[w_mot.value][\"ppv\"]) / 10;\n",
|
||||||
|
" slider.description = f\"{slider.value * shoteach:.0f} véhic.\"\n",
|
||||||
" file = open(f\"./outputs/{places[w_place.value][\"shorthand\"]}/plot_{w_mot.value}_{slider.value}.svg\", \"rb\")\n",
|
" file = open(f\"./outputs/{places[w_place.value][\"shorthand\"]}/plot_{w_mot.value}_{slider.value}.svg\", \"rb\")\n",
|
||||||
" read = file.read()\n",
|
" read = file.read()\n",
|
||||||
" image.value = read\n",
|
" image.value = read\n",
|
||||||
|
|
Loading…
Reference in a new issue