diff --git a/module3/exo3/exercice_fr.ipynb b/module3/exo3/exercice_fr.ipynb index 0bbbe371b01e359e381e43239412d77bf53fb1fb..adb63c9f6e2e5725e3e7b879ff994dcea316e9cb 100644 --- a/module3/exo3/exercice_fr.ipynb +++ b/module3/exo3/exercice_fr.ipynb @@ -1,5 +1,160 @@ { - "cells": [], + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import re" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "log_file_path = 'https://polaris.imag.fr/arnaud.legrand/teaching/2014/RICM4_EP_ping/liglab2.log.gz'" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "data = pd.read_csv(log_file_path, delimiter='\\t', header=None)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def extract_info(row):\n", + " timestamp = re.search(r'\\[(.*?)\\]', row).group(1)\n", + " message_size = re.search(r'(\\d+) bytes', row).group(1)\n", + " return float(timestamp), int(message_size)\n", + "\n", + "\n", + "data[['timestamp', 'message_size']] = data[0].apply(extract_info).apply(pd.Series)\n", + "\n", + "data.head()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plt.figure(figsize=(10, 6))\n", + "plt.plot(data['timestamp'], data['message_size'], label='Message Size over Time')\n", + "plt.xlabel('Time (s)')\n", + "plt.ylabel('Message Size (bytes)')\n", + "plt.title('Evolution of Transmission Size Over Time')\n", + "plt.grid(True)\n", + "plt.legend()\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
| \n", + " | 0 | \n", + "
|---|---|
| 0 | \n", + "[1421761682.052172] 665 bytes from lig-publig.... | \n", + "
| 1 | \n", + "[1421761682.277315] 1373 bytes from lig-publig... | \n", + "
| 2 | \n", + "[1421761682.502054] 262 bytes from lig-publig.... | \n", + "
| 3 | \n", + "[1421761682.729257] 1107 bytes from lig-publig... | \n", + "
| 4 | \n", + "[1421761682.934648] 1128 bytes from lig-publig... | \n", + "