Commit a837143f authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

todo

parent 346282a9
......@@ -1008,14 +1008,14 @@ for selectedcurve in SelectedCurveVec:
do_fit = True
if do_fit:
<<<<<<< HEAD
print(1)
t1 = time.time()
print(f'Beginning {selectedcurve}')
popt_3_SA, pcov_3_SA = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[430, -25, 0.9, 6.2, 3e4, 1.34e3, 2, (np.pi**2)*1e-3, 32e6], bounds=((0, -50, 0, 0, 0, 0, 0, 0, 31e6), (1000, 0, 2, 20, 5e4, 5e4, 10, (np.pi**2)*10e-3, 34e6)))
print(2)
=======
popt_3_SA, pcov_3_SA = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[430, -25, 0.9, 6.2, 3e4, 1.34e3, 2, (np.pi**2)*1e-3, 32e6], bounds=((0, -50, 0, 0, 0, 0, 0, 0, 25e6), (1000, 0, 2, 20, 5e4, 5e4, 10, (np.pi**2)*10e-3, 40e6)))
print(f'Ended {selectedcurve}, time elapsed: {round(time.time()-t1)} s')
#popt_3_SA, pcov_3_SA = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[430, -25, 0.9, 6.2, 3e4, 1.34e3, 2, (np.pi**2)*1e-3, 32e6], bounds=((0, -50, 0, 0, 0, 0, 0, 0, 25e6), (1000, 0, 2, 20, 5e4, 5e4, 10, (np.pi**2)*10e-3, 40e6)))
>>>>>>> f197671e6d2f5bc2c74f8d1e8fb4a89fb518ddbe
popt_SA_vec.append(popt_3_SA)
pcov_SA_vec.append(pcov_3_SA)
......@@ -1072,17 +1072,17 @@ def hiperbola(x,a,b,c,x0):
hiperbola_or_linear = True
if hiperbola_or_linear:
<<<<<<< HEAD
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA[0:9],Betas_vec[0:9],p0=(100,0.1,1,-0.15))
xhip = np.linspace(-0.23,0.055,200)
=======
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA,Betas_vec[:medfin-1],p0=(100,0.1,1,-0.15))
xhip = np.linspace(-0.23,0.005,200)
>>>>>>> f197671e6d2f5bc2c74f8d1e8fb4a89fb518ddbe
plt.figure()
plt.errorbar(voltages_dcA,Betas_vec[0:medfin-1],yerr=ErrorBetas_vec[:medfin-1],fmt='o',capsize=5,markersize=5,color=paleta[1])
plt.plot(xhip,hiperbola(xhip,*popthip))
......@@ -1137,7 +1137,7 @@ voltages_dcA = Voltages[0][1:medfin]
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA[:10],Betas_vec[:10],p0=(100,0.1,1,-0.15))
xhip = np.linspace(-0.23,0.055,200)
xhip = np.linspace(-0.23,0.005,200)
plt.figure()
plt.errorbar(voltages_dcA,Betas_vec[:medfin-1],yerr=ErrorBetas_vec[:medfin-1],fmt='o',capsize=5,markersize=5,color=paleta[1])
......@@ -1153,6 +1153,17 @@ plt.grid()
#%%
from scipy.special import jv
"""
Por si no quiero correr todo de nuevo:
Betas_vec = [1.5063238290734708, 0.901629236713104, 0.5280696724084589, 0.32347492275852474, 0.581352716043054, 0.9655636982224044, 1.6186284658310388, 2.1055294502704047, 2.548008896618126, 3.130666254406969, 3.1665902866111795]
ErrorBetas_vec = [0.034184989382424424, 0.04827624922956116, 0.054704762232730145, 0.06708926613955447, 0.047526038227881616, 0.05210296764897591, 0.03630379898730492, 0.034064021790261405, 0.050405155463964166, 0.10838273932613045, 0.2828605486723366]
Temp_vec = [0.0017384071359855713, 0.0006380145223733723, 0.0007457923288975645, 0.0006442238745101592, 0.0006270680749881928, 0.0008995355804703286, 0.0017799223158665226, 0.002941224610139307, 0.008378628768005558, 0.026250695067608725, 0.09869604401089357]
ErrorTemp_vec = [0.0004229476096548473, 0.00014439375508413987, 0.00013204015146487435, 9.307939678673377e-05, 0.000100129717662808, 0.0001841318633900307, 0.0003595040837509976, 0.0005950353892849986, 0.001866844309182069, 0.012656306714647434, 0.13143081065882864]
"""
print(ErrorTemp_vec)
def expo(x,tau,A,B):
return A*np.exp(x/tau)+B
......@@ -1175,7 +1186,7 @@ def InverseMicromotionSpectra(beta, A, det, x0, gamma, B):
def MicromotionSpectra(beta,det, gamma):
ftrap=22.1
ftrap=2*np.pi*22.1e6
#gamma=23
P = (jv(0, beta)**2)/(((det)**2)+(0.5*gamma)**2)
i = 1
......@@ -1193,7 +1204,7 @@ def polynomial(x,a,b,c,d,e):
return a+b*x+c*x*x+d*x*x*x+e*x*x*x*x
def InverseDerivMicromotionSpectra(beta, det, gamma):
ftrap=22.1
ftrap=2*np.pi*22.1e6
#gamma=23
#det = -gamma/2
P = ((jv(0, beta)**2)/((((det)**2)+(0.5*gamma)**2)**2))*(-2*(det))
......@@ -1207,42 +1218,58 @@ def InverseDerivMicromotionSpectra(beta, det, gamma):
def FinalTemp(beta,det, C,D):
gamma = 21
"""
En mK
"""
gamma = 23e6
hbar = 1.05e-34
kb = 1.38e-23
#C = 0.85
#D=0.5e-27
#det = -12e6
#print(MicromotionSpectra(beta,det,gamma))
#D=0
return ((hbar/(1*kb))*C*MicromotionSpectra(beta,2*np.pi*det,2*np.pi*gamma)+D*(beta**2))*InverseDerivMicromotionSpectra(beta, 2*np.pi*det, 2*np.pi*gamma)
#return (C*MicromotionSpectra(beta,det,gamma))*InverseDerivMicromotionSpectra(beta, det, gamma)
def FinalTemp_fixedall(beta, det, D):
"""
En mK
"""
gamma = 23e6
#det=-11
#D=-0.8
#C = 1.68656122e-03
#D = 6.64227010e-02
#C=0
#D=1e-29
hbar = 1.05e-34
kb = 1.38e-23
D = 2e-9
C = 1
det = -11e6
#print(MicromotionSpectra(beta,det,gamma))
return (C*MicromotionSpectra(beta,det,gamma)+D*beta**2)*InverseDerivMicromotionSpectra(beta, det, gamma)
return 1e3*((hbar/(kb))*C*MicromotionSpectra(beta,2*np.pi*det,2*np.pi*gamma)+D*beta**2)*InverseDerivMicromotionSpectra(beta, 2*np.pi*det, 2*np.pi*gamma)
#return (C*MicromotionSpectra(beta,det,gamma))*InverseDerivMicromotionSpectra(beta, det, gamma)
"""
Temperatura vs beta con un ajuste exponencial
"""
popt_rho22_balance, pcov_rho22_balance = curve_fit(FinalTemp,list(np.arange(0,0.3,0.001))+list(Betas_vec[:9]), list(0.5e-3*np.ones(len(np.arange(0,0.3,0.001))))+[t for t in Temp_vec[:9]],p0=(-10e6, 1,1e-27), bounds=((-30e6,0,0),(0e6,2,1e-25))) #esto ajusta muy bien
#popt_rho22_balance, pcov_rho22_balance = curve_fit(FinalTemp,list(Betas_vec[:9]), [t for t in Temp_vec[:9]],p0=(-11e6, 1,1e-28), bounds=((-30e6,0,1e-30),(0e6,2,1e-25))) #esto ajusta muy bien
#popt_rho22_balance, pcov_rho22_balance = curve_fit(FinalTemp_fixedall,list(Betas_vec[:9]), [t*1e3 for t in Temp_vec[:9]],p0=(-10,1e-20), bounds=((-30,0),(0,1e6))) #esto ajusta muy bien
popt_exp, pcov_exp = curve_fit(expo,Betas_vec[:9],[t*1e3 for t in Temp_vec[:9]])
#popt_quad, pcov_quad = curve_fit(cuadratica,Betas_vec[:11],[t*1e3 for t in Temp_vec[:11]],p0=(1,10))
#popt_rho22, pcov_rho22 = curve_fit(InverseMicromotionSpectra,Betas_vec,[t*1e3 for t in Temp_vec],p0=(10,10,-10,1,20)) #esto ajusta muy bien
#popt_rho22, pcov_rho22 = curve_fit(InverseMicromotionSpectra,Betas_vec, [t*1e3 for t in Temp_vec],p0=(-10,-10,10,1,20)) #esto ajusta muy bien
#popt_rho22_raw, pcov_rho22_raw = curve_fit(InverseMicromotionSpectra_raw,Betas_vec[:7], [t*1e3 for t in Temp_vec[:7]],p0=(-0.1, -10, 1)) #esto ajusta muy bien
popt_rho22_balance, pcov_rho22_balance = curve_fit(FinalTemp,Betas_vec[:9], [t*1e3 for t in Temp_vec[:9]],p0=(-10, 10,1)) #esto ajusta muy bien
popt_rho22_poly, pcov_rho22_poly = curve_fit(polynomial,Betas_vec[:9], [t*1e3 for t in Temp_vec[:9]],p0=(1,2,3,4,10)) #esto ajusta muy bien
print(popt_rho22_balance)
betaslong = np.arange(0,2.8,0.01)
print(f'Min temp predicted: {FinalTemp(betaslong,*popt_rho22_balance)[0]}')
print(f'Detuning: {popt_rho22_balance[0]} MHz')
print(f'rho22 coeff: {popt_rho22_balance[1]}')
print(f'betasquared coeff: {popt_rho22_balance[2]}')
#print(f'Min temp predicted: {FinalTemp_fixedall(betaslong,*popt_rho22_balance)[0]}')
print(f'Min temp predicted: {1e3*FinalTemp(betaslong,*popt_rho22_balance)[0]} mK')
print(f'cociente de los coeff: {popt_rho22_balance[2]/popt_rho22_balance[1]}')
print(f'Detuning: {1e-6*popt_rho22_balance[0]} MHz')
print(f'params: {popt_rho22_balance}')
......@@ -1252,11 +1279,8 @@ k_plot = 9
plt.figure()
plt.errorbar(Betas_vec[:k_plot],[t*1e3 for t in Temp_vec[:k_plot]],xerr=ErrorBetas_vec[:k_plot], yerr=[t*1e3 for t in ErrorTemp_vec[:k_plot]],fmt='o',capsize=5,markersize=5,color=paleta[3])
#plt.plot(betaslong,expo(betaslong,*popt_exp),label='Ajuste exponencial')
plt.plot(betaslong,polynomial(betaslong,*popt_rho22_poly),label='Ajuste exponencial')
#plt.plot(betaslong,cuadratica(betaslong,*popt_quad),label='Ajuste cuadratico')
#plt.plot(betaslong,InverseMicromotionSpectra(betaslong,*popt_rho22),label='Ajuste cuadratico')
plt.plot(betaslong,FinalTemp(betaslong,popt_rho22_balance[0],popt_rho22_balance[1],popt_rho22_balance[2]*1),label='Ajuste con espectro modulado')
plt.plot(betaslong,[t*1e3 for t in FinalTemp(betaslong,*popt_rho22_balance)],label='Ajuste con espectro modulado')
#plt.plot(betaslong,FinalTemp_fixedall(betaslong,*popt_rho22_balance),label='Ajuste con espectro modulado')
# plt.xlim(-0.1,1.1)
#plt.ylim(0,1)
......@@ -1264,9 +1288,33 @@ plt.plot(betaslong,FinalTemp(betaslong,popt_rho22_balance[0],popt_rho22_balance[
#plt.axhline(0.538)
plt.xlabel('Modulation factor')
plt.ylabel('Temperature (mK)')
plt.legend()
plt.title('With RF heating')
plt.grid()
#%%
"""
Calculo limite doppler para distintos detunings pero sin micromocion
"""
def CoolingLimit_noMM(det):
gamma = 2*np.pi*23e6
hbar = 1.05e-34
kb = 1.38e-23
beta = 0
return ((2*hbar/(2*kb))*MicromotionSpectra(beta,det,gamma))*InverseDerivMicromotionSpectra(beta, det, gamma)
DetVec = np.arange(-2*np.pi*30e6,-2*np.pi*1e6,2*np.pi*0.1e6)
Temps_limit = []
for detuning in DetVec:
Temps_limit.append(CoolingLimit_noMM(detuning))
print(f'best: {1e3*np.min(Temps_limit)}')
plt.figure()
plt.plot(DetVec*1e-6/(2*np.pi), np.array(Temps_limit)*1e3)
#%%
hbar=1.05e-34
......
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