Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
e619e48622ec9db3b3f003193422fd44
mooc-rr
Commits
f3406828
Commit
f3406828
authored
Oct 21, 2024
by
e619e48622ec9db3b3f003193422fd44
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start
parent
69aa7864
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
3 deletions
+157
-3
exercice_fr.ipynb
module3/exo3/exercice_fr.ipynb
+157
-3
No files found.
module3/exo3/exercice_fr.ipynb
View file @
f3406828
{
"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": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>[1421761682.052172] 665 bytes from lig-publig....</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>[1421761682.277315] 1373 bytes from lig-publig...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>[1421761682.502054] 262 bytes from lig-publig....</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>[1421761682.729257] 1107 bytes from lig-publig...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>[1421761682.934648] 1128 bytes from lig-publig...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0\n",
"0 [1421761682.052172] 665 bytes from lig-publig....\n",
"1 [1421761682.277315] 1373 bytes from lig-publig...\n",
"2 [1421761682.502054] 262 bytes from lig-publig....\n",
"3 [1421761682.729257] 1107 bytes from lig-publig...\n",
"4 [1421761682.934648] 1128 bytes from lig-publig..."
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
...
...
@@ -16,10 +171,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.
3
"
"version": "3.6.
4
"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment