Skip to content
Snippets Groups Projects
parse_rtcm3_logs.ipynb 3.84 KiB
Newer Older
Ashwin Rao's avatar
Ashwin Rao committed
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Parse the RTCM3 Logs\n",
    "import seaborn as sns\n",
    "import pandas\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Read the files and pre process them for plotting. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Read the file\n",
    "timestamps = pandas.read_csv(\"./timestamps.csv\")\n",
    "\n",
    "# Compute the latency in ms \n",
    "timestamps[\"Latency\"] = (timestamps[\"ts_client\"]-timestamps[\"ts_relay\"])*1000\n",
    "\n",
    "# Inter-arrival time between messages. The diff is in microsec\n",
    "timestamps['relay_iat'] = timestamps['ts_relay'].diff()\n",
    "timestamps['client_iat'] = timestamps['ts_client'].diff()\n",
    "timestamps['iat_diff'] = (timestamps['relay_iat']-timestamps['client_iat'])*1000\n",
    "print(timestamps)\n",
    "\n",
    "\n",
    "ping = pandas.read_csv(\"./ping.csv\")\n",
    "print(ping)\n",
    "ping['Latency'] = ping['rtt']/2.0\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig, ax = plt.subplots(figsize=(10,5))\n",
    "sns.set_context(\"poster\"),\n",
    "sns.set_style(\"white\")\n",
    "\n",
    "sns.boxplot(data=timestamps, x=\"Location\", y=\"Latency\",hue=\"Technology\", whis=[5,95], showfliers=False)\n",
    "        \n",
    "#handles, labels = ax.get_legend_handles_labels()    \n",
    "#ax.set_xticklabels(labels=['Ethernet', 'Wi-Fi', '5G'])\n",
    "ax.set_ylim(0,50)\n",
    "ax.set_xlabel(\"Location\")\n",
    "ax.set_ylabel(\"Latency (ms)\")\n",
    "ax.grid(True, which='major', axis='y')\n",
    "plt.savefig(\"timestamps.pdf\", dpi=1200, bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Plot the one way latency between the client and the relay"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig, ax = plt.subplots(figsize=(10,5))\n",
    "sns.set_context(\"poster\"),\n",
    "sns.set_style(\"white\")\n",
    "sns.boxplot(data=ping, x=\"Location\", y=\"Latency\",hue=\"Technology\", whis=[5,95], showfliers=False)\n",
    "ax.set_xlabel(\"Location\")\n",
    "ax.set_ylabel(\"Latency (ms)\")\n",
    "ax.set_ylim(0,50)\n",
    "ax.grid(True, which='major', axis='y')\n",
    "plt.savefig(\"ping.pdf\", dpi=1200, bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Plot the difference in the inter-arrival time of the messages. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig, ax = plt.subplots(figsize=(10,5))\n",
    "sns.set_context(\"poster\"),\n",
    "sns.set_style(\"white\")\n",
    "\n",
    "sns.boxplot(data=timestamps, x=\"Location\", y=\"iat_diff\",hue=\"Technology\", whis=[5,95], showfliers=False)\n",
    "ax.set_xlabel(\"Location\")\n",
    "ax.set_ylabel(\"Inter-arrival Time \\n Difference (μs)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "5Give-venv",
   "language": "python",
   "name": "5give-venv"
  },
  "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.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}