# load seaborn and other stuff for visualization import seaborn # pip install --user seaborn from matplotlib import pyplot as plt %matplotlib inline

In [ ]:
from predict import load_nc_file_as_matrices, read_benchmark_hostnames
from validate import join_dict_to_table
import netCDF4
from path import Path
from IPython.display import display
from functools import reduce, partial
from scipy.stats.mstats import gmean

In [ ]:
dir_ = Path("/home/shibbiry/Dropbox/documents/msu/clust_top/test_results/2017-04-29__25_nodes_01/")

In [ ]:
hostnames = list(read_benchmark_hostnames(dir_.joinpath("network_hosts.txt")))

In [ ]:
loaded = load_nc_file_as_matrices(hostnames, dir_.joinpath("network_median.nc"))

In [ ]:
big_plot_size = (10, 8)

In [ ]:
data = loaded[5000] * 10**6  # microseconds

In [ ]:
global_max = data.max().max()

In [ ]:
global_min = data.min().min()

In [ ]:
fig, ax = plt.subplots(figsize=big_plot_size)
seaborn.heatmap(ax=ax, data=data, vmin=global_min, vmax=global_max, square=True, annot=True)

In [ ]:
def pd_triu(df):
    """see numpy.triu"""
    return pd.DataFrame(np.triu(df), columns=df.columns, index=df.index)

In [ ]:
assert (data.columns == data.transpose().columns).all()
assert (data.index == data.transpose().index).all()
asymmetric_difference = pd_triu((data - data.transpose())).abs()

In [ ]:
fig, ax = plt.subplots(figsize=big_plot_size)
seaborn.heatmap(
    ax=ax, data=asymmetric_difference, vmin=global_min, vmax=global_max,
    square=True
)