Commit 7a9019f7 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto
parents 4b91e6d2 61a9d66c
......@@ -7,6 +7,11 @@
reingenieria del código que anda
Surge de fusionar
Data/EITfit/MM_eightLevel_2repumps_AnalysisFunctions.py
Data/EITfit/MM_eightLevel_2repumps_python_scripts.py
MAPA de FUNCIONES
CPTspectrum8levels_MM
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Ploteo de datos y ajustes
Ploteo de datos y ajustes del barrido en voltaje del Endcap
equivalente a pasear el ion en algun entorno del punto de compensación ideal
y ver los efectos de micromoción (y tal vez temperatura)
@author: lolo
"""
......@@ -24,6 +29,7 @@ from time import time
# /home/lolo/Dropbox/marce/LIAF/Trampa_anular/artiq_experiments/analisis/plots/20231123_CPTconmicromocion3/Data/EITfit/MM_eightLevel_2repumps_AnalysisFunctions.py
from Data.EITfit.lolo_modelo_full_8niveles import PerformExperiment_8levels_MM
......@@ -405,7 +411,7 @@ for Detunings_3_SA_short,CountsDR,Detunings_3_SA_long,FittedEITpi_3_SA_long,sele
ax.grid(True, ls=":")
print(f'listo med {selectedcurve}')
print(popt_3_SA)
# print(popt_3_SA)
for ax in axx[:,0]:
......@@ -452,58 +458,86 @@ ax.set_xticks(num_med)
ax.set_xlabel('Num. de medición')
#%%
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% Endcap hiperbola (con residuos)
"""
Grafico distintas variables que salieron del SUper ajuste
Veamos cómo varía el Beta con el voltaje del endcap
"""
import seaborn as sns
paleta = sns.color_palette("rocket")
voltages_dcA = Voltages[0][1:10]
I = slice(None,9)
voltages_dcA = Voltages[0][SelectedCurveVec]
def lineal(x,a,b):
return a*x+b
def hiperbola(x,a,b,c,x0):
return a*np.sqrt(((x-x0)**2+c**2))+b
def hiperbola(x,a,y0,b,x0):
"""
Hiperbola de ecuación:
1 =(y-y0)²/a² - (x-x0)²/b²
"""
return a*np.sqrt(((x-x0)**2+b**2))+y0
hiperbola_or_linear = True
es_hiperbola = False
if hiperbola_or_linear:
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA,Betas_vec,p0=(100,0.1,1,-0.15))
# par_inicial = (100,0.1,1,-0.15)
# a y0 b x0
par_inicial = (12,0.1,1,-0.13)
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA[I],Betas_vec[I],p0=par_inicial)
xhip = np.linspace(-0.23,0.005,200)
xhip = np.linspace(-0.23,0.005,200)
# plt.figure()
# plt.errorbar(voltages_dcA[I],Betas_vec[I],yerr=ErrorBetas_vec[I],fmt='o',capsize=5,markersize=5,color=paleta[1])
# plt.plot(xhip,hiperbola(xhip,*popthip))
# # plt.plot(xhip,hiperbola(xhip,*par_inicial),'--',color='red')
# plt.xlabel('Endcap voltage (V)')
# plt.ylabel('Modulation factor')
# plt.grid()
fig, axx = plt.subplots( 2, figsize=(10,7) ,
constrained_layout=True, sharex=True,
gridspec_kw=dict(height_ratios=[10,2]))
fig.set_constrained_layout_pads(w_pad=2/72, h_pad=2/72, hspace=0, wspace=0)
plt.figure()
plt.errorbar(voltages_dcA,Betas_vec,yerr=ErrorBetas_vec,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.grid()
ax = axx[0]
else:
poptini,pcovini = curve_fit(lineal,voltages_dcA[0:3],Betas_vec[0:3])
poptfin,pcovfin = curve_fit(lineal,voltages_dcA[4:],Betas_vec[4:])
ax.errorbar(voltages_dcA[I],Betas_vec[I],yerr=ErrorBetas_vec[I],fmt='o',capsize=5,markersize=5,color=paleta[1])
ax.plot(xhip,hiperbola(xhip,*popthip))
# plt.plot(xhip,hiperbola(xhip,*par_inicial),'--',color='red')
minimum_voltage = -(poptini[1]-poptfin[1])/(poptini[0]-poptfin[0]) #voltaje donde se intersectan las rectas, es decir, donde deberia estar el minimo de micromocion
minimum_modulationfactor = lineal(minimum_voltage,*poptini) #es lo mismo si pongo *poptfin
ax.set_ylabel('Modulation factor')
xini = np.linspace(-0.23,-0.13,100)
xfin = np.linspace(-0.15,0.005,100)
ax = axx[1]
plt.figure()
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.axvline(minimum_voltage,linestyle='dashed',color='grey')
plt.xlabel('Endcap voltage (V)')
plt.ylabel('Modulation factor')
plt.grid()
ax.errorbar(voltages_dcA[I],Betas_vec[I]-hiperbola(voltages_dcA[I],*popthip),
yerr=ErrorBetas_vec[I],fmt='o',capsize=5,markersize=5,color=paleta[1])
ax.set_ylabel('Res.')
ax.set_xlabel('Endcap voltage (V)')
for ax in axx:
ax.grid(True, ls=":", color='lightgray')
print([t*1e3 for t in Temp_vec])
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% Este hay que armarlo aún
plt.figure()
plt.errorbar(voltages_dcA,[t*1e3 for t in Temp_vec],yerr=[t*1e3 for t in ErrorTemp_vec],fmt='o',capsize=5,markersize=5,color=paleta[3])
# plt.axvline(minimum_voltage,linestyle='dashed',color='grey')
......@@ -514,30 +548,11 @@ plt.ylabel('Temperature (mK)')
plt.grid()
#plt.ylim(0,2)
#%%
"""
Ahora hago un ajuste con una hiperbola porque tiene mas sentido, por el hecho
de que en el punto optimo el ion no esta en el centro de la trampa
sino que esta a una distancia d
"""
def hiperbola(x,a,b,c,x0):
return a*np.sqrt(((x-x0)**2+c**2))+b
popthip,pcovhip = curve_fit(hiperbola,voltages_dcA,Betas_vec,p0=(100,0.1,1,-0.15))
xhip = np.linspace(-0.23,0.005,200)
plt.figure()
plt.errorbar(voltages_dcA,Betas_vec,yerr=ErrorBetas_vec,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.grid()
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% Ajuste de los betas y la temperatura
#%%
from scipy.special import jv
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Acá hay un análisis de la estabilidad del campo magnético (presuntamente).
Se midieron N veces el mismo espectro y se analiza la variación del spliting
de picos CPT que se debe al efecto Zeeman.
El gráfico final muestra el corrimiento en procentual
@author: lolo
"""
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
"""
Mediciones de una resonancia oscura DD multiples veces a lo largo de una noche para ver estabilidad de B
"""
#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/20231212_Bstability/Data/')
# CPT_FILES = """000016432-IR_Scan_withcal_optimized
# 000016433-IR_Scan_withcal_optimized
# 000016434-IR_Scan_withcal_optimized
# 000016435-IR_Scan_withcal_optimized
# 000016436-IR_Scan_withcal_optimized
# 000016437-IR_Scan_withcal_optimized
# 000016438-IR_Scan_withcal_optimized
# 000016439-IR_Scan_withcal_optimized
# 000016440-IR_Scan_withcal_optimized
# 000016441-IR_Scan_withcal_optimized
# 000016442-IR_Scan_withcal_optimized
# 000016443-IR_Scan_withcal_optimized
# """
folder = '../20231212_Bstability/Data/'
CPT_FILES = f"""
{folder}/000016434-IR_Scan_withcal_optimized
{folder}/000016435-IR_Scan_withcal_optimized
{folder}/000016436-IR_Scan_withcal_optimized
{folder}/000016437-IR_Scan_withcal_optimized
{folder}/000016438-IR_Scan_withcal_optimized
{folder}/000016439-IR_Scan_withcal_optimized
{folder}/000016440-IR_Scan_withcal_optimized
{folder}/000016441-IR_Scan_withcal_optimized
{folder}/000016442-IR_Scan_withcal_optimized
{folder}/000016443-IR_Scan_withcal_optimized
""".strip()
CALIB_FILES = f"""{folder}/000016430-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(CPT_FILES))
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211101_CPT_DosLaseres_v03\Data
Counts = []
Freqs = []
CalibCounts = []
CalibFreqs = []
AmpTisa = []
UVCPTAmp = []
No_measures = []
Voltages = []
for i, fname in enumerate(CPT_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']['data_array']))
#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']))
Voltages.append(np.array(data['datasets']['scanning_voltages']))
for i, fname in enumerate(CALIB_FILES.split()):
print(str(i) + ' - ' + fname)
data = h5py.File(fname+'.h5', 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
CalibFreqs.append(np.array(data['datasets']['IR1_Frequencies']))
CalibCounts.append(np.array(data['datasets']['counts_spectrum']))
def Split(array,n):
length=len(array)/n
splitlist = []
jj = 0
while jj<length:
partial = []
ii = 0
while ii < n:
partial.append(array[jj*n+ii])
ii = ii + 1
splitlist.append(partial)
jj = jj + 1
return splitlist
CountsSplit = []
k=0
for k in range(len(Counts)):
CountsSplit.append(Split(Counts[k],len(Freqs[k])))
#%%
from scipy.optimize import curve_fit
def lorentzian(x,A,B,x0,g,C):
return 2*(A/np.pi)*g/(g**2 + 4*(x-x0)**2)+B+C*(x-x0)
Freqscal = [2*f*1e-6 for f in CalibFreqs[0]]
Countscal = CalibCounts[0]
popt_dr1, pcov_dr1 = curve_fit(lorentzian,Freqscal[37:47],Countscal[37:47],p0=(-1000,1000,436,1,1))
popt_dr2, pcov_dr2 = curve_fit(lorentzian,Freqscal[90:120],Countscal[90:120],p0=(-1000,1000,443,1,1))
DeltaFreqs = popt_dr2[2]-popt_dr1[2]
ZeroFrequency = 0.5*(popt_dr2[2]+popt_dr1[2])
plt.figure()
plt.plot(Freqscal,Countscal,'o')
plt.plot(Freqscal,lorentzian(Freqscal,*popt_dr1))
plt.plot(Freqscal,lorentzian(Freqscal,*popt_dr2))
plt.axvline(ZeroFrequency)
print(DeltaFreqs)
"""
Estas cuentas estan en el cuaderno SMILE MORE WORRY LESS pag 25.
La resonancia de la izquierda esta a (-4/5)*u. La de la derecha esta a (4/5)*u.
Por ende la diferencia es (8/5)*u.
Definimos u como 1.4 MHz/G * B. Entonces Despejamos B facilmente.
"""
ub = 9.27e-24
h = 6.63e-34
u = 1e-6*(ub/h)*1e-4 #en unidades de MHz/G
MagneticField = DeltaFreqs/((8/5)*u)
print(f'Magnetic field: {MagneticField}')
#%%
"""
Ploteo la cpt de referencia / plotting the reference CPT
"""
freqs = [2*f*1e-6 for f in Freqs[0]]
def lorentzian(x,A,B,x0,g,C):
return 2*(A/np.pi)*g/(g**2 + 4*(x-x0)**2)+B+C*(x-x0)
# ii_plot = 11
# jj_plot = 0
ii_plot = 9
jj_plot = 0
ii_problematic = []
jj_problematic = []
Centers = []
Widths = []
test = []
for ii in range(len(CountsSplit)):
for jj in range(len(CountsSplit[0])):
# print(ii)
# print(jj)
try:
if ii==2 and jj==11:
popt_lorentz, pcov_lorentz = curve_fit(lorentzian, freqs[:-10], CountsSplit[ii][jj][:-10],p0=(-1000,1000,436,1,1))
elif ii==2 and jj==12:
popt_lorentz, pcov_lorentz = curve_fit(lorentzian, freqs[40:], CountsSplit[ii][jj][40:],p0=(-1000,1000,436,1,1))
elif ii==4 and jj==1:
popt_lorentz, pcov_lorentz = curve_fit(lorentzian, freqs[:-86], CountsSplit[ii][jj][:-86],p0=(-1000,1000,436,1,1))
elif ii==4 and jj==2:
popt_lorentz = [0,0,0,0,0]
elif ii==4 and jj==7:
popt_lorentz = [0,0,0,0,0]
elif ii==4 and jj==12:
popt_lorentz = [0,0,0,0,0]
elif ii==4 and jj==13:
popt_lorentz = [0,0,0,0,0]
elif ii==4 and jj==14:
popt_lorentz = [0,0,0,0,0]
elif ii==11 and jj==2:
popt_lorentz = [0,0,0,0,0]
elif ii==11 and jj==3:
popt_lorentz = [0,0,0,0,0]
else:
popt_lorentz, pcov_lorentz = curve_fit(lorentzian, freqs, CountsSplit[ii][jj],p0=(-1000,1000,436,1,1))
if popt_lorentz[2]>435.95 or popt_lorentz[2]<435.8:
if popt_lorentz[2]==0:
pass
else:
ii_problematic.append(ii)
jj_problematic.append(jj)
except:
popt_lorentz=[0,0,0,0]
print("except")
print(ii,jj)
if ii == ii_plot and jj == jj_plot:
print('MATCH')
test.append(popt_lorentz)
Centers.append(popt_lorentz[2])
Widths.append(popt_lorentz[3])
prob = 4
print(ii_problematic[prob])
print(jj_problematic[prob])
kk=-83
plt.figure()
plt.plot(freqs, CountsSplit[ii_problematic[prob]][jj_problematic[prob]])
plt.plot(freqs[kk], CountsSplit[ii_problematic[prob]][jj_problematic[prob]][kk],'o',markersize=10)
plt.plot(freqs,lorentzian(freqs,*test[0]))
#%%
"""
Usando que la DR de la izquierda esta a (-4/5)u, donde u = 1.4 MHz/G * B,
despejo y convierto la posicion de esa resonancia a campo magnetico
"""
def ConvertFreqsToMagneticField(f,zerofreq,u):
return np.abs(f-zerofreq)*(5/4)/(1.4)
lentotal = len(CountsSplit)*len(CountsSplit[0])
medtime=4/60
timevec = np.linspace(0,medtime*lentotal, lentotal)
plt.figure()
plt.plot(timevec[4:],ConvertFreqsToMagneticField(Centers,ZeroFrequency,u)[4:],'o')
plt.ylim(3.670,3.730)
plt.xlabel('Time (h)')
plt.ylabel('Magnetic field (G)')
plt.figure()
plt.plot(timevec[4:],[100*c/3.718 for c in ConvertFreqsToMagneticField(Centers,ZeroFrequency,u)][4:],'o')
plt.ylim(98.5,100.1)
plt.xlabel('Time (h)')
plt.ylabel('Magnetic field variation (percent)')
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
??
@author: lolo
"""
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
folder = '../20231218_CPT_DosLaseres_Reflotoajustes/Data'
ALL_FILES = f"""
{folder}/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
cwd = os.getcwd()
os.chdir('../20231123_CPTconmicromocion3')
from Data.EITfit.lolo_modelo_full_3niveles import GenerateNoisyCPT_fit
os.chdir(cwd)
# from Data.EITfit.lolo_modelo_full_8niveles import PerformExperiment_8levels_MM
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
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