Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
razaulmustafa852 authored Feb 3, 2022
1 parent ce0d1f0 commit 6c5c0f9
Show file tree
Hide file tree
Showing 2 changed files with 4,059 additions and 0 deletions.
174 changes: 174 additions & 0 deletions iNotebook/Interactive_Control.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"from scipy import stats\n",
"import matplotlib.pyplot as plt\n",
"from ipywidgets import *\n",
"import warnings\n",
"warnings.simplefilter(action='ignore', category=Warning)\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(\"QoS.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['Video', 'Window', 'ExpID', 'Case', 'Algo', 'timeslot sec',\n",
" 'timeslot mil', 'IAT', 'IPG Avg', 'IPG Avg GT100', 'IAT GT100',\n",
" 'Throughput', 'Total Packets', 'Total Packet GT100', '10p Length',\n",
" '20p Length', '30p Length', '40p Length', '50p Length', '60p Length',\n",
" '70p Length', '80p Length', '90p Length', '10p TP', '20p TP', '30p TP',\n",
" '40p TP', '50p TP', '60p TP', '70p TP', '80p TP', '90p TP',\n",
" 'Single EMA', 'CUSUM', 'Double EMA', 'P1203', 'P1203C', 'P1203N'],\n",
" dtype='object')"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.columns"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [],
"source": [
"exp = []\n",
"for n in range(1, 65):\n",
" exp.append(n)"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [],
"source": [
"def interactive_contol(Case, Algorithm, Target, Experiment):\n",
" \n",
" if Algorithm=='Rate Based':\n",
" CASE= df[(df['Algo']=='conventional')]\n",
" LABEL='Conventional'\n",
" elif Algorithm=='Buffer Based':\n",
" CASE= df[(df['Algo']=='bba')]\n",
" LABEL='BBA'\n",
" else:\n",
" CASE= df[(df['Algo']=='elastic')]\n",
" LABEL='Elastic'\n",
" \n",
" CASEID = CASE[( CASE['ExpID']==Experiment) & (CASE['Case']==Case)]\n",
"\n",
" plt.style.use('classic')\n",
" fig = plt.figure(figsize=(10,5))\n",
" with plt.style.context('Solarize_Light2'):\n",
" fig.set_facecolor('white')\n",
" plt.rcParams['axes.facecolor'] = 'white'\n",
" plt.plot(CASEID['timeslot sec'], CASEID[Target], label=LABEL, c='blue', mfc='red',marker='o',mec='k',markersize=12)\n",
" plt.title(LABEL, fontsize=11)\n",
" plt.xlabel('Time/s', fontsize=12, color='black')\n",
" plt.ylabel(Target, fontsize=12, color='black')\n",
" plt.legend(loc='best',frameon=False)\n",
" plt.grid(axis='y', c='#D3D3D3')\n",
" plt.grid(axis='x', c='#D3D3D3')\n",
" plt.tick_params(axis='x', colors='black')\n",
" plt.tick_params(axis='y', colors='black')\n",
" plt.show()\n",
" \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "82361099e1d94241aea4742995e83882",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Dropdown(description='Case', options=('Driving-8', 'Driving-9', 'Driving-10'), value='Dr…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<function __main__.interactive_contol(Case, Algorithm, Target, Experiment)>"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"interact(interactive_contol, Case=['Driving-8','Driving-9','Driving-10'],Algorithm=['Buffer Based','Hybrid','Rate Based'], Target=['IPG Avg', 'IPG Avg GT100', 'IAT GT100',\n",
" 'Throughput', 'Total Packets', 'Total Packet GT100', '10p Length',\n",
" '20p Length', '30p Length', '40p Length', '50p Length', '60p Length',\n",
" '70p Length', '80p Length', '90p Length', '10p TP', '20p TP', '30p TP',\n",
" '40p TP', '50p TP', '60p TP', '70p TP', '80p TP', '90p TP','IAT', \n",
" 'Single EMA', 'CUSUM', 'Double EMA', 'P1203'], Experiment=exp)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 6c5c0f9

Please sign in to comment.