#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun  6 10:17:29 2026

@author: leonhardtm
"""

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pathlib import Path

X=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG10"/'HOPS_MPS_convergence.csv')
X_data=X.to_numpy()


cmap = plt.colormaps['Blues'] 
C=np.array([0.4,0.6,0.8,1])
colors = cmap(C)
 
plt.rcParams['figure.figsize'] = 5,6
plt.rcParams['axes.labelsize']=16
fig,axs=plt.subplots(1)

axs.tick_params(direction='out',labelsize=16)
axs.semilogy(X_data[:,0],X_data[:,1],label=r'$\chi=10$',color=colors[0],linewidth=1.5)
axs.semilogy(X_data[:,0],X_data[:,2],label=r'$\chi=14$',color=colors[1],linewidth=1.5)
axs.semilogy(X_data[:,0],X_data[:,3],label=r'$\chi=18$',color=colors[2],linewidth=1.5)
axs.semilogy(X_data[:,0],X_data[:,4],label=r'$\chi=22$',color=colors[3],linewidth=1.5)
axs.semilogy(X_data[:,0],X_data[:,5],':',color='black',linewidth=1.5)
axs.set_ylim([10**(-5),1])

axs.legend(ncols=1,fontsize=16,loc=2)
plt.setp(axs, xlabel=r'$t(\omega_C^{-1})$')
plt.setp(axs, ylabel=r'$|\langle\hat{{S}}_1\rangle-\langle\hat{{S}}_{1,\mathrm{ref}}\rangle|/|\langle\hat{{S}}_{1,\mathrm{ref}}\rangle|$')
