#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun  5 16:40:38 2026

@author: leonhardtm
"""

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

Ha=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG8"/'HOPS_nc_3_1.csv')
Ha_data=Ha.to_numpy()
Ta=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG8"/'TWA_nc_3_1.csv')
Ta_data=Ta.to_numpy()

Hb=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG8"/'HOPS_nc_3_2.csv')
Hb_data=Hb.to_numpy()
Tb=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG8"/'TWA_nc_3_2.csv')
Tb_data=Tb.to_numpy()

Hc=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG8"/'HOPS_nc_2.csv')
Hc_data=Hc.to_numpy()
Tc=pd.read_csv(Path(__file__).resolve().parent.parent/"DATA"/"FIG8"/'TWA_nc_2.csv')
Tc_data=Tc.to_numpy()

 
plt.rcParams['figure.figsize'] = 24,5
plt.rcParams['axes.labelsize']=22
fig,axs=plt.subplots(1,3)

axs[0].tick_params(direction='out',labelsize=22)
axs[1].tick_params(direction='out',labelsize=22)
axs[2].tick_params(direction='out',labelsize=22)

axs[0].plot(Ha_data[:,0],Ha_data[:,1],label=r'$x$')
axs[0].fill_between(Ha_data[:,0],Ha_data[:,1]-2*Ha_data[:,4],Ha_data[:,1]+2*Ha_data[:,4],alpha=0.4)
axs[0].plot(Ha_data[:,0],Ha_data[:,2],label=r'$y$')
axs[0].fill_between(Ha_data[:,0],Ha_data[:,2]-2*Ha_data[:,5],Ha_data[:,2]+2*Ha_data[:,5],alpha=0.4)
axs[0].plot(Ha_data[:,0],Ha_data[:,3],label=r'$z$')
axs[0].fill_between(Ha_data[:,0],Ha_data[:,3]-2*Ha_data[:,6],Ha_data[:,3]+2*Ha_data[:,6],alpha=0.4)
axs[0].plot(Ta_data[:,0],Ta_data[:,1],'--',color='black',label='TWA')
axs[0].plot(Ta_data[:,0],Ta_data[:,2],'--',color='black')
axs[0].plot(Ta_data[:,0],Ta_data[:,3],'--',color='black')


axs[1].plot(Hb_data[:,0],Hb_data[:,1])
axs[1].fill_between(Hb_data[:,0],Hb_data[:,1]-2*Hb_data[:,4],Hb_data[:,1]+2*Hb_data[:,4],alpha=0.4)
axs[1].plot(Hb_data[:,0],Hb_data[:,2])
axs[1].fill_between(Hb_data[:,0],Hb_data[:,2]-2*Hb_data[:,5],Hb_data[:,2]+2*Hb_data[:,5],alpha=0.4)
axs[1].plot(Hb_data[:,0],Hb_data[:,3])
axs[1].fill_between(Hb_data[:,0],Hb_data[:,3]-2*Hb_data[:,6],Hb_data[:,3]+2*Hb_data[:,6],alpha=0.4)
axs[1].plot(Tb_data[:,0],Tb_data[:,1],'--',color='black')
axs[1].plot(Tb_data[:,0],Tb_data[:,2],'--',color='black')
axs[1].plot(Tb_data[:,0],Tb_data[:,3],'--',color='black')

axs[2].plot(Hc_data[:,0],Hc_data[:,1])
axs[2].fill_between(Hc_data[:,0],Hc_data[:,1]-2*Hc_data[:,4],Hc_data[:,1]+2*Hc_data[:,4],alpha=0.4)
axs[2].plot(Hc_data[:,0],Hc_data[:,2])
axs[2].fill_between(Hc_data[:,0],Hc_data[:,2]-2*Hc_data[:,5],Hc_data[:,2]+2*Hc_data[:,5],alpha=0.4)
axs[2].plot(Hc_data[:,0],Hc_data[:,3])
axs[2].fill_between(Hc_data[:,0],Hc_data[:,3]-2*Hc_data[:,6],Hc_data[:,3]+2*Hc_data[:,6],alpha=0.4)
axs[2].plot(Tc_data[:,0],Tc_data[:,1],'--',color='black')
axs[2].plot(Tc_data[:,0],Tc_data[:,2],'--',color='black')
axs[2].plot(Tc_data[:,0],Tc_data[:,3],'--',color='black')

axs[0].legend(ncols=10,title=r'Spin Component ($\beta$):',fontsize=22,title_fontsize=22,loc=8)

plt.setp(axs[0], xlabel=r'$t(\omega_C^{-1})$')
plt.setp(axs[1], xlabel=r'$t(\omega_C^{-1})$')
plt.setp(axs[2], xlabel=r'$t(\omega_C^{-1})$')
plt.setp(axs[0], ylabel=r'$\langle \hat{S}^\beta_{1,3} \rangle/N$')
plt.setp(axs[1], ylabel=r'$\langle \hat{S}^\beta_2 \rangle/N$')
plt.setp(axs[2], ylabel=r'$\langle \hat{S}^\beta_1 \rangle/N$')


