Commit 32f4f986 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto
Browse files

codigos

parent 282ee988
Loading
Loading
Loading
Loading
+29 −11
Changes for analisis/plots/20221006_transitoriosv2/Transitorios_02.py: 29 added lines, 11 removed lines.
Original line number Original line Diff line number Diff line
@@ -214,8 +214,9 @@ popt_vec = []
pcov_vec = []
pcov_vec = []


plt.figure()
plt.figure()
for j in range(len(SP_Heigths)):
for j in range(len(SP_Heigths)-1):
#for j in [12]:
#for j in [12]:
    print(j)
    BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths[j][0:50]),np.mean(SP_Heigths[j][-50:]),59,67,965)
    BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths[j][0:50]),np.mean(SP_Heigths[j][-50:]),59,67,965)
    
    
    #CorrectedSP_Height = [SP_Heigths[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
    #CorrectedSP_Height = [SP_Heigths[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
@@ -234,10 +235,15 @@ for j in range(len(SP_Heigths)):
    
    
#%%
#%%
plt.figure()
plt.figure()
plt.plot(UVpotVec, Taus,'o')
plt.plot(UVpotVec[:-5], Taus[:-6],'o', markersize=10, color='purple')
plt.xlabel('UV power (mW)')
#plt.errorbar(UVpotVec[:-5], Taus[:-6], yerr=1e1*np.array(ErrorTaus[:-6]), fmt='.', capsize=2, markersize=2)
plt.ylabel('Characteristic time (us)')
plt.xlabel('UV power (mW)', fontsize=15)
plt.ylabel('Characteristic time (us)', fontsize=15)
plt.ylim(-0.1,3)
plt.grid()



#%%
plt.figure()
plt.figure()
plt.plot(UVpotVec, Amps,'o')
plt.plot(UVpotVec, Amps,'o')
plt.xlabel('UV power (mW)')
plt.xlabel('UV power (mW)')
@@ -262,8 +268,8 @@ plt.rcParams.update({
    "text.usetex": False,
    "text.usetex": False,
})
})


#plt.figure()
plt.figure()
#plt.plot(Stat_Bins[0][:-1], Stat_Heigths[0])
plt.plot(Stat_Bins[0][:-1], Stat_Heigths[0])


#plot figuras papers
#plot figuras papers


@@ -309,9 +315,13 @@ pcov_vec_v2 = []


ki = 80 
ki = 80 


selectedj = [2,5,10]
t0 = -0.2

plt.figure()
plt.figure()
for j in range(len(SP_Heigths_v2)):
for j in range(len(SP_Heigths_v2)):
#for j in [1]:
#for j in [1]:
    if j in selectedj:
        #BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths_v2[j][0:50]),np.mean(SP_Heigths_v2[j][-50:]),59,67,965)
        #BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths_v2[j][0:50]),np.mean(SP_Heigths_v2[j][-50:]),59,67,965)
        
        
        #CorrectedSP_Height_v2 = [SP_Heigths_v2[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
        #CorrectedSP_Height_v2 = [SP_Heigths_v2[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
@@ -321,8 +331,8 @@ for j in range(len(SP_Heigths_v2)):
        popt, pcov = curve_fit(expo, RefBins[ki:], CorrectedSP_Height_v2[ki:], p0=(5, 1000, 100), bounds=((0, 0, 0), (50, 1e5, 1e5)))
        popt, pcov = curve_fit(expo, RefBins[ki:], CorrectedSP_Height_v2[ki:], p0=(5, 1000, 100), bounds=((0, 0, 0), (50, 1e5, 1e5)))
        popt_vec_v2.append(popt)
        popt_vec_v2.append(popt)
        pcov_vec_v2.append(pcov)
        pcov_vec_v2.append(pcov)
    plt.plot(RefBins, CorrectedSP_Height_v2)
        plt.plot([r+t0 for r in RefBins], CorrectedSP_Height_v2)
    plt.plot(RefBins[ki:], [expo(r, *popt) for r in RefBins][ki:])
        plt.plot([r+t0 for r in RefBins[ki:]], [expo(r, *popt) for r in RefBins][ki:])
        
        
        print(popt[0])
        print(popt[0])
        
        
