CPT_plotter_20211115.py 16.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536
import h5py
import matplotlib.pyplot as plt
import numpy as np
import sys
import re
import ast
from scipy.optimize import curve_fit
import os
from scipy import interpolate

#BUENAS MEDICIONES VARIANDO PARAMETROS

#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211115_CPT_DosLaseres_v04\Data

ALL_FILES = """000005717-IR_Scan_withcal_optimized
000005718-IR_Scan_withcal_optimized
000005719-IR_Scan_withcal_optimized
000005720-IR_Scan_withcal_optimized
000005721-IR_Scan_withcal_optimized
000005722-IR_Scan_withcal_optimized
000005723-IR_Scan_withcal_optimized
000005724-IR_Scan_withcal_optimized
000005725-IR_Scan_withcal_optimized
000005726-IR_Scan_withcal_optimized
000005910-IR_Scan_withcal_optimized
000005911-IR_Scan_withcal_optimized
000005912-IR_Scan_withcal_optimized
000005913-IR_Scan_withcal_optimized
""" 


def SeeKeys(files):
    for i, fname in enumerate(files.split()):
        data = h5py.File(fname+'.h5', 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
        print(fname)
        print(list(data['datasets'].keys()))

print(SeeKeys(ALL_FILES))
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211101_CPT_DosLaseres_v03\Data

Counts = []
Freqs = []

AmpTisa = []
UVCPTAmp = []
No_measures = []

for i, fname in enumerate(ALL_FILES.split()):
    print(str(i) + ' - ' + fname)
    #print(fname)
    data = h5py.File(fname+'.h5', 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'

    # Aca hago algo repugnante para poder levantar los strings que dejamos
    # que además tenian un error de tipeo al final. Esto no deberá ser necesario
    # cuando se solucione el error este del guardado.
    Freqs.append(np.array(data['datasets']['IR_Frequencies']))
    Counts.append(np.array(data['datasets']['counts_spectrum']))
    AmpTisa.append(np.array(data['datasets']['TISA_CPT_amp']))
    UVCPTAmp.append(np.array(data['datasets']['UV_CPT_amp']))
    No_measures.append(np.array(data['datasets']['no_measures']))

#%%
#VARIANDO POTENCIA TISA
#Poca estadistica, 15k mediciones

jvec = [2, 3, 4, 1, 0, 5, 6, 7, 8, 9]
Amps = [0, 0.05, 0.07, 0.1, 0.2, 0.09, 0.13, 0.12, 0.12, 0.15]


plt.figure()
i = 0
for j in jvec:
    plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'AmpTisa = {Amps[i]}', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()
#%%
jsel = [2]
plt.figure()
i = 0
for j in jvec:
    if j in jsel:
        plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'AmpTisa = {Amps[i]}', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()


#%%
#ACA ANALIZO LAS PROFUNDIDADES DE LAS RESONANCIAS OSCURAS VS LA POTENCIA DEL TISA
import seaborn as sns

sns.set_palette("tab10")

jvec = [2, 3, 4,  5, 1, 7, 8, 9, 0, 6]
Amps = [0, 0.05, 0.07, 0.09, 0.1, 0.12, 0.12, 0.15, 0.2, 0.3] #CHEQUEADO!!!
Pots = [0, 30, 70, 125, 147, 209, 209, 320, 535, 924]

Sats = [p*7.2/924 for p in Pots]

#jvec = [2, 3, 4,  5, 1, 7, 9]
#Amps = [0, 0.05, 0.07, 0.09, 0.1, 0.12, 0.15] #CHEQUEADO!!!
#Pots = [0, 30, 70, 125, 147, 209, 320]

jvec = [2, 3, 4,  5, 1, 7, 9, 0, 6]
Amps = [0, 0.05, 0.07, 0.09, 0.1, 0.12, 0.15, 0.2, 0.3] #CHEQUEADO!!!
Pots = [0, 30, 70, 125, 147, 209, 320, 535, 924]

Sats = [p*7.2/924 for p in Pots]

CountsDR1 = []
CountsDR2 = []
CountsDR3 = []
CountsDR4 = []
CountsLeft = []
CountsRight = []
CountsMax = []

for j in jvec:
    CountsDR1.append(Counts[j][46])
    CountsDR2.append(Counts[j][58])
    CountsDR3.append(Counts[j][68])
    CountsDR4.append(Counts[j][80])
    CountsLeft.append(Counts[j][0])
    CountsRight.append(Counts[j][-1])
    CountsMax.append(max(Counts[j]))
    
plt.errorbar(Sats, [CountsDR1[j] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR1), fmt='o', capsize=2, markersize=5, label=r'$m=-3/2$')
plt.errorbar(Sats, [CountsDR2[j] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR2), fmt='o', capsize=2, markersize=5, label=r'$m=-1/2$')
plt.errorbar(Sats, [CountsDR3[j] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR3), fmt='o', capsize=2, markersize=5, label=r'$m=1/2$')
plt.errorbar(Sats, [CountsDR4[j] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR4), fmt='o', capsize=2, markersize=5, label=r'$m=3/2$')
plt.xlabel('Sat Parameter TISA')
plt.ylabel('Fluorescence (a.u.)')
plt.legend()

#%%

plt.errorbar(Sats, [CountsDR1[j]/CountsDR1[0] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR1)/CountsDR1[0], fmt='o', capsize=2, markersize=5, label=r'$m=-3/2$')
plt.errorbar(Sats, [CountsDR2[j]/CountsDR2[0] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR2)/CountsDR2[0], fmt='o', capsize=2, markersize=5, label=r'$m=-1/2$')
plt.errorbar(Sats, [CountsDR3[j]/CountsDR3[0] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR3)/CountsDR3[0], fmt='o', capsize=2, markersize=5, label=r'$m=1/2$')
plt.errorbar(Sats, [CountsDR4[j]/CountsDR4[0] for j in range(len(CountsDR1))], yerr=2*np.sqrt(CountsDR4)/CountsDR4[0], fmt='o', capsize=2, markersize=5, label=r'$m=3/2$')
plt.xlabel('Sat Parameter TISA')
plt.ylabel('Fluorescence (a.u.)')
plt.legend()


#%%
plt.plot(Sats, [CountsDR1[j]/CountsDR1[0] for j in range(len(CountsDR1))], 'o', markersize=5, label=r'$m=-3/2$')
plt.plot(Sats, [CountsDR2[j]/CountsDR2[0] for j in range(len(CountsDR1))], 'o', markersize=5, label=r'$m=-1/2$')
plt.plot(Sats, [CountsDR3[j]/CountsDR3[0] for j in range(len(CountsDR1))], 'o', markersize=5, label=r'$m=1/2$')
plt.plot(Sats, [CountsDR4[j]/CountsDR4[0] for j in range(len(CountsDR1))], 'o', markersize=5, label=r'$m=3/2$')
plt.xlabel('Sat Parameter TISA')
plt.ylabel('Proportional fluorescence (a.u.)')
plt.legend()



#%%

def Lorentz(x, gamma, x0, scale, offset):
    return (scale/(np.pi*gamma))*((gamma**2)/(((x-x0)**2)+(gamma**2)))+offset

jsel = 12

i = 0
    
FreqsS = [2*f*1e-6 for f in Freqs[jsel]]
CountsS = Counts[jsel]    

Freqslong = np.arange(min(FreqsS), max(FreqsS)+FreqsS[1]-FreqsS[0], FreqsS[1]-FreqsS[0])

FreqsLorentzLimitsLow = FreqsS[0:int((1/8)*len(FreqsS))]
FreqsLorentzLimitsHigh = FreqsS[int((7/8)*len(FreqsS)):]

CountsLorentzLimitsLow = list(CountsS[0:int((1/8)*len(CountsS))])
CountsLorentzLimitsHigh = list(CountsS[int((7/8)*len(CountsS)):])

popt, pcov = curve_fit(Lorentz, FreqsLorentzLimitsLow+FreqsLorentzLimitsHigh, CountsLorentzLimitsLow+CountsLorentzLimitsHigh, p0=[60, 420, 1000, 1000])
print(popt)

plt.figure()
plt.plot(FreqsS, CountsS, 'o-', label=f'AmpTisa = {Amps[i]}', markersize=3)
plt.plot(Freqslong, Lorentz(Freqslong, *popt))
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()


#%%
#VARIANDO POTENCIA TISA en pi
#Mucha estadistica, 30k mediciones

jvec = [10, 11, 12]
Amps = [0.3, 0.07, 0]
Pots = []

Countsfixed = [6585, 6569, 6809, 6869, 6898, 6822, 6930, 7115, 7062, 6975, 6942,
       7113, 7126, 6940, 7070, 7109, 6059, 7235, 7251, 7245, 7326, 7256,
       7463, 7326, 7151, 7292, 7312, 7228, 7225, 7276, 7265, 7070, 7276,
       7045, 7103, 6938, 6802, 6702, 6559, 6281, 6006, 5808, 5583, 5254,
       4715, 4490, 4474, 4460, 4674, 5011, 5321, 5775, 6095, 6494, 6594,
       6590, 6471, 6076, 5695, 5563, 5690, 5779, 5878, 6195, 6437, 6481,
       6408, 6038, 5724, 5616, 5531, 5927, 6138, 6498, 6946, 6901, 7019,
       7051, 6770, 6308, 5941, 5660, 5342, 5502, 5780, 6171, 6364, 6787,
       7030, 7497, 7782, 8161, 8337, 8645, 8744, 8691, 9160, 9131, 9021,
       9271, 9305, 9330, 9331, 9269, 9411, 9182, 9333, 9340, 9129, 9225,
       9034, 9071, 9140, 8961, 8945, 8916, 8863, 8799, 7934, 8688, 8914]

plt.figure()
i = 0
for j in jvec:
    if j == 11:
        plt.plot([2*f*1e-6 for f in Freqs[j]], Countsfixed, 'o-', label=f'AmpTisa = {Amps[i]}', markersize=3)
    else:
        plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'AmpTisa = {Amps[i]}', markersize=3)

    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()


#%%
#VARIANDO POTENCIA TISA en sigma
#Mucha estadistica, 30k mediciones

jvec = [13, 14, 15, 16]
Amps = [0.12, 0.06, 0.03, 0.01]
Pots = []

plt.figure()
i = 0
for j in jvec:
    plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'AmpTisa = {Amps[i]}', markersize=3)

    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()


