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
......
......@@ -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/20231226_CPTconmicromocion4/Data/')
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20231226_CPTconmicromocion4/Data/')
CPT_FILES = """000016531-IR_Scan_withcal_optimized
000016532-IR_Scan_withcal_optimized
......@@ -82,7 +82,7 @@ Ploteo la cpt de referencia / plotting the reference CPT
medic = 1 #puede ser 0 o 1
jvec = [31] # de la 1 a la 9 vale la pena, despues no
jvec = [28] # de la 1 a la 9 vale la pena, despues no
drs = [390.5, 399.5, 406, 413.5]
......@@ -103,623 +103,18 @@ plt.grid()
#plt.axvline(dr+drive)
plt.legend()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 1
"""
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+3*0.8
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 = 1
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 = False
if do_fit:
popt_1, pcov_1 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 2
"""
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+1.6
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 = 2
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][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_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 = False
if do_fit:
popt_2, pcov_2 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_2 = FitEIT_MM_single(freqslong, *popt_2)
beta2 = popt_2[4]
errorbeta2 = np.sqrt(pcov_2[4,4])
temp2 = popt_2[5]
errortemp2 = np.sqrt(pcov_2[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_2, color='darkolivegreen', linewidth=3, label='med 2')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 3
"""
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+0.8
DetDoppler = -11.5-correccion
print(offsetxpi,DetDoppler)
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6
alpha = 0
drivefreq = 2*np.pi*22.135*1e6
selectedcurve = 3
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][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_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_3, pcov_3 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_3 = FitEIT_MM_single(freqslong, *popt_3)
beta3 = popt_3[4]
errorbeta3 = np.sqrt(pcov_3[4,4])
temp3 = popt_3[5]
errortemp3 = np.sqrt(pcov_3[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_3, color='darkolivegreen', linewidth=3, label='med 3')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 4
"""
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]
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 = False
if do_fit:
popt_4, pcov_4 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_4 = FitEIT_MM_single(freqslong, *popt_4)
beta4 = popt_4[4]
errorbeta4 = np.sqrt(pcov_4[4,4])
temp4 = popt_4[5]
errortemp4 = np.sqrt(pcov_4[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_4, color='darkolivegreen', linewidth=3, label='med 4')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 5
"""
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-1
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 = 5
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][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_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 = False
if do_fit:
popt_5, pcov_5 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_5 = FitEIT_MM_single(freqslong, *popt_5)
beta5 = popt_5[4]
errorbeta5 = np.sqrt(pcov_5[4,4])
temp5 = popt_5[5]
errortemp5 = np.sqrt(pcov_5[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_5, color='darkolivegreen', linewidth=3, label='med 5')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 6
"""
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-2.2
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 = 6
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][selectedcurve]
CountsDR[76]=0.5*(CountsDR[75]+CountsDR[77])
CountsDR[1]=0.5*(CountsDR[0]+CountsDR[2])
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_6, pcov_6 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 5e4, 1e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_6 = FitEIT_MM_single(freqslong, *popt_6)
beta6 = popt_6[4]
errorbeta6 = np.sqrt(pcov_6[4,4])
temp6 = popt_6[5]
errortemp6 = np.sqrt(pcov_6[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_6, color='darkolivegreen', linewidth=3, label='med 6')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 7
SUPERAJUSTE: TESTEO FITEOS
"""
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-3.7
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 = 7
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][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_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 = False
if do_fit:
popt_7, pcov_7 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_7 = FitEIT_MM_single(freqslong, *popt_7)
beta7 = popt_7[4]
errorbeta7 = np.sqrt(pcov_7[4,4])
temp7 = popt_7[5]
errortemp7 = np.sqrt(pcov_7[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_7, color='darkolivegreen', linewidth=3, label='med 7')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from EITfit.lolo_modelo_full_8niveles import PerformExperiment_8levels_MM
from scipy.optimize import curve_fit
import time
"""
MEDICION 8
SUPER AJUSTE (SA)
"""
phidoppler, titadoppler = 0, 90
......@@ -743,10 +138,9 @@ u = 32.5e6
#B = (u/(2*np.pi))/c
correccion = 13
# correccion = 13
offsetxpi = 419+correccion-4.9
DetDoppler = -11.5-correccion
#DetDoppler = -11.5-correccion
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6
alpha = 0
......@@ -754,147 +148,67 @@ alpha = 0
drivefreq = 2*np.pi*22.135*1e6
measurement = 1
SelectedCurveVec = [30]
selectedcurve = 8
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][selectedcurve]
for selectedcurve in SelectedCurveVec:
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
FreqsDR = Freqs[measurement]
CountsDR = CountsSplit[measurement][selectedcurve]
CircPr = 1
alpha = 0
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):
def FitEIT_MM_single(Freqs, offset, DetDoppler, SG, SP, SCALE1, OFFSET, BETA1, TEMP, U, DL, PL, plot=False):
#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 = False
if do_fit:
popt_8, pcov_8 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10, 10e-3)))
FittedEITpi_8 = FitEIT_MM_single(freqslong, *popt_8)
beta8 = popt_8[4]
errorbeta8 = np.sqrt(pcov_8[4,4])
temp8 = popt_8[5]
errortemp8 = np.sqrt(pcov_8[5,5])
print()
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_8, color='darkolivegreen', linewidth=3, label='med 8')
#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()
#%%
#from EITfit.MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels
from scipy.optimize import curve_fit
import time
"""
MEDICION 9
"""
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 = 16
offsetxpi = 419+correccion-6
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 = 9
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[0]]
CountsDR = CountsSplit[0][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_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
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 = 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 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, U, DL, PL, 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])
if plot:
return ScaledFluo1, Detunings
else:
return ScaledFluo1
#return ScaledFluo1
do_fit = True
if do_fit:
popt_9, pcov_9 = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2, 1e-3], bounds=((0, 0, 0, 0, 0, 0), (2, 20, 5e4, 5e4, 10,10e-3)))
do_fit = True
if do_fit:
t1 = time.time()
print(f'Beginning {selectedcurve}')
popt_3_SA, pcov_3_SA = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[446, -36, 0.67, 8.5, 6e4, 250, 1, 0.3e-3, 32e6, 0.1, 0.15], bounds=((0, -50, 0, 0, 0, 0, 0, 0, 31e6, 0, 0), (1000, -20, 2, 20, 5e5, 5e4, 10, 100e-3, 34e6, 10, 10)))
print(f'Ended {selectedcurve}, time elapsed: {round(time.time()-t1)} s')
FittedEITpi_9 = FitEIT_MM_single(freqslong, *popt_9)
FittedEITpi_3_SA_short, Detunings_3_SA_short = FitEIT_MM_single(FreqsDR, *popt_3_SA, plot=True)
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
FittedEITpi_3_SA_long, Detunings_3_SA_long = FitEIT_MM_single(freqslong, *popt_3_SA, plot=True)
beta9 = popt_9[4]
errorbeta9 = np.sqrt(pcov_9[4,4])
temp9 = popt_9[5]
errortemp9 = np.sqrt(pcov_9[5,5])
plt.figure()
plt.errorbar(Detunings_3_SA_short, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='darkgreen', alpha=0.5, capsize=2, markersize=2)
plt.plot(Detunings_3_SA_long, FittedEITpi_3_SA_long, color='darkolivegreen', linewidth=3, label=f'med {selectedcurve}')
#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()
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_9, color='darkolivegreen', linewidth=3, label='med 9')
#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()
print(popt_3_SA)
print(f'Beta: {popt_3_SA[6]} +- {np.sqrt(pcov_3_SA[6,6])}')
#%%
"""
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
"""
......@@ -937,9 +251,9 @@ alpha = 0
drivefreq = 2*np.pi*22.135*1e6
SelectedCurveVec = [1,2,3,4,5,6,7,8,9,10,11]
#SelectedCurveVec = [10]
measurement = 1
SelectedCurveVec = np.arange(0,31,1)
#SelectedCurveVec = [17]
popt_SA_vec = []
pcov_SA_vec = []
......@@ -958,23 +272,8 @@ ErrorDetuningsUV_vec = []
for selectedcurve in SelectedCurveVec:
#selectedcurve = 2 #IMPORTANTE: SELECCIONA LA MEDICION
FreqsDR = Freqs[0]
CountsDR = CountsSplit[0][selectedcurve]
if selectedcurve==1:
CountsDR[100]=0.5*(CountsDR[99]+CountsDR[101])
CountsDR[105]=0.5*(CountsDR[104]+CountsDR[106])
if selectedcurve==2:
CountsDR[67]=0.5*(CountsDR[66]+CountsDR[68])
CountsDR[71]=0.5*(CountsDR[70]+CountsDR[72])
if selectedcurve==6:
CountsDR[1]=0.5*(CountsDR[0]+CountsDR[2])
CountsDR[76]=0.5*(CountsDR[75]+CountsDR[77])
if selectedcurve==7:
CountsDR[117]=0.5*(CountsDR[116]+CountsDR[118])
FreqsDR = Freqs[measurement]
CountsDR = CountsSplit[measurement][selectedcurve]
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
CircPr = 1
......@@ -1001,14 +300,11 @@ for selectedcurve in SelectedCurveVec:
do_fit = True
if do_fit:
<<<<<<< HEAD
print(1)
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)))
t1 = time.time()
print(f'Beginning {selectedcurve}')
popt_3_SA, pcov_3_SA = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[443, -32, 0.67, 8, 4e4, 350, 1, 0.5e-3, 32e6], bounds=((0, -50, 0, 0, 0, 0, 0, 0, 31e6), (1000, -20, 2, 20, 5e5, 5e4, 10, 100e-3, 34e6)))
print(f'Ended {selectedcurve}, time elapsed: {round(time.time()-t1)} s')
>>>>>>> f197671e6d2f5bc2c74f8d1e8fb4a89fb518ddbe
popt_SA_vec.append(popt_3_SA)
pcov_SA_vec.append(pcov_3_SA)
......@@ -1051,10 +347,10 @@ Grafico distintas variables que salieron del SUper ajuste
import seaborn as sns
paleta = sns.color_palette("rocket")
medfin = 11
medfin = 19
voltages_dcA = Voltages[0][1:medfin]
voltages_dcA = Voltages[0][0:medfin]
def lineal(x,a,b):
return a*x+b
......@@ -1065,22 +361,20 @@ 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))
#popthip,pcovhip = curve_fit(hiperbola,voltages_dcA[0:20],Betas_vec[0:20],p0=(100,0.1,1,-0.15))
xhip = np.linspace(-0.23,0.055,200)
#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))
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA,Betas_vec[:medfin],p0=(100,0.1,1,-0.15))
xhip = np.linspace(-0.23,0.005,200)
xhip = np.linspace(-0.16,0.05,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.errorbar(voltages_dcA,Betas_vec[0:medfin],yerr=ErrorBetas_vec[:medfin],fmt='o',capsize=5,markersize=5,color=paleta[1])
plt.plot(xhip,hiperbola(xhip,*popthip))
plt.xlabel('Endcap voltage (V)')
plt.ylabel('Modulation factor')
plt.ylim(-1,4)
plt.grid()
else:
......@@ -1097,6 +391,7 @@ else:
plt.errorbar(voltages_dcA,Betas_vec,yerr=ErrorBetas_vec,fmt='o',capsize=5,markersize=5,color=paleta[1])
plt.plot(xini,lineal(xini,*poptini))
plt.plot(xfin,lineal(xfin,*poptfin))
plt.y
plt.axvline(minimum_voltage,linestyle='dashed',color='grey')
plt.xlabel('Endcap voltage (V)')
plt.ylabel('Modulation factor')
......@@ -1106,10 +401,10 @@ else:
print([t*1e3 for t in Temp_vec])
plt.figure()
plt.errorbar(voltages_dcA,[t*1e3 for t in Temp_vec[:medfin-1]],yerr=[t*1e3 for t in ErrorTemp_vec[:medfin-1]],fmt='o',capsize=5,markersize=5,color=paleta[3])
plt.errorbar(voltages_dcA,[t*1e3 for t in Temp_vec[:medfin]],yerr=[t*1e3 for t in ErrorTemp_vec[:medfin]],fmt='o',capsize=5,markersize=5,color=paleta[3])
#plt.axvline(minimum_voltage,linestyle='dashed',color='grey')
plt.axhline(0.538)
plt.yscale('log')
#plt.yscale('log')
plt.xlabel('Endcap voltage (V)')
plt.ylabel('Temperature (mK)')
plt.grid()
......@@ -1215,14 +510,15 @@ def FinalTemp(beta,det, C,D):
Temperatura vs beta con un ajuste exponencial
"""
medfin = 10
popt_exp, pcov_exp = curve_fit(expo,Betas_vec[:9],[t*1e3 for t in Temp_vec[:9]])
popt_exp, pcov_exp = curve_fit(expo,Betas_vec[:medfin],[t*1e3 for t in Temp_vec[:medfin]])
#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
popt_rho22_balance, pcov_rho22_balance = curve_fit(FinalTemp,Betas_vec[:medfin], [t*1e3 for t in Temp_vec[:medfin]],p0=(-10, 10,1)) #esto ajusta muy bien
popt_rho22_poly, pcov_rho22_poly = curve_fit(polynomial,Betas_vec[:medfin], [t*1e3 for t in Temp_vec[:medfin]],p0=(1,2,3,4,10)) #esto ajusta muy bien
print(popt_rho22_balance)
......@@ -1241,17 +537,14 @@ print(f'cociente de los coeff: {popt_rho22_balance[2]/popt_rho22_balance[1]}')
print(f'params: {popt_rho22_balance}')
print(f'errores: {np.sqrt(np.diag(pcov_rho22_balance))}')
k_plot = 9
k_plot = medfin
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.xlim(-0.1,1.1)
#plt.ylim(0,1)
#plt.plot(betaslong,polynomial(betaslong,*popt_rho22_poly),label='Ajuste exponencial')
#plt.plot(betaslong,FinalTemp(betaslong,popt_rho22_balance[0],popt_rho22_balance[1],popt_rho22_balance[2]*1),label='Ajuste con espectro modulado')
plt.xlim(-0,3)
plt.ylim(0,1)
#plt.axvline(minimum_voltage,linestyle='dashed',color='grey')
#plt.axhline(0.538)
......
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