Skip to content
Snippets Groups Projects
Commit f9e0c8d2 authored by Ashwin Rao's avatar Ashwin Rao
Browse files

For avoiding type3 fonts

parent 15774237
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# Parse the RTCM3 Logs # Parse the RTCM3 Logs
import seaborn as sns import seaborn as sns
import pandas import pandas
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy
# to avoid type 3 fonts.
plt.rc('pdf',fonttype = 42)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Read the files and pre process them for plotting. # Read the files and pre process them for plotting.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# Read the file # Read the file
timestamps = pandas.read_csv("./timestamps.csv") timestamps = pandas.read_csv("./timestamps.csv")
# Compute the latency in ms # Compute the latency in ms
timestamps["Latency"] = (timestamps["ts_client"]-timestamps["ts_relay"])*1000 timestamps["Latency"] = (timestamps["ts_client"]-timestamps["ts_relay"])*1000
# Inter-arrival time between messages. The diff is in microsec # Remember the diff is still in seconds.
timestamps['relay_iat'] = timestamps['ts_relay'].diff() timestamps['relay_iat'] = timestamps['ts_relay'].diff()
timestamps['relay_iat'] = timestamps['relay_iat'].apply(lambda x : x if x > 0 else numpy.nan) # Dirty hack for jumps between experiments.
timestamps['relay_iat'] = timestamps['relay_iat'].apply(lambda x : x if x < 100 else numpy.nan) # Dirty hack for jumps between experiments.
timestamps['client_iat'] = timestamps['ts_client'].diff() timestamps['client_iat'] = timestamps['ts_client'].diff()
timestamps['iat_diff'] = (timestamps['relay_iat']-timestamps['client_iat'])*1000 timestamps['client_iat'] = timestamps['client_iat'].apply(lambda x : x if x > 0 else numpy.nan) # Dirty hack for jumps between experiments.
print(timestamps) timestamps['client_iat'] = timestamps['client_iat'].apply(lambda x : x if x < 100 else numpy.nan) # Dirty hack for jumps between experiments.
# Inter-arrival time between messages. The diff is in millisec.
timestamps['iat_diff'] = abs(timestamps['relay_iat']-timestamps['client_iat'])*1000
print(timestamps["iat_diff"])
ping = pandas.read_csv("./ping.csv") ping = pandas.read_csv("./ping.csv")
print(ping) #print(ping)
ping['Latency'] = ping['rtt']/2.0 ping['Latency'] = ping['rtt']/2.0
print(timestamps[timestamps["Latency"] == max(timestamps["Latency"])])
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
fig, ax = plt.subplots(figsize=(10,5)) fig, ax = plt.subplots(figsize=(17.5,5))
sns.set_context("poster"), sns.set_context("poster")
sns.set_style("white") sns.set_style("white")
sns.color_palette("husl", 8)
sns.boxplot(data=timestamps, x="Location", y="Latency",hue="Technology", whis=[5,95], showfliers=False) #plot_data = timestamps[timestamps["Technology"].isin(["Ethernet", "Wi-Fi(PE)", "Wi-Fi(PE)", "5G(BE)", "5G(BD)"]) ]
plot_data = timestamps
#handles, labels = ax.get_legend_handles_labels() sns.boxplot(data=plot_data, x="Location", y="Latency",hue="Technology", whis=[5,95], showfliers=False)
#ax.set_xticklabels(labels=['Ethernet', 'Wi-Fi', '5G'])
ax.set_ylim(0,50) handles, labels = ax.get_legend_handles_labels()
ax.set_xlabel("Location") ax.set_yticklabels(labels=['0.1', '1', '10', '100'])
ax.set_ylabel("Latency (ms)") ax.set_ylim(0.1,300)
ax.set_xlabel("Location", weight="bold")
ax.set_ylabel("Latency (ms)", weight="bold")
handles, labels = ax.get_legend_handles_labels()
ax.legend(ncol=5, title="Technology", bbox_to_anchor=(-0.02, 1.35), loc="upper left")
ax.set_yscale("log")
ax.grid(True, which='major', axis='y') ax.grid(True, which='major', axis='y')
ax.grid(True, which='minor', axis='y')
plt.savefig("timestamps.pdf", dpi=1200, bbox_inches='tight') plt.savefig("timestamps.pdf", dpi=1200, bbox_inches='tight')
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Plot the one way latency between the client and the relay # Plot the one way latency between the client and the relay
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
fig, ax = plt.subplots(figsize=(17.5,5))
sns.set_context("poster"),
sns.set_style("white")
sns.set_palette("colorblind")
sns.boxplot(data=ping, x="Location", y="Latency",hue="Technology", whis=[5,95], showfliers=False)
ax.set_ylim(0.1,300)
ax.set_xlabel("Location", weight="bold")
ax.set_ylabel("Latency (ms)", weight="bold")
ax.legend(ncol=5, title="Technology", bbox_to_anchor=(-0.02, 1.35), loc="upper left")
ax.set_yscale("log")
ax.grid(True, which='major', axis='y')
ax.grid(True, which='minor', axis='y')
plt.savefig("ping.pdf", dpi=1200, bbox_inches='tight')
``` ```
%% Cell type:markdown id: tags:
# Plot the difference in the inter-arrival time of the messages.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
fig, ax = plt.subplots(figsize=(10,5)) fig, ax = plt.subplots(figsize=(17.5,5))
sns.set_context("poster"), sns.set_context("poster"),
sns.set_style("white") sns.set_style("white")
sns.boxplot(data=ping, x="Location", y="Latency",hue="Technology", whis=[5,95], showfliers=False) sns.set_palette("colorblind")
ax.set_xlabel("Location")
ax.set_ylabel("Latency (ms)")
ax.set_ylim(0,50) sns.boxplot(data=timestamps, x="Location", y="iat_diff",hue="Technology", whis=[5,95], showfliers=False)
ax.set_ylim(0.01,300)
ax.set_xlabel("Location", weight="bold")
ax.set_ylabel("Inter-arrival Time \n Difference (ms)", weight="bold")
#ax.set_yscale("log")
ax.legend(ncol=5, title="Technology", bbox_to_anchor=(-0.02, 1.35), loc="upper left")
ax.set_yscale("log")
ax.grid(True, which='major', axis='y') ax.grid(True, which='major', axis='y')
plt.savefig("ping.pdf", dpi=1200, bbox_inches='tight') ax.grid(True, which='minor', axis='y')
plt.savefig("iat.pdf", dpi=1200, bbox_inches='tight')
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Plot the difference in the inter-arrival time of the messages. # Plot the CDF of the IAT
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
fig, ax = plt.subplots(figsize=(10,5)) fig, ax = plt.subplots(figsize=(15,5))
sns.set_context("poster"), sns.set_context("poster"),
sns.set_style("white") sns.set_style("white")
sns.set_palette("colorblind")
sns.boxplot(data=timestamps, x="Location", y="iat_diff",hue="Technology", whis=[5,95], showfliers=False)
ax.set_xlabel("Location") def ecdf(x):
ax.set_ylabel("Inter-arrival Time \n Difference (μs)") xs = numpy.sort(x)
ys = numpy.arange(1, len(xs)+1)/float(len(xs))
return xs, ys
plot_data = timestamps[timestamps["relay_iat"].notnull()]
#plot_data = plot_data[plot_data["relay_iat"]>0]
x = plot_data["relay_iat"]*1000 # Convert to ms.
xs, ys = ecdf(x)
plt.plot(xs,ys)
ax.set_xscale("log")
ax.grid(True, which='major')
ax.grid(True, which='minor')
ax.set_ylabel("ECDF", weight="bold")
ax.set_xlabel("Inter Arrival Time (ms)", weight="bold")
plt.savefig("ecdfiat.pdf", dpi=1200, bbox_inches='tight')
```
%% Cell type:code id: tags:
``` python
for font in plt.rcParams['font.sans-serif']:
print(font)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment