Commit ee19408c authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto
parents 52faf1af 38606496
......@@ -25,7 +25,7 @@ Calib_Files_IR = """000007808-IR_Saturation
000007830-IR_Saturation
000007831-IR_Saturation"""
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20220527_CPTvariandoB_barriendopotenciaIR/Data')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20220527_CPTvariandoB_barriendopotenciaIR/Data')
#carpeta pc nico labo escritorio:
#/home/nico/Documents/artiq_experiments/analisis/plots/20220527_CPTvariandoB_barriendopotenciaIR/Data
......@@ -265,12 +265,21 @@ if plotFreqFreq == True:
else:
#plt.errorbar([b*1e3 for b in Bvec], MaxsPotsExp/propor, xerr=1e3*MeanError/(2*np.pi)/c, yerr=yerr0/propor, color=colores[0], fmt="o", markersize=4, zorder=3, elinewidth=1)
plt.errorbar([f*1e-6 for f in ConvertBfieldtoLarmor(np.array([b*1e0 for b in Bvec]))], [c*1e-12/((2*np.pi)**2) for c in ConvertToRabiSq(np.array(MaxsPotsExp)/propor, 2*np.pi*1.35e6)], xerr=1e-6*MeanError, yerr=(1e-12/((2*np.pi)**2))*ConvertToRabiSq(yerr0, 2*np.pi*1.35e6)/propor, color=colores[0], fmt="o", markersize=4, zorder=3, elinewidth=1)
plt.plot([f*1e-9 for f in ConvertBfieldtoLarmor(CamposVector2)], [r*1e-12/((2*np.pi)**2) for r in ConvertToRabiSq(RabiVector2,2*np.pi*1.35e6)], linestyle='dashed', linewidth=1., color='grey') #esto viene del threeLevel_2repumps_CPTPlotter.py de Figura CPT Teorica
plt.errorbar([(4/5)*f*1e-6 for f in ConvertBfieldtoLarmor(np.array([b*1e0 for b in Bvec]))], [c*1e-12/((2*np.pi)**2) for c in ConvertToRabiSq(np.array(MaxsPotsExp)/propor, 2*np.pi*1.35e6)], xerr=(4/5)*1e-6*MeanError, yerr=(1e-12/((2*np.pi)**2))*ConvertToRabiSq(yerr0, 2*np.pi*1.35e6)/propor, color=colores[0], fmt="o", markersize=4, zorder=3, elinewidth=1)
plt.plot([(4/5)*f*1e-9 for f in ConvertBfieldtoLarmor(CamposVector2)], [r*1e-12/((2*np.pi)**2) for r in ConvertToRabiSq(RabiVector2,2*np.pi*1.35e6)], linestyle='dashed', linewidth=1., color='grey') #esto viene del threeLevel_2repumps_CPTPlotter.py de Figura CPT Teorica
#plt.ylabel(r'Rabi Frequency Squared (MHz$^2$)', fontsize=12, fontname='STIXGeneral')
#plt.plot([f*1e-9 for f in ConvertBfieldtoLarmor(CamposVector2)], [15*(r*1e-12/((2*np.pi)**2))/popt for r in ConvertToRabiSq(RabiVector2,2*np.pi*1.35e6)], linestyle='dashed', linewidth=1., color='grey') #esto viene del threeLevel_2repumps_CPTPlotter.py de Figura CPT Teorica #esto seria con pendiente 15 que seria lo que da la teoria con el factor de lande correspondiente
plt.ylabel(r'$\Omega_{\mathrm{DP}}^2$ (MHz$^2$)', fontsize=12, fontname='STIXGeneral')
popt, pcov = curve_fit(LinearFitPotvsB, [(4/5)*f*1e-9 for f in ConvertBfieldtoLarmor(CamposVector2)], [r*1e-12/((2*np.pi)**2) for r in ConvertToRabiSq(RabiVector2,2*np.pi*1.35e6)])
poptexp,pcovexp = curve_fit(LinearFitPotvsB, [(4/5)*f*1e-6 for f in ConvertBfieldtoLarmor(np.array([b*1e0 for b in Bvec]))], [c*1e-12/((2*np.pi)**2) for c in ConvertToRabiSq(np.array(MaxsPotsExp)/propor, 2*np.pi*1.35e6)])
print(popt)
print(poptexp)
# plt.plot([f*1e-6 for f in ConvertBfieldtoLarmor(np.array([b*1e3 for b in Bvec]))], MaxsPotsExp,"o", color=colores[0], markersize=4, zorder=3)
# plt.ylim(0,80)
# plt.xlim(0,270)
......@@ -278,17 +287,21 @@ else:
plt.xlabel('Larmor Frequency (MHz)', fontsize=12, fontname='STIXGeneral')
plt.xlabel(r'$\delta/2\pi $ (MHz)', fontsize=12, fontname='STIXGeneral')
plt.xlim(0,0.27)
plt.xticks([0, 0.05, 0.1, 0.15, 0.2, 0.25], fontsize=12,fontname='STIXGeneral')
plt.xlim(0,(4/5)*0.27)
plt.xticks([0, 0.05, 0.1, 0.15, 0.2], fontsize=12,fontname='STIXGeneral')
plt.yticks([0, 1, 2, 3, 4], fontsize=12,fontname='STIXGeneral')
plt.ylim(0,4.1)
plt.grid()
plt.tight_layout()
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Work/2022 B vs k race/Figuras/Figuras jpg trabajadas/umbralvsB_exp.png',dpi=500)
<<<<<<< HEAD
plt.savefig('C:/Users/nicon/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/Fig2b_v3.pdf')
=======
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/Fig2b_v2.pdf')
>>>>>>> 9bb069aa4136dbc31f68a3cd69a81195df2f5649
......@@ -297,6 +310,9 @@ plt.tight_layout()
Figura 2a) del paper. Curvas de fluorescencia vs potencia del IR
'''
'''
Este es el modelo viejo que ajusta super lindo, lo dejo por las dudas
'''
from scipy.signal import savgol_filter as sf
......@@ -383,6 +399,66 @@ plt.yticks([0,1,2,3], fontsize=12, fontname='STIXGeneral')
plt.ylim(0,3.7)
#plt.xlim(0,2.3)
plt.tight_layout()
<<<<<<< HEAD
#plt.legend(loc='upper left', frameon=True, fontsize=7.6, handletextpad=0.1)
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/Fig2a_v2.pdf')
#%%
'''
Figura 2a) del paper. Curvas de fluorescencia vs potencia del IR
'''
'''
Este es el modelo NUEVO de ceci, veremos que onda
'''
from scipy.signal import savgol_filter as sf
# FluoSel = IR_fluorescence_vec[0][1:]
# PotsSel = PotenciasIR[1:]
# popt, pcov = curve_fit(FuncTest, PotsSel, FluoSel,p0=(1000,500,0,100,0))
def find_nearest(array, value):
array = np.asarray(array)
idx = (np.abs(array - value)).argmin()
return idx
from scipy.signal import savgol_filter as sf
import seaborn as sns
plt.style.use('seaborn-ticks')
colors=sns.color_palette("rocket", 10)
colorsselected=[colors[0],colors[3],colors[5],colors[8]]
FluovsBshort = []
#jselected = [0, 1, 4, 8]
jselected = [8, 2, 1, 0]
Bcampos = [b*1e3 for b in Bvec]
Bfields = [Bcampos[6], Bcampos[2], Bcampos[1], Bcampos[0]]
for j in jselected:
FluovsBshort.append(IR_fluorescence_vec[j])
#bkgr2 = np.min([FluovsBshort[0][1],FluovsBshort[1][1],FluovsBshort[2][1],FluovsBshort[3][1]])
#bkgrposta = np.min()
PotenciasMaximos_parcial = MaxsPotsExp/propor
PotenciasMaximos = [PotenciasMaximos_parcial[6],PotenciasMaximos_parcial[2],PotenciasMaximos_parcial[1],PotenciasMaximos_parcial[0]]
def FuncTest(rsq, A, det, delta, gs, gd):
c=1
gt = gs + gd
return A*((gd/gt)*((gt*gt+4*det*det+(8/3)*delta*delta)/(c*rsq))+1.5*c*rsq/(delta*delta) + 4*gs/gt)**(-1)
=======
plt.legend(loc='upper left', frameon=True, fontsize=7.6, handletextpad=0.1)
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/Fig2a_v2.pdf')
......@@ -439,6 +515,7 @@ def FuncTest(rsq, A, det, delta, g):
return A*(((0.25*g*g+det*det+(2/3)*delta*delta)/(c*rsq))+6*c*rsq/(delta*delta))**(-1)
>>>>>>> 9bb069aa4136dbc31f68a3cd69a81195df2f5649
smoothen_order = [3,3,3,1]
err = [2,1,1,1]
orden=5
......@@ -446,6 +523,18 @@ plt.figure(figsize=(3.5, 3))
for j in range(len(jselected)):
print(j)
rawcuentas = [f-bkgr for f in FluovsBshort[j]]
<<<<<<< HEAD
#cuentas = np.array(rawcuentas[0:3]+list(sf(rawcuentas[3:],7,3))) #este va bien
cuentas = np.array(rawcuentas[0:3]+list(sf(rawcuentas[3:],13,smoothen_order[j]))) #este va bien
#maximumfluo_index = np.array(cuentas[1:-1]).argmax()
maximumfluo_index = find_nearest(PotenciasIR[1:-1]/propor, PotenciasMaximos[j])
popt, pcov = curve_fit(FuncTest, PotenciasIR[1:-1]/propor, cuentas[1:-1]/1000, p0=(1e5,1.5,1e-2,2*np.pi*21,2*np.pi*1), bounds=((2e2,0,0,2*np.pi*20.5,2*np.pi*1),(2e7,10,1e8,2*np.pi*21.5,2*np.pi*1.1)))
#print(popt)
print(popt[1])
print(popt[2]/(2*np.pi))
=======
if j==0:
print('tukson')
......@@ -462,6 +551,7 @@ for j in range(len(jselected)):
popt, pcov = curve_fit(FuncTest, PotenciasIR[1:-1]/propor, cuentas[1:-1]/1000, p0=(1e5,1.5,1e-2,3.5e2), bounds=((7e4,1.49,0,3.5e2),(2e5,1.51,1e6,3.501e2)))
print(popt)
>>>>>>> 9bb069aa4136dbc31f68a3cd69a81195df2f5649
#[r*1e-12 for r in ConvertToRabiSq( ,2*np.pi*1.35e6)]
#PotsLong = np.arange(0*np.min(PotenciasIR[1:-1]/propor), np.max(PotenciasIR[1:-1]/propor),0.01)
PotsLong = np.arange(0*np.min(PotenciasIR[1:-1]/propor), np.max(PotenciasIR[1:-1]/propor),0.01)
......@@ -471,6 +561,12 @@ for j in range(len(jselected)):
plt.vlines(x=((2*np.pi*1.35e6)**2)*(1e-12/(propor*(((2*np.pi)**2))))*PotenciasIR[1:-1][maximumfluo_index],ymin=0.2,ymax=cuentas[1:-1][maximumfluo_index]/1000,color=colorsselected[j],zorder=1,linewidth=1, linestyle='dotted')
plt.fill_between([(r/((2*np.pi)**2))*1e-12 for r in ConvertToRabiSq(PotenciasIR[1:-1]/propor,2*np.pi*1.35e6)], (cuentas[1:-1]-1*np.sqrt(cuentas)[1:-1])/1000, (cuentas[1:-1]+1*np.sqrt(cuentas)[1:-1])/1000, color=colorsselected[j], alpha=0.3, zorder=orden)
orden=orden-1
<<<<<<< HEAD
#plt.errorbar(PotenciasIR, cuentas, yerr=1*np.sqrt(cuentas), color='r', fmt='o', capsize=2, markersize=4)
#plt.xlim(0, 90)
#plt.ylim(-100,3500)
=======
#plt.xlim(0,2)
#plt.errorbar(PotenciasIR, cuentas, yerr=1*np.sqrt(cuentas), color='r', fmt='o', capsize=2, markersize=4)
#plt.xlim(0, 90)
......@@ -612,7 +708,25 @@ plt.tight_layout()
plt.legend(loc='upper left', frameon=True, fontsize=7.6, handletextpad=0.1)
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/allcurves.pdf')
>>>>>>> 9bb069aa4136dbc31f68a3cd69a81195df2f5649
#for pot in MaxsPotsExp/propor:
# plt.axvline(pot)
plt.grid()
plt.xlabel(r'$\Omega_{\mathrm{DP}}^2$ (MHz$^2$)', fontsize=12, fontname='STIXGeneral')
#plt.xlabel(r'$\Gamma$', fontsize=12, fontname='STIXGeneral')
plt.ylabel('Fluorescence (kcounts/s)', fontsize=12, fontname='STIXGeneral')
plt.xticks([0, 1, 2, 3, 4], fontsize=12, fontname='STIXGeneral')
plt.yticks([0,1,2,3], fontsize=12, fontname='STIXGeneral')
plt.ylim(0,3.7)
#plt.xlim(0,2.3)
plt.tight_layout()
#plt.legend(loc='upper left', frameon=True, fontsize=7.6, handletextpad=0.1)
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/Fig2a_v3.pdf')
plt.savefig('C:/Users/nicon/Nextcloud/G_liaf/Publicaciones/Papers/2022 B vs K eigenbasis/Figuras_finales/Finalesfinales/Fig2a_v3.pdf')
......
......@@ -260,6 +260,57 @@ plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')
plt.grid()
#%%
"""
Ahora repito el fit pero con un super ajuste
"""
FreqsDR = Freqs[10]
CountsDR = Counts[10]
def FitEIT_MM_SA(Freqs, offset, DetDoppler, SG, SP, SCALE1, SCALE2, OFFSET, BETA1, BETA2, TEMP, U, plot=False):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#BETA = 1.8
# SG = 0.6
# SP = 8.1
# TEMP = 0.2e-3
freqs = [2*f*1e-6-offset for f in Freqs]
Detunings, Fluorescence1 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, U, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA1, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
Detunings, Fluorescence2 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, U, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA2, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
ScaledFluo1 = np.array([f*SCALE1 + OFFSET for f in Fluorescence1])
ScaledFluo2 = np.array([f*SCALE2 + OFFSET for f in Fluorescence2])
if plot:
return ScaledFluo1+ScaledFluo2, Detunings
else:
return ScaledFluo1+ScaledFluo2
#return ScaledFluo1
popt_SA, pcov_SA = curve_fit(FitEIT_MM_SA, FreqsDR, CountsDR, p0=[425, -13, 0.9, 7.5, 4e3, 5e3, 2500, 3.8, 0.8, 0.2e-3, 32e6], bounds=((0, -50, 0, 0, 0, 0, 1500, 0,0, 0, 28e6), (1000, 0, 2, 20, 5e6, 5e6, 6000, 10, 10,20e-3,40e6)))
FittedEITpi_short_SA, Detunings_short_SA = FitEIT_MM_SA(FreqsDR, *popt_SA, plot=True)
freqslong = np.arange(1*min(FreqsDR), 1*max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
FittedEITpi_long_SA, Detunings_long_SA = FitEIT_MM_SA(freqslong, *popt_SA, plot=True)
plt.figure()
plt.errorbar(Detunings_short_SA, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='darkgreen', alpha=0.5, capsize=2, markersize=2)
plt.plot(Detunings_long_SA, FittedEITpi_long_SA, color='darkolivegreen', linewidth=3)
plt.title('2 ion model')
plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')
plt.xlim(-100,100)
#plt.legend(loc='upper left', fontsize=20)
plt.grid()
#%%
"""
Vemos la contribucion de cada ion
......
......@@ -105,7 +105,7 @@ plt.xlim(-0.1, 5)
#%%
laser_UV_amp=0.1
allamps = np.array([])
allpows = np.array([])
alltaus = np.array([])
......
......@@ -7,7 +7,7 @@ import ast
from scipy.optimize import curve_fit
import os
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221006_transitoriosv2')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221006_transitoriosv2')
# Solo levanto algunos experimentos
SP_files = [8445, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 84840, 88040]
SP_files_v2 = [8763, 8764, 8765, 8766, 8767, 8768, 8769, 8770, 8771, 8772, 8773, 8774, 8775, 8776]
......@@ -19,6 +19,7 @@ Calib_files = ['Cal_DP_5M', 'Cal_SP_5M', 'Cal_DP_25M', 'Cal_SP_25M']
Random_files = [8749]
def expo(T, tau, N0, C):
global T0
return N0*np.exp(-(T-T0)/tau) + C
......@@ -184,7 +185,8 @@ from scipy.optimize import curve_fit
RefBins = [t*1e6 for t in SP_Bins[0][:-1]]
plt.figure()
for Height in SP_Heigths:
for Height in SP_Heigths[:-1]:
print(len(Height))
plt.plot(RefBins, Height)
plt.xlim(-0.2, 3)
......@@ -234,6 +236,10 @@ for j in range(len(SP_Heigths)-1):
ErrorTaus.append(np.sqrt(pcov)[0][0])
#%%
"""
TESIS
"""
plt.figure()
plt.plot(UVpotVec[:-5], Taus[:-6],'o', markersize=10, color='purple')
#plt.errorbar(UVpotVec[:-5], Taus[:-6], yerr=1e1*np.array(ErrorTaus[:-6]), fmt='.', capsize=2, markersize=2)
......@@ -245,12 +251,12 @@ plt.grid()
#%%
plt.figure()
plt.plot(UVpotVec, Amps,'o')
plt.plot(UVpotVec, Amps[:-1],'o')
plt.xlabel('UV power (mW)')
plt.ylabel('Characteristic time (us)')
plt.figure()
plt.plot(UVpotVec, Offsets,'o')
plt.plot(UVpotVec, Offsets[:-1],'o')
#%%
......@@ -361,6 +367,10 @@ plt.figure()
plt.plot(UVpotVec, Offsets_v2,'o')
#%%
"""
TESIS
"""
"""
FIGURA PAPER
"""
......@@ -409,7 +419,7 @@ plt.savefig('fig3_01.pdf')
plt.savefig('fig3_01.svg')
#%%
#%%
"""
VEMOS UNA DP CON POTENCIA ALTA A VER SI DA LO QUE TIENE QUE DAR EL ANCHO DE LINEA
......
......@@ -10,7 +10,7 @@ import scipy.stats as sts
import seaborn as sns
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221017_IonStatistics')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221017_IonStatistics')
plt.rcParams.update({
"font.family": "STIXGeneral"
......@@ -79,6 +79,10 @@ for i, fname in enumerate(Stat_files[3:6]):
#%%
"""
TESIS
"""
import matplotlib
import seaborn as sns
......@@ -113,26 +117,32 @@ bins3 = np.arange(30,100,1)
FIGURA ESTADISTICA POISSON
"""
plt.figure(figsize = (3.8,2.8))
plt.hist(Stat_Heigths[0], bins=bins1, histtype='step',density = True,color = color1, alpha = 0.6)#,label = 'BG')
plt.hist(Stat_Heigths[1], bins=bins2, histtype='step',density = True,color = color2, alpha = 0.6)#,label = 'UV laser')
plt.hist(Stat_Heigths[2], bins=bins3, histtype='step',density = True,color = color3, alpha = 0.6)#,label = 'Ion')
fig,ax=plt.subplots(1,2,gridspec_kw={'width_ratios': [1, 1]},figsize=(6.5,3.))
#plt.figure(figsize = (9,3.5))
ax[1].hist(Stat_Heigths[0], bins=bins1, histtype='step',density = True,color = color1,linewidth=2, alpha = 0.6)#,label = 'BG')
ax[1].hist(Stat_Heigths[1], bins=bins2, histtype='step',density = True,color = color2,linewidth=2, alpha = 0.6)#,label = 'UV laser')
ax[1].hist(Stat_Heigths[2], bins=bins3, histtype='step',density = True,color = color3,linewidth=2, alpha = 0.6)#,label = 'Ion')
poisson1= sts.poisson.pmf(bins1,np.mean(Stat_Heigths[0]))
poisson2= sts.poisson.pmf(bins2,np.mean(Stat_Heigths[1]))
poisson3= sts.poisson.pmf(bins3,np.mean(Stat_Heigths[2]))
plt.plot(bins2+0.5,poisson2,color = color2,label = 'Background')
plt.plot(bins3+0.5,poisson3,color = color3,label = 'UV laser')
plt.plot(bins1+0.5,poisson1,color = color1,label = 'Ion')
plt.legend(loc=(0.15,0.65), prop={'size': 11})
plt.grid()
plt.tight_layout()
plt.xticks([0, 100, 200, 300], fontname='STIXGeneral')
plt.yticks([0,0.02, 0.04, 0.06, 0.08], fontname='STIXGeneral')
plt.xlabel('Counts', fontname='STIXGeneral')
plt.ylabel('Event frequency', fontname='STIXGeneral')
ax[1].plot(bins2+0.5,poisson2,color = color2,label = 'Señal de fondo',linewidth=1.5)
ax[1].plot(bins3+0.5,poisson3,color = color3,label = 'Láser UV',linewidth=1.5)
ax[1].plot(bins1+0.5,poisson1,color = color1,label = 'Ion',linewidth=1.5)
ax[1].legend(loc='upper right', prop={'size': 10})
ax[1].grid()
ax[1].set_xticks([0, 100, 200, 300])
ax[1].set_xticklabels([0, 100, 200, 300], fontsize=10,fontname='STIXGeneral')
ax[1].set_yticks([0,0.02, 0.04, 0.06, 0.08])
ax[1].set_yticklabels([0,0.02, 0.04, 0.06, 0.08], fontsize=10,fontname='STIXGeneral')
ax[1].set_xlabel('Cuentas', fontsize=10, fontname='STIXGeneral')
ax[1].set_ylabel('Frecuencia de eventos', fontsize=10, fontname='STIXGeneral')
#plt.savefig('C:/Users/nicon/Nextcloud/Nico/Doctorado/Tesis/Tesis_doctorado/Chapters/figures/Cap5_poisson.pdf')
#poissoneidad = np.var(Stat_Heigths)/np.mean(Stat_Heigths)
#plt.title('Varianza/media = {:.4f}'.format(poissoneidad))
......@@ -140,39 +150,29 @@ plt.ylabel('Event frequency', fontname='STIXGeneral')
name='fig01a'
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.svg')
#%%
import matplotlib
matplotlib.rcParams['mathtext.fontset'] = 'stix'
matplotlib.rcParams['font.family'] = 'STIXGeneral'
plt.style.use('seaborn-bright')
plt.rcParams.update({
"text.usetex": False,
})
"""
FIGURA BACKGROUND, ENCENDIDO AOM Y ENCENDIDO ION
"""
plt.figure(figsize=(4.5,3))
plt.plot([s*1e6 for s in OnOff_Bins[1][:-1]],OnOff_Heights[1], color=color2)
plt.plot([s*1e6 for s in OnOff_Bins[0][:-1]],[(OnOff_Heights[0][j]-OnOff_Heights[1][j])*3.13+OnOff_Heights[1][j] for j in range(len(OnOff_Heights[0]))], color=color3)
plt.plot([s*1e6 for s in OnOff_Bins[2][:-1]],OnOff_Heights[2], color=color1)
plt.xlim(0,1)
plt.grid()
plt.xlabel(r'Time ($\mu$s)', fontname='STIXGeneral')
plt.ylabel(r'Counts /10$~\mu$s', fontname='STIXGeneral')
plt.xticks([0,0.2, 0.4, 0.6, 0.8, 1], fontname='STIXGeneral')
plt.yticks([0,5000, 10000], fontname='STIXGeneral')
#plt.figure(figsize=(4.5,3))
ax[0].plot([s*1e6 for s in OnOff_Bins[1][:-1]],OnOff_Heights[1], color=color2,linewidth=3)
ax[0].plot([s*1e6 for s in OnOff_Bins[0][:-1]],[(OnOff_Heights[0][j]-OnOff_Heights[1][j])*3.13+OnOff_Heights[1][j] for j in range(len(OnOff_Heights[0]))], color=color3,linewidth=3)
ax[0].plot([s*1e6 for s in OnOff_Bins[2][:-1]],OnOff_Heights[2], color=color1,linewidth=3)
ax[0].set_xlim(0,1)
ax[0].grid()
ax[0].set_xlabel(r'Tiempo ($\mu$s)', fontname='STIXGeneral', fontsize=10)
ax[0].set_ylabel(r'Cuentas /10$~\mu$s', fontname='STIXGeneral', fontsize=10)
ax[0].set_xticks([0,0.2, 0.4, 0.6, 0.8, 1])
ax[0].set_yticks([0,5000, 10000])
ax[0].set_xticklabels([0,0.2, 0.4, 0.6, 0.8, 1], fontname='STIXGeneral', fontsize=10)
ax[0].set_yticklabels([0,5000, 10000], fontname='STIXGeneral', fontsize=10)
plt.tight_layout()
name='fig01b'
plt.savefig('C:/Users/nicon/Nextcloud/Nico/Doctorado/Tesis/Tesis_doctorado/Chapters/figures/Cap5_statistics.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'_dump.svg')
......
......@@ -23,15 +23,15 @@ for det in detuning_lines:
for cambio in [0]: # esto es para shiftear la potencia medida
potencias = dataREAL.Pow - cambio
for rad in [85.7]: # esto evalua con distintos radios
ax2.errorbar([p/(np.pi*(rad**2)) for p in UVpotVec], Taus, yerr=np.mean(1e6*errsSIM.stdval.values),
ax2.errorbar([p/(np.pi*(rad**2)) for p in UVpotVec], Taus[:-1], yerr=np.mean(1e6*errsSIM.stdval.values),
fmt='.--', ms=6, lw=.5, \
color="#3949ab",
capsize=3)
ax2.errorbar([p/(np.pi*(rad**2)) for p in UVpotVec], Taus_v2, yerr=np.mean(1e6*errsSIM.stdval.values),
fmt='.--', ms=6, lw=.5, \
color="#3949ab",
capsize=3)
# ax2.errorbar([p/(np.pi*(rad**2)) for p in UVpotVec], Taus_v2[:-1], yerr=np.mean(1e6*errsSIM.stdval.values),
# fmt='.--', ms=6, lw=.5, \
# color="#3949ab",
# capsize=3)
# ax2.errorbar(potencias/(np.pi*(rad**2)), dataREAL.Tau*1e6, \
......
......@@ -7,7 +7,7 @@ import ast
from scipy.optimize import curve_fit
import os
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221024_BranchingFractionMeasurement')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221024_BranchingFractionMeasurement')
Long_files = ['DP_long', 'SP_long']
Calib_files = ['Fondo_IR_50M', 'Fondo_UV_50M']
......@@ -183,6 +183,10 @@ plt.plot(Long_Bins[1][:-1], SP_corrected)
plt.plot(Long_Bins[0][:-1], DP_corrected)
#%%
"""
TESIS
"""
"""
Figura branching
"""
......@@ -212,24 +216,24 @@ bins2 = np.arange(0,50,1)
bins3 = np.arange(30,100,1)
plt.figure(figsize = (3.8,3))
plt.figure(figsize = (4.5,3.5))
plt.plot([1e6*b-0.18 for b in Long_Bins[1][:-1]], SP_corrected, color=(0,0,128/255, 1),linewidth=2.5,label='SP transition')
plt.plot([1e6*b+0.09 for b in Long_Bins[0][:-1]], DP_corrected, color=(212/255,0,0, 1),linewidth=2.5,label='DP transition')
plt.plot([1e6*b-0.18 for b in Long_Bins[1][:-1]], SP_corrected, color=(0,0,128/255, 1),linewidth=2.5,label='Transición SP')
plt.plot([1e6*b+0.09 for b in Long_Bins[0][:-1]], DP_corrected, color=(212/255,0,0, 1),linewidth=2.5,label='Transición DP')
#plt.hist(Stat_Heigths[0], bins=bins1, histtype='step',density = True,color = color1, alpha = 0.6)#,label = 'BG')
#plt.hist(Stat_Heigths[1], bins=bins2, histtype='step',density = True,color = color2, alpha = 0.6)#,label = 'UV laser')
#plt.hist(Stat_Heigths[2], bins=bins3, histtype='step',density = True,color = color3, alpha = 0.6)#,label = 'Ion')
#plt.legend(loc=(0.15,0.65), prop={'size': 11})
plt.legend()
plt.legend(loc='upper right', prop={'family':'STIXgeneral','size': 10})
#plt.legend()
plt.grid()
plt.tight_layout()
plt.xlim(-0.3, 2)
plt.xticks([0, 1, 2], fontname='STIXGeneral')
plt.yticks([0,5000, 10000, 15000], fontname='STIXGeneral')
plt.xlabel('Time (us)', fontname='STIXGeneral')
plt.ylabel('Counts', fontname='STIXGeneral')
plt.xticks([0, 0.5, 1, 1.5, 2],fontsize=10, fontname='STIXGeneral')
plt.yticks([0,5000, 10000, 15000],fontsize=10, fontname='STIXGeneral')
plt.xlabel(r'Tiempo ($\mu$s)', fontsize=10,fontname='STIXGeneral')
plt.ylabel('Cuentas', fontsize=10, fontname='STIXGeneral')
#poissoneidad = np.var(Stat_Heigths)/np.mean(Stat_Heigths)
#plt.title('Varianza/media = {:.4f}'.format(poissoneidad))
......@@ -237,8 +241,10 @@ plt.ylabel('Counts', fontname='STIXGeneral')
name='fig02a'
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.pdf')
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.svg')
plt.savefig('C:/Users/nicon/Nextcloud/Nico/Doctorado/Tesis/Tesis_doctorado/Chapters/figures/Cap5_SP_DP.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.svg')
#%%
......
......@@ -7,7 +7,7 @@ import ast
from scipy.optimize import curve_fit
import os
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230523_transitorioshighpower/')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230523_transitorioshighpower/')
# Solo levanto algunos experimentos
SP_files = [12221, 12222, 12223, 12224]
......
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 12:24:54 2023
@author: nicon
"""
import numpy as np
import matplotlib.pyplot as plt
def RDE(r,l,v):
return 2*l*v/r
def OAM(r,w,amp):
width=2/(amp*np.sqrt(2*np.pi))
return amp*np.exp(-((r-w)**2)/(2*width**2))
r=np.arange(0,3,0.001)
w1 = 1
amp1 = 2*np.pi/w1
w2 = 1.5
amp2=2*np.pi/w2
plt.figure()
plt.plot(r,1*OAM(r,w1,amp1))
plt.plot(r,1*OAM(r,w2,amp2))
#%%
plt.figure()
plt.plot(r,OAM(r,w1,amp1)/RDE(r,2,2))
plt.plot(r,OAM(r,w2,amp2)/RDE(r,2,2))
#%%
plt.figure()
plt.plot(r/w1,(OAM(r,w1,amp1)/RDE(r,2,2)))
plt.plot(r/w2,(OAM(r,w2,amp2)/RDE(r,2,2)))
#%%
from math import factorial as fac
def LGbeam(r,l,w,P):
E = np.sqrt(4*P/(w**2))
return E*np.sqrt(2/(np.pi*(fac(np.abs(l)))))*(1/1)*(((np.sqrt(2)*r)/(w))**np.abs(l))*np.exp(-((r**2)/(w**2)))
def RDE(r,l,v,w):
#return 2*l*v*(1/r)
return 2*l*v*(r**2.21) #con una exponencial se chotea
#return 2*l*v
r = np.arange(0.01,200,0.01)
w1 = 40
w2 = 80
P = 1e50
l=2
vel = 1e1
# plt.figure()
# plt.plot(r,(LGbeam(r,l,w1,P))**2)
# plt.plot(r,(LGbeam(r,l,w2,P))**2)
# plt.title('Intensity of two LG beams with different waists')
# plt.figure()
# plt.plot(r,((LGbeam(r,l,w1,P))**2)/RDE(r,l,vel,w1))
# plt.plot(r,((LGbeam(r,l,w2,P))**2)/RDE(r,l,vel,w2))
# plt.title('Ratio between the LG intensity and the RDE term')
LG1 = (((LGbeam(r,l,w1,P))**2)/RDE(r,l,vel,w1))
LG2 = (((LGbeam(r,l,w2,P))**2)/RDE(r,l,vel,w2))
fact = (np.max(LG1)/np.max(LG2))
plt.figure()
plt.plot(r/w1,LG1)
plt.plot(r/w2,LG2*fact)
plt.title('Scaled ratio between LG and RDE, x axis scaled with LG waist')
#%%
def ShiftFull(r,l,vz,vr,vphi,w,wl,z):
k = 2*np.pi/wl
zr = 0.5*k*w*w
deltaz = (k + (k*r*r/(2*(z*z +zr*zr))*((2*z*z)/(z*z + zr*zr) - 1) - (l+1)*zr/(z*z+zr*zr)))*vz
deltar = (k*r*z/(z*z+zr*zr))*vr
deltaphi = (l/r)*vphi
return deltaz+deltar+deltaphi
r = np.arange(0.0001,200,0.01)
w1 = 40
w2 = 60
wl = 0.866
z=1
P = 1e15
l=2
velz = 1e10*0
velr = 1e10*0
velphi = 1e10
# plt.figure()
# plt.plot(r,(LGbeam(r,2,w1,1))**2)
# plt.plot(r,(LGbeam(r,2,w2,1))**2)
# plt.title('Intensity of two LG beams with different waists')
# plt.figure()
# plt.plot(r,((LGbeam(r,2,w1,1))**2)/RDE(r,2,2))
# plt.plot(r,((LGbeam(r,2,w2,1))**2)/RDE(r,2,2))
# plt.title('Ratio between the LG intensity and the RDE term')
LG1 = (((LGbeam(r,l,w1,P))**2)/ShiftFull(r,2,velz,velr,velphi,w1,wl,z))
LG2 = (((LGbeam(r,l,w2,P))**2)/ShiftFull(r,2,velz,velr,velphi,w2,wl,z))
fact = (np.max(LG1)/np.max(LG2))
plt.figure()
plt.plot(r/w1,LG1)
plt.plot(r/w2,LG2*fact)
plt.title('Scaled ratio between LG and RDE, x axis scaled with LG waist')
......@@ -18,6 +18,16 @@ from scipy.optimize import curve_fit
import random
from scipy.signal import savgol_filter as sf
from scipy.stats import norm
def prob_energia(E,T):
kboltz = 1.380649e-23
mcalcio = 6.655e-23*1e-3
prob = np.exp(-E/(kboltz*T)) #*E**2
return prob
def PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe, betag, betap, drivefreq, freqMin, freqMax, freqStep, circularityprobe=1, plot=False, solvemode=1, detpvec=None, dephasing = False, boltzmann = False):
"""
......@@ -37,8 +47,9 @@ def PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinew
velvec = np.linspace(-4*sigmaT,4*sigmaT,100)
MBprobVec = norm.pdf(velvec,loc = 0, scale = sigmaT)
MBprobVec = MBprobVec/np.trapz(MBprobVec,velvec)
for i in range(len(velvec)):
detVel = (detpvec - kp*velvec[i])/(2*np.pi*1e6)
detVel = detpvec - kp*velvec[i]/(2*np.pi*1e6)
_, Fluorescence = CPTspectrum8levels( sg, sp, gPS, gPD, DetDoppler-kg*velvec[i]/(2*np.pi*1e6),u, DopplerLaserLinewidth, ProbeLaserLinewidth, 0,alpha, phidoppler, titadoppler, phiprobe, titaprobe,circularityprobe, betag, betap, drivefreq, freqMin=freqMin, freqMax=freqMax, freqStep=freqStep, plot=False,detpvec=detVel)
FluorescencesVel.append(Fluorescence)
......@@ -54,21 +65,29 @@ def PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinew
else:
drivefreq =2*np.pi* 1e3
drivefreq =2*np.pi* 0.6e6
FluorescencesVel = []
sigmaT = np.sqrt(T*kboltz/m)
velvec = np.linspace(-4*sigmaT,4*sigmaT,100)
MBprobVec = norm.pdf(velvec,loc = 0, scale = sigmaT)
Evec = np.linspace(0,8*kboltz*T,100)
velvec = np.zeros(2*len(Evec))
velvec= np.sqrt(2 * Evec/m)
MBprobVec = prob_energia(Evec, T)
MBprobVec = MBprobVec/np.trapz(MBprobVec,Evec)
betagVec = velvec*kg/drivefreq
betapVec = velvec*kp/drivefreq
for i in range(len(betagVec)):
betag,betap = betagVec[i],betapVec[i]
Frequencies, Fluorescence = CPTspectrum8levels( sg, sp, gPS, gPD, DetDoppler,u, DopplerLaserLinewidth, ProbeLaserLinewidth, 0,alpha, phidoppler, titadoppler, phiprobe, titaprobe,circularityprobe, betag, betap, drivefreq, freqMin=freqMin, freqMax=freqMax, freqStep=freqStep, plot=False,detpvec=None)
Frequencies, Fluorescence = CPTspectrum8levels( sg, sp, gPS, gPD, DetDoppler,u, DopplerLaserLinewidth, ProbeLaserLinewidth, 0,alpha, phidoppler, titadoppler, phiprobe, titaprobe,circularityprobe, betag, betap, drivefreq, freqMin=freqMin, freqMax=freqMax, freqStep=freqStep, plot=False,detpvec=detpvec)
FluorescencesVel.append(Fluorescence)
FluorescencesVel = np.array(FluorescencesVel)
MBprobMat = np.tile(MBprobVec,(FluorescencesVel.shape[1],1)).T
Fluorescence = np.trapz(FluorescencesVel*MBprobMat,velvec,axis = 0)
Fluorescence = np.trapz(FluorescencesVel*MBprobMat,Evec,axis = 0)
ProbeDetuningVectorL = Frequencies
#print('Done, Total time: ', round((tfinal-tinicial), 2), "s")
......@@ -106,15 +125,25 @@ def SmoothNoisyCPT(Fluo, window=11, poly=3):
def fitCPT_8levels(Freq,Fluo,sg,sp,gPS,gPD,DetDoppler,u,DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe,beta, drivefreq, freqMin, freqMax, freqStep, circularityprobe=1, plot=False,dephasing = False, boltzmann = False ):
def SpectrumForFit(Freq,sg,sp,T,DetDoppler):
freq,spectra = PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe, beta, drivefreq, freqMin, freqMax, freqStep, circularityprobe=1, plot=False, solvemode=1, detpvec=Freq)
return spectra
def fitCPT_8levels(Freq,Fluo,sg,sp,gPS,gPD,DetDoppler,u,DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe,betag,betar, drivefreq, freqMin, freqMax, freqStep, circularityprobe=1, plot=False,dephasing = False, boltzmann = False ):
def SpectrumForFit(Freq,sg,sp,T,DetDoppler,A,bgnd,f0):
Freq = Freq - f0
freq,spectra = PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe, betag,betar, drivefreq, freqMin, freqMax, freqStep,circularityprobe=1, plot=False, detpvec=Freq, dephasing = dephasing, boltzmann = boltzmann)
return spectra*A + bgnd
popt,pcov = curve_fit(SpectrumForFit,Freq,Fluo,p0 = [sg,sp,T,DetDoppler],bounds = ([0.01,0.01,0.00001,-50e6],[1,20,1,30e6]))
popt,pcov = curve_fit(SpectrumForFit,Freq,Fluo,p0 = [sg,sp,T,DetDoppler,20000,800,432],bounds = ([0.1,1,0.5e-3,-30,10000,0,420],[0.8,10,10e-3,0,100000,1000,500]))
fitted_spectra = SpectrumForFit(Freq,*popt)
return Freq, fitted_spectra,popt,pcov
def try_fitCPT_8levels(A,bgnd,f0,Freq,Fluo,sg,sp,gPS,gPD,DetDoppler,u,DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe,betag,betar, drivefreq, freqMin, freqMax, freqStep, circularityprobe=1, plot=False,dephasing = False, boltzmann = False ):
def SpectrumForFit(Freq,sg,sp,T,DetDoppler,A,bgnd,f0):
Freq = Freq - f0
freq,spectra = PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe, betag,betar, drivefreq, freqMin, freqMax, freqStep,circularityprobe=1, plot=False, detpvec=Freq, dephasing = dephasing, boltzmann = boltzmann)
return spectra*A + bgnd
return SpectrumForFit(Freq, sg, sp, T, DetDoppler, A, bgnd, f0)
\ No newline at end of file
......@@ -250,7 +250,7 @@ def dopplerBroadening(wlg, wlp, alpha, T, mcalcio = 6.655e-23*1e-3):
kboltzmann = 1.38e-23 #J/K
gammaD = (2*np.pi)*np.sqrt((1/(wlg*wlg)) + (1/(wlp*wlp)) - 2*(1/(wlg*wlp))*np.cos(alpha))*np.sqrt(kboltzmann*T/(2*mcalcio))
gammaD = (2*np.pi)*np.sqrt((1/(wlg*wlg)) + (1/(wlp*wlp)) - 2*(1/(wlg*wlp))*np.cos(alpha))*np.sqrt(kboltzmann*T/(mcalcio))
return gammaD
......@@ -264,10 +264,16 @@ def FullL(rabG, rabP, gPS = 0, gPD = 0, Detg = 0, Detp = 0, u = 0, lwg = 0, lwp
"""
kg = 397e9
kp = 866e9
fg = kg**2/(kg**2+kp**2)
fp = kp**2/(kg**2+kp**2)
db = dopplerBroadening(0.397e-6, 0.866e-6, alpha, T)
lwg = np.sqrt(lwg**2 + (db/2)**2)/2
lwp = np.sqrt(lwp**2 + (db/2)**2)/2
lwg = np.sqrt(lwg**2 + (fg*db)**2)
lwp = np.sqrt(lwp**2 + (fp*db)**2)
......@@ -306,15 +312,18 @@ def FullL(rabG, rabP, gPS = 0, gPD = 0, Detg = 0, Detp = 0, u = 0, lwg = 0, lwp
M = CalculateSingleMmatrix(gPS, gPD, lwg, lwp)
L0 = np.array(np.matrix(Lfullpartial) + M)
#ESTA PARTE ES CUANDO AGREGAS MICROMOCION
nmax = 7
#print(nmax)
Ltemp, Omega = LtempCalculus(betag,betap, drivefreq)
#print(factor)
L1 = GetL1(Ltemp, L0, Omega, nmax)
Lfull = L0 + L1 #ESA CORRECCION ESTA EN L1
#HASTA ACA
if betag !=0 and betap !=0:
#ESTA PARTE ES CUANDO AGREGAS MICROMOCION
nmax = 2*int(betag)
#print(nmax)
Ltemp, Omega = LtempCalculus(betag,betap, drivefreq)
#print(factor)
L1 = GetL1(Ltemp, L0, Omega, nmax)
Lfull = L0 + L1 #ESA CORRECCION ESTA EN L1
#HASTA ACA
else:
Lfull = L0
#NORMALIZACION DE RHO
i = 0
while i < 64:
......@@ -422,6 +431,9 @@ def CPTspectrum8levels(sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phidopp
else:
DetProbeVector = detpvec*1e6 * 2*np.pi
Detg = 2*np.pi*Detg*1e6
#lwg, lwr, lwp = 2*np.pi*lwg*1e6, 2*np.pi*lwr*1e6, 2*np.pi*lwp*1e6
......@@ -463,7 +475,7 @@ def CPTspectrum8levels(sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phidopp
plt.plot(DetProbeVectorMHz, [100*f for f in Fluovector], label=str(titaprobe) + 'º, T: ' + str(Temp*1e3) + ' mK')
plt.legend()
return DetProbeVectorMHz, Fluovector
return DetProbeVectorMHz, np.array(Fluovector)
def CPTspectrum8levels_vel(velvect,titavec,phivec,probvel,sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phidoppler, titadoppler, phiprobe, titaprobe, Circularityprobe, beta, drivefreq, freqMin=-100, freqMax=100, freqStep=1e-1, plot=False, solvemode=1):
......@@ -613,7 +625,7 @@ def CPTspectrum8levels_vel(velvect,titavec,phivec,probvel,sg, sp, gPS, gPD, Detg
plt.plot(DetProbeVectorMHz, [100*f for f in Fluovector], label=str(titaprobe) + 'º, T: ' + str(Temp*1e3) + ' mK')
plt.legend()
return DetProbeVectorMHz, Fluovector
return DetProbeVectorMHz, np.array(Fluovector)
if __name__ == "__main__":
......
......@@ -413,14 +413,16 @@ for selectedcurve in selectedcurvevec:
return ScaledFluo1+ScaledFluo2
#return ScaledFluo1
def FitEIT_MM_1ion(Freqs, offset, DetDoppler, SG, SP, SCALE1, OFFSET, BETA1, TEMP, plot=False):
def FitEIT_MM_1ion(Freqs, offset1, offset2, DetDoppler, SG, SP, SCALE1, OFFSET, BETA1, TEMP, plot=False):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#BETA = 1.8
# SG = 0.6
# SP = 8.1
# TEMP = 0.2e-3
freqs = [2*f*1e-6-offset for f in Freqs]
freqs = [2*f*1e-6-offset1 for f in Freqs]
Detunings, Fluorescence1 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA1, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
#Detunings, Fluorescence2 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA2, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
......
This diff is collapsed.
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
"""
CPT con tres laseres pero lso dos IR son el mismo entonces las DD son mas finas
"""
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211223_CPT_DosLaseres_v07_ChristmasSpecial\Data
ALL_FILES = """000016420-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']['IR1_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']))
#%%
#Barriendo angulo del IR con tisa apagado
jvec = [0]
jselected = jvec
plt.figure()
i = 0
for j in jvec:
if j in jselected:
plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', capsize=2, markersize=2)
#plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'Amp Tisa: {AmpTisa[i]}', mb arkersize=3)
i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
plt.legend()
#%%
from scipy.optimize import curve_fit
import time
phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0, 90
phiprobe = 0
titaprobe = 0.1
Temp = 0.5e-3
sg = 0.544
sp = 4.5
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
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6
alpha = 0
drivefreq = 2*np.pi*22.135*1e6
noiseamplitude = 0
selectedcurve=0
FreqsDR = Freqs[selectedcurve]
CountsDR = Counts[selectedcurve]
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
CircPr = 1
alpha = 0
def FitEIT_MM_1ion(Freqs, offset, DetDoppler, DetRepump, SG, SP, SR, SCALE1, OFFSET, TEMP, U, plot=False):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
# BETA1 = 0
# SG = 0.6
# SP = 8.1
# TEMP = 0.2e-3
# U = 32.5e6
freqs = [2*f*1e-6-offset for f in Freqs]
#Detunings, Fluorescence1 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA1, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
Detunings, Fluorescence1 = 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)
ScaledFluo1 = np.array([f*SCALE1 + OFFSET for f in Fluorescence1])
if plot:
return ScaledFluo1, Detunings
else:
return ScaledFluo1
#return ScaledFluo1
do_fit = True
if do_fit:
popt_1, pcov_1 = curve_fit(FitEIT_MM_1ion, FreqsDR, CountsDR, p0=[430, -25, 12, 0.9, 6.2, 3, 3e4, 2e3, 0.5e-3, 32e6], bounds=((0, -100, -20, 0, 0, 0, 0, 0, 0,20e6), (1000, 0, 50, 2, 20, 20, 5e6, 5e4, 15e-3,40e6)))
FittedEITpi_1_short, Detunings_1_short = FitEIT_MM_1ion(FreqsDR, *popt_1, plot=True)
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
FittedEITpi_1_long, Detunings_1_long = FitEIT_MM_1ion(freqslong, *popt_1, plot=True)
#%%
plt.figure()
plt.errorbar(Detunings_1_short, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='red', alpha=0.5, capsize=2, markersize=2)
plt.plot(Detunings_1_long, FittedEITpi_1_long, color='darkolivegreen', linewidth=3, label='med 1')
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')
plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')
#plt.xlim(-20,0)
plt.legend(loc='upper left', fontsize=20)
plt.grid()
#%%
u = 32.5e6
B = (u/(2*np.pi))/c
correccion = 8 #con 8 fitea bien
offsetxpi = 440+1+correccion
DetDoppler = -5.0-correccion
FreqsDRpi_3 = [2*f*1e-6-offsetxpi+14 for f in Freqs_B[5]]
CountsDRpi_3 = Counts_B[5]
freqslongpi_3 = np.arange(min(FreqsDRpi_3), max(FreqsDRpi_3)+FreqsDRpi_3[1]-FreqsDRpi_3[0], 0.1*(FreqsDRpi_3[1]-FreqsDRpi_3[0]))
#[1.71811842e+04 3.34325038e-17]
def FitEITpi(freqs, SG, SP):
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*6.554e4 + 1.863e3 for f in MeasuredFluo]
return FinalFluo
popt_tisaoff, pcov_tisaoff = curve_fit(FitEITpi, FreqsDRpi_3, CountsDRpi_3, p0=[0.5, 4.5], bounds=((0, 0), (2, 10)))
print(popt_tisaoff)
Sat_3 = popt_tisaoff[0]
Det_3 = popt_tisaoff[1]
FittedEITpi_3 = FitEITpi(freqslongpi_3, *popt_tisaoff)
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')
FreqsCalibradas_B = FreqsDRpi_3
......@@ -14,7 +14,7 @@ Primero tengo mediciones de espectros cpt de un ion variando la tension dc_A
#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/20231123_CPTconmicromocion3/Data/')
os.chdir('/home/muri/nubeDF/Documents/codigos/artiq_experiments/analisis/plots/20231218_CPT_muri/Data')
CPT_FILES = """000016262-IR_Scan_withcal_optimized
000016239-IR_Scan_withcal_optimized
......@@ -111,7 +111,84 @@ plt.grid()
plt.legend()
#%%
from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels_MM
phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0, 0
phiprobe = 0
titaprobe = 90
Temp = 0.5e-3
sg = 0.544
sp = 4.5
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 = 13
offsetxpi = 419+correccion
DetDoppler = -11.5-correccion
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6
alpha = 0
drivefreq = 2*np.pi*22.135*1e6
selectedcurve = 4
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][selectedcurve]
CountsDR[100]=0.5*(CountsDR[99]+CountsDR[101])
CountsDR[105]=0.5*(CountsDR[104]+CountsDR[106])
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
CircPr = 1
alpha = 0
def FitEIT_MM_single(freqs, SG, SP, SCALE1, OFFSET, BETA1, TEMP):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#BETA = 1.8
# SG = 0.6
# SP = 8.1
# TEMP = 0.2e-3
Detunings, Fluorescence1 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA1, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
ScaledFluo1 = np.array([f*SCALE1 + OFFSET for f in Fluorescence1])
return ScaledFluo1
#return ScaledFluo1
do_fit = True
if do_fit:
popt_1, pcov_1 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 0, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 7e4, 5e4, 0.000001, 15e-3)))
FittedEITpi_1 = FitEIT_MM_single(freqslong, *popt_1)
beta1 = popt_1[4]
errorbeta1 = np.sqrt(pcov_1[4,4])
temp1 = popt_1[5]
errortemp1 = np.sqrt(pcov_1[5,5])
plt.figure()
plt.errorbar(FreqsDR, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='darkgreen', alpha=0.5, capsize=2, markersize=2)
plt.plot(freqslong, FittedEITpi_1, color='darkolivegreen', linewidth=3, label='med 1')
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')
plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')
plt.legend(loc='upper left', fontsize=20)
plt.grid()
......@@ -15,7 +15,7 @@ import numpy as np
import time
import matplotlib.pyplot as plt
from scipy.signal import argrelextrema
#from EITfit.MM_eightLevel_2repumps_python_scripts import CPTspectrum8levels_MM
from EITfit.MM_eightLevel_2repumps_python_scripts import CPTspectrum8levels_MM
import random
from scipy.signal import savgol_filter as sf
......
......@@ -233,7 +233,7 @@ def dopplerBroadening(wlg, wlp, alpha, T, mcalcio = 6.655e-23*1e-3):
kboltzmann = 1.38e-23 #J/K
gammaD = (2*np.pi)*np.sqrt((1/(wlg*wlg)) + (1/(wlp*wlp)) - 2*(1/(wlg*wlp))*np.cos(alpha))*np.sqrt(kboltzmann*T/(2*mcalcio))
gammaD = (2*np.pi)*np.sqrt((1/(wlg*wlg)) + (1/(wlp*wlp)) - 2*(1/(wlg*wlp))*np.cos(alpha))*np.sqrt(kboltzmann*T/(mcalcio))
return gammaD
......@@ -249,8 +249,14 @@ def FullL_MM(rabG, rabP, gPS = 0, gPD = 0, Detg = 0, Detp = 0, u = 0, lwg = 0, l
db = dopplerBroadening(0.397e-6, 0.866e-6, alpha, T)
lwg = np.sqrt(lwg**2 + db**2)
lwp = np.sqrt(lwp**2 + db**2)
kg = 1/397
kp = 1/866
fg = kg**2/(kg**2+kp**2)
fp = kp**2/(kg**2+kp**2)
lwg = np.sqrt(lwg**2 + (fg*db)**2)
lwp = np.sqrt(lwp**2 + (fp*db)**2)
CC = EffectiveL(gPS, gPD, lwg, lwp)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment