import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sys import argv
filename1=argv[1]
#filename2=argv[2]
# Generate a sample dataset with 20 rows and 420 columns
# In practice, replace this with loading your actual dataset
data1 = np.loadtxt(filename1,usecols=(61,62,63,64,65))
#data = np.loadtxt(filename,usecols=(0,1,2,3,4))
data2 = np.loadtxt(filename1,usecols=(0,1,2,3,4))
# Compute the average across these rows
average_row1 = np.mean(data1, axis=1)
average_row2 = np.mean(data2, axis=1)
diff = np.subtract(average_row2,average_row1)
loss = np.divide(diff,average_row2)
#print(average_row)
#quit()
# Reshape the average row into a 21x20 grid
heatmap_data = loss.reshape((21, 20))
maxv=1
minv=0
# Create the heatmap using seaborn
plt.figure(figsize=(10, 8))
colpal = sns.diverging_palette(220, 20, as_cmap=True)
vcol = sns.color_palette('Spectral_r', as_cmap=True)
ax = sns.heatmap(heatmap_data,cmap=vcol,vmax=maxv,vmin=minv)
ax.invert_yaxis()
plt.show()