diff --git a/notebooks/user_guide.ipynb b/notebooks/user_guide.ipynb index c2d77b5d..a004af09 100644 --- a/notebooks/user_guide.ipynb +++ b/notebooks/user_guide.ipynb @@ -2655,6 +2655,65 @@ "plt.show()" ] }, + { + "cell_type": "markdown", + "metadata": { + "jupyter": { + "outputs_hidden": false + } + }, + "source": [ + "#### Line flow\n", + "\n", + "The line flow is derived from the line speed and line density. It is used to determine the flow at a measurement line $l$. The values of individuals are weighted based on the proportion of the total length of the line $w$ to the length of the intersection between the line and the Voronoi cell $w_i(t)$.\n", + "The flow at the line is defined as:\n", + "\n", + "$$\n", + "j_\\text{line}(t) = \\sum_{{i | A_i(t) \\cap l \\neq \\emptyset}} v_i(t) \\cdot n_l \\cdot \\frac{1}{A_i(t)} \\cdot \\frac{w_i(t)}{w}\n", + "$$\n", + "\n", + "The line flow only includes the speed orthogonal to the line. Therefore, the speed of the pedestrians $v_i(t)$ is multiplied by the normal vector of the measuring line $n_l$.\n", + "\n", + "The line flow can also be used when pedestrians are approaching the line from both sides. In this case it is possible to analyze the data of both \"species\". In this example there will be only one species as the line is only approached from one side. \n", + "\n", + "For further details check out [this](fundamental_diagram_at_measurement_line) Notebook." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from pedpy import compute_line_flow\n", + "\n", + "line_flow = compute_line_flow(\n", + " individual_voronoi_polygons=individual_cutoff,\n", + " species=species,\n", + " measurement_line=measurement_line,\n", + " individual_speed=individual_speed_single_sided,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "from pedpy import plot_flow_at_line\n", + "\n", + "fig = plt.figure()\n", + "plot_flow_at_line(flow_at_line=line_flow, title=\"Flow at line\")\n", + "plt.show()" + ] + }, { "cell_type": "markdown", "metadata": { @@ -3171,65 +3230,6 @@ "plt.show()" ] }, - { - "cell_type": "markdown", - "metadata": { - "jupyter": { - "outputs_hidden": false - } - }, - "source": [ - "#### Line flow\n", - "\n", - "The line flow is derived from the line speed and line density. It can is used to determine the flow at a measurement line $l$. The values of individuals are weighted based on the proportion of the total length of the line $w$ to the length of the intersection between the line and the Voronoi cell $w_i(t)$.\n", - "The flow at the line is defined as:\n", - "\n", - "$$\n", - "j_\\text{line}(t) = \\sum_{{i | A_i(t) \\cap l \\neq \\emptyset}} v_i(t) \\cdot n_l \\cdot \\frac{1}{A_i(t)} \\cdot \\frac{w_i(t)}{w}\n", - "$$\n", - "\n", - "The line flow only includes the speed orthogonal to the line. Therefore, the speed of the pedestrians $v_i(t)$ is multiplied by the normal vector of the measuring line $n_l$.\n", - "\n", - "The line flow can also be used when pedestrians are approaching the line from both sides.In this case it is possible to analyze the data of both \"species\". In this example there will be only one species as the line is only approached from one side. \n", - "\n", - "For further details check out [this](fundamental_diagram_at_measurement_line) Notebook." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from pedpy import compute_line_flow\n", - "\n", - "line_flow = compute_line_flow(\n", - " individual_voronoi_polygons=individual_cutoff,\n", - " species=species,\n", - " measurement_line=measurement_line,\n", - " individual_speed=individual_speed_single_sided,\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [ - "hide-input" - ] - }, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "\n", - "from pedpy import plot_flow_at_line\n", - "\n", - "fig = plt.figure()\n", - "plot_flow_at_line(flow_at_line=line_flow, title=\"Flow at line\")\n", - "plt.show()" - ] - }, { "cell_type": "markdown", "metadata": {},