This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double_hist_and_scatter_plot(data_df) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def double_hist_and_scatter_plot(df): | |
# Auxilliary parameters for the plot, number of bins | |
w = 2 | |
n = math.ceil((df['optical_power'].max() - df['optical_power'].min()) / w) | |
# definitions for the axes limits and positions | |
left, width = 0.1, 0.65 | |
bottom, height = 0.1, 0.65 | |
spacing = 0.005 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data_df = pd.DataFrame([distance, np.sort(optical_power)]) | |
data_df = data_df.T | |
data_df.rename(columns={0:'distance', 1:'optical_power'}, inplace=True) | |
#data_df['avg_speed'] = data_df['throughput'].divide(data_df['client_qty']) | |
data_df |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loc = -15 | |
scale = 4 | |
size = 1200 | |
optical_power = norm.rvs(loc, scale, size, random_state=28) | |
plt.hist(np.sort(optical_power)) | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = 10 | |
loc = 4000 | |
scale = 2000 | |
size = 1200 | |
distance = skewnorm.rvs(a, loc, scale, size, random_state=28) | |
plt.hist(np.sort(distance)) | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make all the imports needed | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import norm, skewnorm | |
import math |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plt.rcParams.update({'font.size':15, 'figure.figsize': (20,8)}) | |
fig, ax = plt.subplots() | |
avg_speed = data_df['avg_speed'] | |
client_per_olt = data_df['client_qty'] | |
throughput_olt = data_df['throughput'] | |
colors = data_df['colors'] | |
scatter = ax.scatter(x=client_per_olt, y=avg_speed, c=colors.astype('category').cat.codes*100, s=avg_speed*400, alpha=0.3, cmap='prism') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classes = ('gt 6Mbps','2Mbps & 6Mbps', 'lt 2Mbps') | |
legend1 = ax.legend(handles=scatter.legend_elements()[0]*10, labels=classes, loc='upper right', title='Legend') | |
ax.add_artist(legend1) | |
ax.set_ylim(0,20) | |
plt.xlabel('Client quantity per OLT') | |
plt.ylabel('Total Thoughput per OLT (Mbps)') | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lowest_t = throughput_olt.min() | |
hypothetical_olt = 'Highest speed per client OLT' | |
annotation = ax.annotate('{}'.format(hypothetical_olt), xytext=(.15,.5), xy=(800,15), xycoords='data', textcoords='axes fraction', arrowprops=dict(arrowstyle="->", | |
connectionstyle="arc3")) | |
ax.add_artist(annotation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scatter = ax.scatter(x=client_per_olt, y=avg_speed, c=colors.astype('category').cat.codes*100, s=avg_speed*400, alpha=0.3, cmap='prism') |
NewerOlder