Commit 9bb069aa authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

a ver

parents 5991913f f197671e
...@@ -18,6 +18,16 @@ from scipy.optimize import curve_fit ...@@ -18,6 +18,16 @@ from scipy.optimize import curve_fit
import random import random
from scipy.signal import savgol_filter as sf from scipy.signal import savgol_filter as sf
from scipy.stats import norm 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): 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 ...@@ -37,8 +47,9 @@ def PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinew
velvec = np.linspace(-4*sigmaT,4*sigmaT,100) velvec = np.linspace(-4*sigmaT,4*sigmaT,100)
MBprobVec = norm.pdf(velvec,loc = 0, scale = sigmaT) MBprobVec = norm.pdf(velvec,loc = 0, scale = sigmaT)
MBprobVec = MBprobVec/np.trapz(MBprobVec,velvec)
for i in range(len(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) _, 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) FluorescencesVel.append(Fluorescence)
...@@ -54,21 +65,29 @@ def PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinew ...@@ -54,21 +65,29 @@ def PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinew
else: else:
drivefreq =2*np.pi* 1e3 drivefreq =2*np.pi* 0.6e6
FluorescencesVel = [] FluorescencesVel = []
sigmaT = np.sqrt(T*kboltz/m) sigmaT = np.sqrt(T*kboltz/m)
velvec = np.linspace(-4*sigmaT,4*sigmaT,100) velvec = np.linspace(-4*sigmaT,4*sigmaT,100)
MBprobVec = norm.pdf(velvec,loc = 0, scale = sigmaT) 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 betagVec = velvec*kg/drivefreq
betapVec = velvec*kp/drivefreq betapVec = velvec*kp/drivefreq
for i in range(len(betagVec)): for i in range(len(betagVec)):
betag,betap = betagVec[i],betapVec[i] 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.append(Fluorescence)
FluorescencesVel = np.array(FluorescencesVel) FluorescencesVel = np.array(FluorescencesVel)
MBprobMat = np.tile(MBprobVec,(FluorescencesVel.shape[1],1)).T 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 ProbeDetuningVectorL = Frequencies
#print('Done, Total time: ', round((tfinal-tinicial), 2), "s") #print('Done, Total time: ', round((tfinal-tinicial), 2), "s")
...@@ -106,15 +125,25 @@ def SmoothNoisyCPT(Fluo, window=11, poly=3): ...@@ -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 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): def SpectrumForFit(Freq,sg,sp,T,DetDoppler,A,bgnd,f0):
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) Freq = Freq - f0
return spectra 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) fitted_spectra = SpectrumForFit(Freq,*popt)
return Freq, fitted_spectra,popt,pcov 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): ...@@ -250,7 +250,7 @@ def dopplerBroadening(wlg, wlp, alpha, T, mcalcio = 6.655e-23*1e-3):
kboltzmann = 1.38e-23 #J/K 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 return gammaD
...@@ -264,10 +264,16 @@ def FullL(rabG, rabP, gPS = 0, gPD = 0, Detg = 0, Detp = 0, u = 0, lwg = 0, lwp ...@@ -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) db = dopplerBroadening(0.397e-6, 0.866e-6, alpha, T)
lwg = np.sqrt(lwg**2 + (db/2)**2)/2 lwg = np.sqrt(lwg**2 + (fg*db)**2)
lwp = np.sqrt(lwp**2 + (db/2)**2)/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 ...@@ -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) M = CalculateSingleMmatrix(gPS, gPD, lwg, lwp)
L0 = np.array(np.matrix(Lfullpartial) + M) 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 #NORMALIZACION DE RHO
i = 0 i = 0
while i < 64: while i < 64:
...@@ -422,6 +431,9 @@ def CPTspectrum8levels(sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phidopp ...@@ -422,6 +431,9 @@ def CPTspectrum8levels(sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phidopp
else: else:
DetProbeVector = detpvec*1e6 * 2*np.pi DetProbeVector = detpvec*1e6 * 2*np.pi
Detg = 2*np.pi*Detg*1e6 Detg = 2*np.pi*Detg*1e6
#lwg, lwr, lwp = 2*np.pi*lwg*1e6, 2*np.pi*lwr*1e6, 2*np.pi*lwp*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 ...@@ -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.plot(DetProbeVectorMHz, [100*f for f in Fluovector], label=str(titaprobe) + 'º, T: ' + str(Temp*1e3) + ' mK')
plt.legend() 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): 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 ...@@ -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.plot(DetProbeVectorMHz, [100*f for f in Fluovector], label=str(titaprobe) + 'º, T: ' + str(Temp*1e3) + ' mK')
plt.legend() plt.legend()
return DetProbeVectorMHz, Fluovector return DetProbeVectorMHz, np.array(Fluovector)
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -920,6 +920,9 @@ plt.grid() ...@@ -920,6 +920,9 @@ plt.grid()
#%% #%%
""" """
AHORA INTENTO SUPER AJUSTES O SEA CON OFFSETXPI Y DETDOPPLER INCLUIDOS AHORA INTENTO SUPER AJUSTES O SEA CON OFFSETXPI Y DETDOPPLER INCLUIDOS
La 0 no ajusta bien incluso con todos los parametros libres
De la 1 a la 11 ajustan bien
""" """
...@@ -963,8 +966,8 @@ alpha = 0 ...@@ -963,8 +966,8 @@ alpha = 0
drivefreq = 2*np.pi*22.135*1e6 drivefreq = 2*np.pi*22.135*1e6
SelectedCurveVec = [1,2,3,4,5,6,7,8,9] SelectedCurveVec = [1,2,3,4,5,6,7,8,9,10,11]
#SelectedCurveVec = [9] #SelectedCurveVec = [10]
if not 'popt_SA_vec' in globals().keys() or len(popt_SA_vec)==0: if not 'popt_SA_vec' in globals().keys() or len(popt_SA_vec)==0:
...@@ -1152,9 +1155,42 @@ plt.grid() ...@@ -1152,9 +1155,42 @@ plt.grid()
#%% #%%
from scipy.special import jv
def expo(x,tau,A,B): def expo(x,tau,A,B):
return A*np.exp(x/tau)+B return A*np.exp(x/tau)+B
def cuadratica(x,a,c):
return a*(x**2)+c
def InverseMicromotionSpectra(beta, A, det, x0, gamma, B):
ftrap=22.1
#gamma=30
P = ((jv(0, beta)**2)/((((det-x0)**2)+(0.5*gamma)**2)**2))*(-2*(det-x0))
i = 1
#print(P)
while i <= 5:
P = P + (-2*(det-x0))*((jv(i, beta))**2)/(((((det-x0)+i*ftrap)**2)+(0.5*gamma)**2)**2) + (-2*(det-x0))*(((jv(-i, beta))**2)/((((det-x0)-i*ftrap)**2)+(0.5*gamma)**2)**2)
i = i + 1
#print(P)
#return 1/(A*P+B)
return 1/(A*P+B)
def InverseMicromotionSpectra_raw(beta, A, det, B):
ftrap=22.1
gamma=21
P = ((jv(0, beta)**2)/((((det)**2)+(0.5*gamma)**2)**2))*(-2*(det))
i = 1
#print(P)
while i <= 3:
P = P + (-2*(det))*((jv(i, beta))**2)/(((((det)+i*ftrap)**2)+(0.5*gamma)**2)**2) + (-2*(det))*(((jv(-i, beta))**2)/((((det)-i*ftrap)**2)+(0.5*gamma)**2)**2)
i = i + 1
#print(P)
return A/P+B
""" """
Temperatura vs Temperatura vs
""" """
...@@ -1818,7 +1854,7 @@ if False: ...@@ -1818,7 +1854,7 @@ if False:
for var in [ kk for kk in globals().keys() if kk.startswith('pcov') ]: for var in [ kk for kk in globals().keys() if kk.startswith('pcov') ]:
print(var) print(var)
GUARDAR[var] = globals()[var] GUARDAR[var] = globals()[var]
print('') print('')
for var in [ kk for kk in globals().keys() if kk.startswith('Fitted') ]: for var in [ kk for kk in globals().keys() if kk.startswith('Fitted') ]:
print(var) print(var)
...@@ -1827,8 +1863,6 @@ if False: ...@@ -1827,8 +1863,6 @@ if False:
for var in [ kk for kk in globals().keys() if kk.endswith('_vec') ]: for var in [ kk for kk in globals().keys() if kk.endswith('_vec') ]:
print(var) print(var)
GUARDAR[var] = globals()[var] GUARDAR[var] = globals()[var]
np.savez('PARAMETROS.npz', **GUARDAR )
np.savez('PARAMETROS.npz', **GUARDAR )
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 ...@@ -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 #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 CPT_FILES = """000016262-IR_Scan_withcal_optimized
000016239-IR_Scan_withcal_optimized 000016239-IR_Scan_withcal_optimized
...@@ -111,7 +111,84 @@ plt.grid() ...@@ -111,7 +111,84 @@ plt.grid()
plt.legend() 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 ...@@ -15,7 +15,7 @@ import numpy as np
import time import time
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from scipy.signal import argrelextrema 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 import random
from scipy.signal import savgol_filter as sf from scipy.signal import savgol_filter as sf
......
...@@ -233,7 +233,7 @@ def dopplerBroadening(wlg, wlp, alpha, T, mcalcio = 6.655e-23*1e-3): ...@@ -233,7 +233,7 @@ def dopplerBroadening(wlg, wlp, alpha, T, mcalcio = 6.655e-23*1e-3):
kboltzmann = 1.38e-23 #J/K 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 return gammaD
...@@ -249,8 +249,14 @@ def FullL_MM(rabG, rabP, gPS = 0, gPD = 0, Detg = 0, Detp = 0, u = 0, lwg = 0, l ...@@ -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) db = dopplerBroadening(0.397e-6, 0.866e-6, alpha, T)
lwg = np.sqrt(lwg**2 + db**2) kg = 1/397
lwp = np.sqrt(lwp**2 + db**2) 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) 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