@@ -333,6 +343,8 @@ for j in range(len(SP_Heigths_v2)):
        Offsets_v2.append(popt[2])
        Offsets_v2.append(popt[2])
        ErrorTaus_v2.append(np.sqrt(pcov)[0][0])
        ErrorTaus_v2.append(np.sqrt(pcov)[0][0])
    
    
plt.xlim(-0.2,2)

#%%
#%%


plt.figure()
plt.figure()
@@ -449,10 +461,16 @@ initi=0.10
popt_UV, pcov_UV = curve_fit(expo, BinsUVhigh[int(initi*len(BinsUVhigh)):], HeightsUVhigh[int(initi*len(BinsUVhigh)):], p0=(1, 1000, 1800, 1), bounds=((0,0,0,0),(20, 1e7, 1e5, 1e3)))
popt_UV, pcov_UV = curve_fit(expo, BinsUVhigh[int(initi*len(BinsUVhigh)):], HeightsUVhigh[int(initi*len(BinsUVhigh)):], p0=(1, 1000, 1800, 1), bounds=((0,0,0,0),(20, 1e7, 1e5, 1e3)))


plt.figure()
plt.figure()
plt.plot(BinsUVhigh, HeightsUVhigh)
plt.plot(BinsUVhigh, HeightsUVhigh,linewidth=4)
plt.plot(BinsUVhigh, [expo(r, *popt_UV) for r in BinsUVhigh])
plt.plot(BinsUVhigh[80:], [expo(r, *popt_UV) for r in BinsUVhigh][80:], color='fuchsia', linewidth=3, label='Exponential fit')
plt.plot(BinsUVhigh[int(initi*len(BinsUVhigh))], HeightsUVhigh[int(initi*len(BinsUVhigh))],'o',markersize=5)
#plt.plot(BinsUVhigh[int(initi*len(BinsUVhigh))], HeightsUVhigh[int(initi*len(BinsUVhigh))],'o',markersize=5)
#plt.ylim(-1000,20000)
#plt.ylim(-1000,20000)
plt.grid()
plt.xlabel(r'Time ($\mu$s)', fontsize=15)
plt.ylabel('Counts', fontsize=15)
plt.xlim(-0.5, 5)
plt.legend(fontsize=15)

tauUV = popt_UV[0]
tauUV = popt_UV[0]
print(tauUV)
print(tauUV)


+1080 −1456

File changed.

Preview size limit exceeded, changes collapsed.

+82 −4
Changes for analisis/plots/20230321_heatingrate/CPT_plotter_20230321.py: 82 added lines, 4 removed lines.
Original line number Original line Diff line number Diff line
@@ -12,6 +12,8 @@ from scipy import interpolate


#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20220106_CPT_DosLaseres_v08_TISA_DR\Data
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20220106_CPT_DosLaseres_v08_TISA_DR\Data


os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230321_heatingrate/Data/')

CPT_FILES = """000010420-IR_Scan_withcal_optimized
CPT_FILES = """000010420-IR_Scan_withcal_optimized
000010436-IR_Scan_withcal_optimized
000010436-IR_Scan_withcal_optimized
000010437-IR_Scan_withcal_optimized
000010437-IR_Scan_withcal_optimized
@@ -19,6 +21,12 @@ CPT_FILES = """000010420-IR_Scan_withcal_optimized
000010439-IR_Scan_withcal_optimized
000010439-IR_Scan_withcal_optimized
000010440-IR_Scan_withcal_optimized
000010440-IR_Scan_withcal_optimized
000010441-IR_Scan_withcal_optimized
000010441-IR_Scan_withcal_optimized
000010425-IR_Scan_withcal_optimized
000010426-IR_Scan_withcal_optimized
000010427-IR_Scan_withcal_optimized
000010428-IR_Scan_withcal_optimized
000010429-IR_Scan_withcal_optimized
000010430-IR_Scan_withcal_optimized
""" 
""" 


HEATING_FILES = """000010422-HeatingRate"""
HEATING_FILES = """000010422-HeatingRate"""
@@ -81,7 +89,7 @@ for i, fname in enumerate(HEATING_FILES.split()):
#%%
#%%


"""
"""
Ploteo la cpt de referencia
Ploteo la cpt de referencia / plotting the reference CPT
"""
"""


jvec = [0]
jvec = [0]
@@ -103,6 +111,7 @@ from scipy.optimize import curve_fit


"""
"""
Ajusto un cpt para obtener todos los parámetros relevantes primero.
Ajusto un cpt para obtener todos los parámetros relevantes primero.
I fit a cpt curve to retrieve all the relevant parameters first.
"""
"""


phidoppler, titadoppler = 0, 90
phidoppler, titadoppler = 0, 90
@@ -160,9 +169,10 @@ def FitEITpi(freqs, SG, SP, scale, offset, temp):
#esos valores anteriores dan mal la ordenada al origen, cambie correccion y ahora da
#esos valores anteriores dan mal la ordenada al origen, cambie correccion y ahora da
#[4.71134671e-01, 7.63142299e+00, 7.30866544e+04, 1.80899906e+02, 1.20863371e-03]
#[4.71134671e-01, 7.63142299e+00, 7.30866544e+04, 1.80899906e+02, 1.20863371e-03]


popt_fullcpt, pcov_fullcpt = curve_fit(FitEITpi, FreqsDRpi, CountsDRpi, p0=[0.5, 4.5, 1e4, 1e3, 1e-3], bounds=((0, 0, 0, 0, 0), (2, 10, 1e5, 1e5, 10e-3)))

print(f'Temperatura: ({round(1e3*popt_fullcpt[-1],2)} +- {round(1e3*np.sqrt(pcov_fullcpt[-1][-1]),2)}) mK')
print(f'Temperatura: ({round(1e3*popt_fullcpt[-1],2)} +- {round(1e3*np.sqrt(pcov_fullcpt[-1][-1]),2)}) mK')


popt_fullcpt, pcov_fullcpt = curve_fit(FitEITpi, FreqsDRpi, CountsDRpi, p0=[0.5, 4.5, 1e4, 1e3, 1e-3], bounds=((0, 0, 0, 0, 0), (2, 10, 1e5, 1e5, 10e-3)))


print(popt_fullcpt)
print(popt_fullcpt)


@@ -171,26 +181,44 @@ Det = popt_fullcpt[1]


FittedEITpi = FitEITpi(freqslongpi, *popt_fullcpt)
FittedEITpi = FitEITpi(freqslongpi, *popt_fullcpt)



#%%
"""
Ploteo la CPT de referencia junto al ajuste y a la resonancia oscura de interes
I plot the reference CPT along with the fit to the model and the dark resonance of interest
"""


i_DR = 955

plt.figure()
plt.figure()
plt.errorbar(FreqsDRpi, CountsDRpi, yerr=2*np.sqrt(CountsDRpi), fmt='o', capsize=2, markersize=2)
plt.errorbar(FreqsDRpi, CountsDRpi, yerr=2*np.sqrt(CountsDRpi), fmt='o', capsize=2, markersize=2)
plt.plot(freqslongpi, FittedEITpi)
plt.plot(freqslongpi, FittedEITpi)
plt.plot(freqslongpi[i_DR], FittedEITpi[i_DR],'o', color='red', markersize=12)
plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')

#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')





#%%
#%%
"""
"""
Simulo CPTs con todos esos parámetros para distintas temperaturas
Simulo CPTs con todos esos parámetros para distintas temperaturas
I simulate CPT curves with all the previous parameters but with varying temperatures
"""
"""
TempVecTeorico = list(np.arange(0, 31, 1))
TempVecTeorico = list(np.arange(0.3,1,0.1))+list(np.arange(1, 31, 1))
CurvasTeoricas = []
CurvasTeoricas = []


for tempi in TempVecTeorico:
for tempi in TempVecTeorico:
    CurvasTeoricas.append(FitEITpi(freqslongpi, *popt_fullcpt[:-1], tempi*1e-3))
    CurvasTeoricas.append(FitEITpi(freqslongpi, *popt_fullcpt[:-1], tempi*1e-3))





#%%
#%%
"""
"""
Acá agarro la primera y busco el valor i_DR que corresponde a la resonancia oscura de interés
Acá agarro la primera y busco el valor i_DR que corresponde a la resonancia oscura de interés
With the first one, I look for the value i_DR which corresponds to the dark resonance of interest
"""
"""
curva_ref = CurvasTeoricas[0]
curva_ref = CurvasTeoricas[0]


@@ -201,12 +229,33 @@ plt.figure()
plt.plot(freqslongpi, curva_ref)
plt.plot(freqslongpi, curva_ref)
plt.plot(freqslongpi[i_DR], curva_ref[i_DR],'o')
plt.plot(freqslongpi[i_DR], curva_ref[i_DR],'o')


#%%
"""
ploteo algunos CPTs teoricos para algunas temperaturas
Plotting some theory cpt curves for some temperatures
"""

plt.plot(freqslongpi, CurvasTeoricas[0])
plt.plot(freqslongpi[i_DR], CurvasTeoricas[0][i_DR],'o',markersize=10)
plt.plot(freqslongpi, CurvasTeoricas[10])
plt.plot(freqslongpi[i_DR], CurvasTeoricas[10][i_DR],'o',markersize=10)
plt.plot(freqslongpi, CurvasTeoricas[20])
plt.plot(freqslongpi[i_DR], CurvasTeoricas[20][i_DR],'o',markersize=10)
plt.xlabel('Detuning (MHz)')
plt.ylabel('Fluorescence')
plt.grid()




#%%
#%%
"""
"""
Ahora interpolo los valores teóricos de las profundidades de esas resonancias
Ahora interpolo los valores teóricos de las profundidades de esas resonancias
y aplico la interpolación a las mediciones para obtener temperaturas.
y aplico la interpolación a las mediciones para obtener temperaturas.
Luego, grafico las temperaturas en función de los tiempos de calentamiento.
Luego, grafico las temperaturas en función de los tiempos de calentamiento.

Now I interpolate the theoretical values of the depths of those resonances
and apply the interpolation to the measurements to obtain temperatures.
After that, I plot the temperatures with respect to the heating times
"""
"""
from scipy.interpolate import interp1d
from scipy.interpolate import interp1d


@@ -235,7 +284,7 @@ plt.ylabel('Temperatura (mK)')


plt.figure()
plt.figure()
#plt.plot(Heating_med, Heating_tim, 'o', color='blue')
#plt.plot(Heating_med, Heating_tim, 'o', color='blue')
plt.errorbar(Heating_tim, Heating_med, yerr=ErrorHeating_med, fmt='o', capsize=2, markersize=2)
plt.errorbar([t*1e3 for t in Heating_tim], Heating_med, yerr=ErrorHeating_med, fmt='o', capsize=2, markersize=5)


plt.ylabel('Cuentas de DR medidas')
plt.ylabel('Cuentas de DR medidas')
plt.xlabel('Heating time (s)')
plt.xlabel('Heating time (s)')
@@ -250,6 +299,7 @@ p1,p2 = curve_fit(lineal, Heating_tim_ms, Temperaturas_interpoladas)
#%%
#%%
"""
"""
Grafico finalmente el plot del heating rate de la trampa
Grafico finalmente el plot del heating rate de la trampa
Finally I plot the heating rate of the trap
"""
"""




@@ -271,6 +321,7 @@ print(f'Heating rate: ({round(p1[0],2)} +- {round(np.sqrt(p2[0][0]),2)}) mK/ms')
#%%
#%%
"""
"""
Ahora voy a ver CPT enteras con tiempos de calentamiento distintos.
Ahora voy a ver CPT enteras con tiempos de calentamiento distintos.
Now I see whole CPT curves with different heating times
"""
"""


jvec = [3, 4]
jvec = [3, 4]
@@ -306,10 +357,14 @@ plt.ylim(1000,2900)
plt.grid()
plt.grid()
plt.legend()
plt.legend()


#%%


"""
"""
La siguiente curva probablemente no este bien medida ya que inmediatamente
La siguiente curva probablemente no este bien medida ya que inmediatamente
despues, los laseres se deslockearon. La dejo por las dudas.
despues, los laseres se deslockearon. La dejo por las dudas.

This curve is probably not well measured...

"""
"""


jvec = [5, 6]
jvec = [5, 6]
@@ -330,4 +385,27 @@ plt.legend()
plt.title('Ojo: medicion condicionada por derivas')
plt.title('Ojo: medicion condicionada por derivas')




#%%
"""
Ahora ploteo 6 curvas cpt para distintos valores de potencia del UV

This is a plot of 6 different cpt curves for 6 different UV powers. I should fit them
to obtain saturation parameters
"""


jvec = [7,8,9,10,11,12]

plt.figure()
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', capsize=2, markersize=2, label='Without heating')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
#plt.ylim(1000,2900)
plt.grid()
#plt.legend()




+22.5 KiB

File added.

No diff preview for this file type.

Loading