#%%
"""
FIGURA PARA EL PAPER CPT 2 LASERES, 1 REPUMP
"""


#FITEOSSSSS

#Variando la polarizacion del UV


phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0,  0
phiprobe = 0
titaprobe = 90

T = 0.6e-3

sg = 0.49
sp = 10
sr = 0
DetRepump = 0


lw = 0.1
DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth = lw, lw, lw #ancho de linea de los laseres


u = 32.5e6

B = (u/(2*np.pi))/c

correccion = 6 #con 8 fitea bien

offsetxpi = 440+1+correccion
DetDoppler = -4-correccion

FreqsDRpi_1 = [2*f*1e-6-offsetxpi+14 for f in Freqs[12]]
CountsDRpi_1 = Counts[12]

freqslongpi_1 = np.arange(min(FreqsDRpi_1), max(FreqsDRpi_1)+FreqsDRpi_1[1]-FreqsDRpi_1[0], 0.1*(FreqsDRpi_1[1]-FreqsDRpi_1[0]))


def FitEITpi(freqs, SG, SP, T):
    #temp = 4.7e-3
    MeasuredFreq, MeasuredFluo = GenerateNoisyCPT_fit(SG, sr, SP, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqs, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
    FinalFluo = [f*5.986e4 + 2.0905e3 for f in MeasuredFluo]
    return FinalFluo

popt, pcov = curve_fit(FitEITpi, FreqsDRpi_1, CountsDRpi_1, p0=[1, 10, 4e-3], bounds=(0, [2, 30, 1e-2]))

print(popt)

#scale = popt[2]
#offset = popt[3]

scale = 5.986e4
offset = 2.0905e3

FittedEITpi_1 = FitEITpi(freqslongpi_1, *popt)



plt.figure()
plt.errorbar(FreqsDRpi_1, CountsDRpi_1, yerr=2*np.sqrt(CountsDRpi_1), fmt='o', capsize=2, markersize=2)
plt.plot(freqslongpi_1, FittedEITpi_1)
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')


from scipy.signal import savgol_filter as sf
import seaborn as sns

colors=sns.color_palette("rocket", 3)
colorscomp = sns.color_palette("viridis", 10)
plt.style.use('seaborn-ticks')


winl = 9
po = 3

FiltCounts = np.array([(c-offset)*100/scale for c in sf(CountsDRpi_1, winl, po)])
ErrorCounts = np.array([1*np.sqrt(c/scale) for c in CountsDRpi_1])

plt.figure()
plt.plot(FreqsDRpi_1, FiltCounts, 'o', markersize=3, color='navy')
plt.fill_between(FreqsDRpi_1, FiltCounts+ErrorCounts, FiltCounts-ErrorCounts, color='lightblue')
plt.plot(freqslongpi_1, [(c-offset)*100/scale for c in FittedEITpi_1], label='Fitted spectrum', color='darkviolet')
plt.legend()
plt.xlim(-54, 28)
plt.xlabel('Detuning probe (MHz)')
plt.ylabel('Fluorescence (a.u.)')
plt.grid()

#%%
#Esto es un ajuste de lorenziana por las afueras de la curva y la resta con el ajuste CPT para ver la profundidad de los picos


def Lorentz(x, gamma, x0, scale, offset):
    return (scale/(np.pi*gamma))*((gamma**2)/(((x-x0)**2)+(gamma**2)))+offset

jsel = 12

i = 0
    
FreqsLorentzLimitsLow = FreqsDRpi_1[0:int((1/8)*len(FreqsDRpi_1))]
FreqsLorentzLimitsHigh = FreqsDRpi_1[int((7/8)*len(FreqsDRpi_1)):]

CountsLorentzLimitsLow = list(CountsDRpi_1[0:int((1/8)*len(CountsDRpi_1))])
CountsLorentzLimitsHigh = list(CountsDRpi_1[int((7/8)*len(CountsDRpi_1)):])

popt, pcov = curve_fit(Lorentz, FreqsLorentzLimitsLow+FreqsLorentzLimitsHigh, CountsLorentzLimitsLow+CountsLorentzLimitsHigh, p0=[-6.64722445e+1,  4, -1.69385850e6,  9.24288619e2])
print(popt)

plt.figure()
plt.errorbar(FreqsDRpi_1, CountsDRpi_1, yerr=2*np.sqrt(CountsDRpi_1), fmt='o', capsize=2, markersize=2)
plt.plot(freqslongpi_1, Lorentz(freqslongpi_1, *popt))
plt.plot(freqslongpi_1, FittedEITpi_1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()

plt.figure()
plt.plot(freqslongpi_1, np.array(Lorentz(freqslongpi_1, *popt))-np.array(FittedEITpi_1))
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()



#%%
#Ajuste con el repump prendido muy fuerte, 

phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0,  0
phiprobe = 0
titaprobe = 90

T = 0.6e-3

sg = 0.544
sp = 9.537
sr = 0
DetRepump = 0


lw = 0.1
DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth = lw, lw, lw #ancho de linea de los laseres


u = 33.5e6

B = (u/(2*np.pi))/c

correccion = 4 #con 8 fitea bien

offsetxpi = 440+1+correccion
DetDoppler = -4-correccion

FreqsDRpi_2 = [2*f*1e-6-offsetxpi+14 for f in Freqs[10]]
CountsDRpi_2 = Counts[10]

freqslongpi_2 = np.arange(min(FreqsDRpi_2), max(FreqsDRpi_2)+FreqsDRpi_2[1]-FreqsDRpi_2[0], 0.1*(FreqsDRpi_2[1]-FreqsDRpi_2[0]))


def FitEITpi(freqs, SR, DETREPUMP, scale, offset):
    temp = 2e-3
    MeasuredFreq, MeasuredFluo = GenerateNoisyCPT_fit(sg, SR, sp, gPS, gPD, DetDoppler, DETREPUMP, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, temp, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqs, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
    FinalFluo = [f*scale + offset for f in MeasuredFluo]
    return FinalFluo

popt, pcov = curve_fit(FitEITpi, FreqsDRpi_2, CountsDRpi_2, p0=[15, 71, 1e4, 1e5], bounds=((10, 50, 0, 0), (100, 300, 1e6, 1e6)))

print(popt)


Sat_2 = popt[0]
Det_2 = popt[1]

FittedEITpi_2 = FitEITpi(freqslongpi_2, *popt)

plt.figure()
plt.errorbar(FreqsDRpi_2, CountsDRpi_2, yerr=2*np.sqrt(CountsDRpi_2), fmt='o', capsize=2, markersize=2)
plt.plot(freqslongpi_2, FittedEITpi_2)
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')



#%%
#Ajuste con el repump prendido muy fuerte, 

phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0,  0
phiprobe = 0
titaprobe = 90

T = 0.6e-3

sg = 0.544
sp = 9.537
sr = 0
DetRepump = 0


lw = 0.1
DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth = lw, lw, lw #ancho de linea de los laseres


u = 33.5e6

B = (u/(2*np.pi))/c

correccion = 4 #con 8 fitea bien

offsetxpi = 440+1+correccion
DetDoppler = -4-correccion

FreqsDRpi_3 = [2*f*1e-6-offsetxpi+14 for f in Freqs[11]]
CountsDRpi_3 = Counts[11]

freqslongpi_3 = np.arange(min(FreqsDRpi_3), max(FreqsDRpi_3)+FreqsDRpi_3[1]-FreqsDRpi_3[0], 0.1*(FreqsDRpi_3[1]-FreqsDRpi_3[0]))


def FitEITpi(freqs, SR, DETREPUMP, scale, offset):
    temp = 2e-3
    MeasuredFreq, MeasuredFluo = GenerateNoisyCPT_fit(sg, SR, sp, gPS, gPD, DetDoppler, DETREPUMP, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, temp, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqs, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
    FinalFluo = [f*scale + offset for f in MeasuredFluo]
    return FinalFluo

popt, pcov = curve_fit(FitEITpi, FreqsDRpi_3, CountsDRpi_3, p0=[15, 71, 1e4, 1e5], bounds=((0, 20, 0, 0), (100, 300, 1e6, 1e6)))

print(popt)

Sat_3 = popt[0]
Det_3 = popt[1]

FittedEITpi_3 = FitEITpi(freqslongpi_3, *popt)

plt.figure()
plt.errorbar(FreqsDRpi_3, CountsDRpi_3, yerr=2*np.sqrt(CountsDRpi_3), fmt='o', capsize=2, markersize=2)
plt.plot(freqslongpi_3, FittedEITpi_3)
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')

#%%
import seaborn as sns

#sns.set_theme(style="whitegrid")
sns.set_palette("rocket")

#NormCountsDRpi_2 = [(c-popt[3])/popt[2] for c in CountsDRpi_2]
#NormCountsDRpi_3 = [(c-popt[3])/popt[2] for c in CountsDRpi_3]
#NormCountsDRpi_1 = [(c-popt[3])/popt[2] for c in CountsDRpi_1]

#NormFittedEITpi_2 = [(c-popt[3])/popt[2] for c in FittedEITpi_2]
#NormFittedEITpi_3 = [(c-popt[3])/popt[2] for c in FittedEITpi_3]
#NormFittedEITpi_1 = [(c-popt[3])/popt[2] for c in FittedEITpi_1]




NormCountsDRpi_2 = [(c-0)/popt[2] for c in CountsDRpi_2]
NormCountsDRpi_3 = [(c-0)/popt[2] for c in CountsDRpi_3]
NormCountsDRpi_1 = [(c-0)/popt[2] for c in CountsDRpi_1]

NormFittedEITpi_2 = [(c-0)/popt[2] for c in FittedEITpi_2]
NormFittedEITpi_3 = [(c-0)/popt[2] for c in FittedEITpi_3]
NormFittedEITpi_1 = [(c-0)/popt[2] for c in FittedEITpi_1]



plt.figure()
plt.plot(freqslongpi_2, NormFittedEITpi_2, zorder=2)
plt.errorbar(FreqsDRpi_2, NormCountsDRpi_2, yerr=(np.sqrt(CountsDRpi_2))/popt[2], fmt='o', capsize=2, markersize=2, label=f'Sat Rep: {round(np.sqrt(Sat_2), 1)}', zorder=1)
plt.plot(freqslongpi_3, NormFittedEITpi_3, zorder=2)
plt.errorbar(FreqsDRpi_3, NormCountsDRpi_3, yerr=(np.sqrt(CountsDRpi_3))/popt[2], fmt='o', capsize=2, markersize=2, label=f'Sat Rep: {round(np.sqrt(Sat_3), 1)}', zorder=1)
plt.plot(freqslongpi_2, NormFittedEITpi_1, zorder=2)
plt.errorbar(FreqsDRpi_2, NormCountsDRpi_1, yerr=(np.sqrt(CountsDRpi_1))/popt[2], fmt='o', capsize=2, markersize=2, label=f'Sat Rep: 0', zorder=1)
plt.legend(markerscale=3, loc='lower right')
#plt.ylim(0.018, 0.14)
plt.xlim(-55, 35)
plt.xlabel('Repump Detuning [MHz]')
plt.ylabel('Norm. Fluorescence [a.u.]')

plt.savefig('CPT_3lasers.svg')