"""
Script to plot .txt files generated by the Logger class.
"""

import matplotlib.pyplot as plt
from util.logger import load_data
from scipy.ndimage.filters import gaussian_filter1d

#
paths = ['/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/new_ddetr_realistic_nocontrastive',
         #'/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/new_ddetr_realistic',
         #'/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/new_ddetr_realistic_c1',
         #'/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/new_ddetr_realistic_c2',
         '/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/new_ddetr_realistic_c4']

# paths = ['/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/ddetrv2_realistic_c0',
#          '/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/ddetrv2_realistic_c0p5',
#          '/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/ddetrv2_realistic_c1',
#          '/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/ddetrv2_realistic_c4',
#          '/home/juliano/PycharmProjects/transformers-for-mot/src/results/alvis/ddetrv2_realistic_c10']

sigma = 500
res = []
for path in paths:
    temp = load_data(path, 'metrics/detr')
    temp[1] = gaussian_filter1d(temp[1], sigma=sigma)
    plt.semilogy(*temp)


plt.legend(['0', '0.5', '1', '2', '4'])
plt.axis([0.0, 800000, 0.34, 1.0])
plt.ticklabel_format(axis="x", style="sci", scilimits=(0,0))
plt.grid()
plt.show()
#plt.savefig('out.svg')
