Commit 32f4f986 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

codigos

parent 282ee988
...@@ -214,8 +214,9 @@ popt_vec = [] ...@@ -214,8 +214,9 @@ popt_vec = []
pcov_vec = [] pcov_vec = []
plt.figure() plt.figure()
for j in range(len(SP_Heigths)): for j in range(len(SP_Heigths)-1):
#for j in [12]: #for j in [12]:
print(j)
BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths[j][0:50]),np.mean(SP_Heigths[j][-50:]),59,67,965) BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths[j][0:50]),np.mean(SP_Heigths[j][-50:]),59,67,965)
#CorrectedSP_Height = [SP_Heigths[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))] #CorrectedSP_Height = [SP_Heigths[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
...@@ -234,10 +235,15 @@ for j in range(len(SP_Heigths)): ...@@ -234,10 +235,15 @@ for j in range(len(SP_Heigths)):
#%% #%%
plt.figure() plt.figure()
plt.plot(UVpotVec, Taus,'o') plt.plot(UVpotVec[:-5], Taus[:-6],'o', markersize=10, color='purple')
plt.xlabel('UV power (mW)') #plt.errorbar(UVpotVec[:-5], Taus[:-6], yerr=1e1*np.array(ErrorTaus[:-6]), fmt='.', capsize=2, markersize=2)
plt.ylabel('Characteristic time (us)') plt.xlabel('UV power (mW)', fontsize=15)
plt.ylabel('Characteristic time (us)', fontsize=15)
plt.ylim(-0.1,3)
plt.grid()
#%%
plt.figure() plt.figure()
plt.plot(UVpotVec, Amps,'o') plt.plot(UVpotVec, Amps,'o')
plt.xlabel('UV power (mW)') plt.xlabel('UV power (mW)')
...@@ -262,8 +268,8 @@ plt.rcParams.update({ ...@@ -262,8 +268,8 @@ plt.rcParams.update({
"text.usetex": False, "text.usetex": False,
}) })
#plt.figure() plt.figure()
#plt.plot(Stat_Bins[0][:-1], Stat_Heigths[0]) plt.plot(Stat_Bins[0][:-1], Stat_Heigths[0])
#plot figuras papers #plot figuras papers
...@@ -309,30 +315,36 @@ pcov_vec_v2 = [] ...@@ -309,30 +315,36 @@ pcov_vec_v2 = []
ki = 80 ki = 80
selectedj = [2,5,10]
t0 = -0.2
plt.figure() plt.figure()
for j in range(len(SP_Heigths_v2)): for j in range(len(SP_Heigths_v2)):
#for j in [1]: #for j in [1]:
#BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths_v2[j][0:50]),np.mean(SP_Heigths_v2[j][-50:]),59,67,965) if j in selectedj:
#BackgroundVector = SP_Bkgr_builder(np.mean(SP_Heigths_v2[j][0:50]),np.mean(SP_Heigths_v2[j][-50:]),59,67,965)
#CorrectedSP_Height_v2 = [SP_Heigths_v2[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
#CorrectedSP_Height_v2 = [SP_Heigths_v2[j][k]-BackgroundVector[k] for k in range(len(BackgroundVector))]
CorrectedSP_Height_v2 = SP_Heigths_v2[j]
CorrectedSP_Height_v2 = SP_Heigths_v2[j]
popt, pcov = curve_fit(expo, RefBins[ki:], CorrectedSP_Height_v2[ki:], p0=(5, 1000, 100), bounds=((0, 0, 0), (50, 1e5, 1e5)))
popt_vec_v2.append(popt) popt, pcov = curve_fit(expo, RefBins[ki:], CorrectedSP_Height_v2[ki:], p0=(5, 1000, 100), bounds=((0, 0, 0), (50, 1e5, 1e5)))
pcov_vec_v2.append(pcov) popt_vec_v2.append(popt)
plt.plot(RefBins, CorrectedSP_Height_v2) pcov_vec_v2.append(pcov)
plt.plot(RefBins[ki:], [expo(r, *popt) for r in RefBins][ki:]) plt.plot([r+t0 for r in RefBins], CorrectedSP_Height_v2)
plt.plot([r+t0 for r in RefBins[ki:]], [expo(r, *popt) for r in RefBins][ki:])
print(popt[0])
print(popt[0])
print(pcov[0][0])
print(pcov[0][0])
Taus_v2.append(popt[0])
Amps_v2.append(popt[1]) Taus_v2.append(popt[0])
Offsets_v2.append(popt[2]) Amps_v2.append(popt[1])
ErrorTaus_v2.append(np.sqrt(pcov)[0][0]) Offsets_v2.append(popt[2])
ErrorTaus_v2.append(np.sqrt(pcov)[0][0])
plt.xlim(-0.2,2)
#%% #%%
plt.figure() plt.figure()
...@@ -397,7 +409,7 @@ plt.savefig('fig3_01.pdf') ...@@ -397,7 +409,7 @@ plt.savefig('fig3_01.pdf')
plt.savefig('fig3_01.svg') plt.savefig('fig3_01.svg')
#%% #%%
""" """
VEMOS UNA DP CON POTENCIA ALTA A VER SI DA LO QUE TIENE QUE DAR EL ANCHO DE LINEA VEMOS UNA DP CON POTENCIA ALTA A VER SI DA LO QUE TIENE QUE DAR EL ANCHO DE LINEA
...@@ -449,10 +461,16 @@ initi=0.10 ...@@ -449,10 +461,16 @@ initi=0.10
popt_UV, pcov_UV = curve_fit(expo, BinsUVhigh[int(initi*len(BinsUVhigh)):], HeightsUVhigh[int(initi*len(BinsUVhigh)):], p0=(1, 1000, 1800, 1), bounds=((0,0,0,0),(20, 1e7, 1e5, 1e3))) popt_UV, pcov_UV = curve_fit(expo, BinsUVhigh[int(initi*len(BinsUVhigh)):], HeightsUVhigh[int(initi*len(BinsUVhigh)):], p0=(1, 1000, 1800, 1), bounds=((0,0,0,0),(20, 1e7, 1e5, 1e3)))
plt.figure() plt.figure()
plt.plot(BinsUVhigh, HeightsUVhigh) plt.plot(BinsUVhigh, HeightsUVhigh,linewidth=4)
plt.plot(BinsUVhigh, [expo(r, *popt_UV) for r in BinsUVhigh]) plt.plot(BinsUVhigh[80:], [expo(r, *popt_UV) for r in BinsUVhigh][80:], color='fuchsia', linewidth=3, label='Exponential fit')
plt.plot(BinsUVhigh[int(initi*len(BinsUVhigh))], HeightsUVhigh[int(initi*len(BinsUVhigh))],'o',markersize=5) #plt.plot(BinsUVhigh[int(initi*len(BinsUVhigh))], HeightsUVhigh[int(initi*len(BinsUVhigh))],'o',markersize=5)
#plt.ylim(-1000,20000) #plt.ylim(-1000,20000)
plt.grid()
plt.xlabel(r'Time ($\mu$s)', fontsize=15)
plt.ylabel('Counts', fontsize=15)
plt.xlim(-0.5, 5)
plt.legend(fontsize=15)
tauUV = popt_UV[0] tauUV = popt_UV[0]
print(tauUV) print(tauUV)
......
...@@ -12,6 +12,8 @@ from scipy import interpolate ...@@ -12,6 +12,8 @@ from scipy import interpolate
#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/20230321_heatingrate/Data/')
CPT_FILES = """000010420-IR_Scan_withcal_optimized CPT_FILES = """000010420-IR_Scan_withcal_optimized
000010436-IR_Scan_withcal_optimized 000010436-IR_Scan_withcal_optimized
000010437-IR_Scan_withcal_optimized 000010437-IR_Scan_withcal_optimized
...@@ -19,6 +21,12 @@ CPT_FILES = """000010420-IR_Scan_withcal_optimized ...@@ -19,6 +21,12 @@ CPT_FILES = """000010420-IR_Scan_withcal_optimized
000010439-IR_Scan_withcal_optimized 000010439-IR_Scan_withcal_optimized
000010440-IR_Scan_withcal_optimized 000010440-IR_Scan_withcal_optimized
000010441-IR_Scan_withcal_optimized 000010441-IR_Scan_withcal_optimized
000010425-IR_Scan_withcal_optimized
000010426-IR_Scan_withcal_optimized
000010427-IR_Scan_withcal_optimized
000010428-IR_Scan_withcal_optimized
000010429-IR_Scan_withcal_optimized
000010430-IR_Scan_withcal_optimized
""" """
HEATING_FILES = """000010422-HeatingRate""" HEATING_FILES = """000010422-HeatingRate"""
...@@ -81,7 +89,7 @@ for i, fname in enumerate(HEATING_FILES.split()): ...@@ -81,7 +89,7 @@ for i, fname in enumerate(HEATING_FILES.split()):
#%% #%%
""" """
Ploteo la cpt de referencia Ploteo la cpt de referencia / plotting the reference CPT
""" """
jvec = [0] jvec = [0]
...@@ -103,6 +111,7 @@ from scipy.optimize import curve_fit ...@@ -103,6 +111,7 @@ from scipy.optimize import curve_fit
""" """
Ajusto un cpt para obtener todos los parámetros relevantes primero. Ajusto un cpt para obtener todos los parámetros relevantes primero.
I fit a cpt curve to retrieve all the relevant parameters first.
""" """
phidoppler, titadoppler = 0, 90 phidoppler, titadoppler = 0, 90
...@@ -160,9 +169,10 @@ def FitEITpi(freqs, SG, SP, scale, offset, temp): ...@@ -160,9 +169,10 @@ def FitEITpi(freqs, SG, SP, scale, offset, temp):
#esos valores anteriores dan mal la ordenada al origen, cambie correccion y ahora da #esos valores anteriores dan mal la ordenada al origen, cambie correccion y ahora da
#[4.71134671e-01, 7.63142299e+00, 7.30866544e+04, 1.80899906e+02, 1.20863371e-03] #[4.71134671e-01, 7.63142299e+00, 7.30866544e+04, 1.80899906e+02, 1.20863371e-03]
popt_fullcpt, pcov_fullcpt = curve_fit(FitEITpi, FreqsDRpi, CountsDRpi, p0=[0.5, 4.5, 1e4, 1e3, 1e-3], bounds=((0, 0, 0, 0, 0), (2, 10, 1e5, 1e5, 10e-3)))
print(f'Temperatura: ({round(1e3*popt_fullcpt[-1],2)} +- {round(1e3*np.sqrt(pcov_fullcpt[-1][-1]),2)}) mK') print(f'Temperatura: ({round(1e3*popt_fullcpt[-1],2)} +- {round(1e3*np.sqrt(pcov_fullcpt[-1][-1]),2)}) mK')
popt_fullcpt, pcov_fullcpt = curve_fit(FitEITpi, FreqsDRpi, CountsDRpi, p0=[0.5, 4.5, 1e4, 1e3, 1e-3], bounds=((0, 0, 0, 0, 0), (2, 10, 1e5, 1e5, 10e-3)))
print(popt_fullcpt) print(popt_fullcpt)
...@@ -171,26 +181,44 @@ Det = popt_fullcpt[1] ...@@ -171,26 +181,44 @@ Det = popt_fullcpt[1]
FittedEITpi = FitEITpi(freqslongpi, *popt_fullcpt) FittedEITpi = FitEITpi(freqslongpi, *popt_fullcpt)
#%%
"""
Ploteo la CPT de referencia junto al ajuste y a la resonancia oscura de interes
I plot the reference CPT along with the fit to the model and the dark resonance of interest
"""
i_DR = 955
plt.figure() plt.figure()
plt.errorbar(FreqsDRpi, CountsDRpi, yerr=2*np.sqrt(CountsDRpi), fmt='o', capsize=2, markersize=2) plt.errorbar(FreqsDRpi, CountsDRpi, yerr=2*np.sqrt(CountsDRpi), fmt='o', capsize=2, markersize=2)
plt.plot(freqslongpi, FittedEITpi) plt.plot(freqslongpi, FittedEITpi)
plt.plot(freqslongpi[i_DR], FittedEITpi[i_DR],'o', color='red', markersize=12)
plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz') #plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')
#%% #%%
""" """
Simulo CPTs con todos esos parámetros para distintas temperaturas Simulo CPTs con todos esos parámetros para distintas temperaturas
I simulate CPT curves with all the previous parameters but with varying temperatures
""" """
TempVecTeorico = list(np.arange(0, 31, 1)) TempVecTeorico = list(np.arange(0.3,1,0.1))+list(np.arange(1, 31, 1))
CurvasTeoricas = [] CurvasTeoricas = []
for tempi in TempVecTeorico: for tempi in TempVecTeorico:
CurvasTeoricas.append(FitEITpi(freqslongpi, *popt_fullcpt[:-1], tempi*1e-3)) CurvasTeoricas.append(FitEITpi(freqslongpi, *popt_fullcpt[:-1], tempi*1e-3))
#%% #%%
""" """
Acá agarro la primera y busco el valor i_DR que corresponde a la resonancia oscura de interés Acá agarro la primera y busco el valor i_DR que corresponde a la resonancia oscura de interés
With the first one, I look for the value i_DR which corresponds to the dark resonance of interest
""" """
curva_ref = CurvasTeoricas[0] curva_ref = CurvasTeoricas[0]
...@@ -201,12 +229,33 @@ plt.figure() ...@@ -201,12 +229,33 @@ plt.figure()
plt.plot(freqslongpi, curva_ref) plt.plot(freqslongpi, curva_ref)
plt.plot(freqslongpi[i_DR], curva_ref[i_DR],'o') plt.plot(freqslongpi[i_DR], curva_ref[i_DR],'o')
#%%
"""
ploteo algunos CPTs teoricos para algunas temperaturas
Plotting some theory cpt curves for some temperatures
"""
plt.plot(freqslongpi, CurvasTeoricas[0])
plt.plot(freqslongpi[i_DR], CurvasTeoricas[0][i_DR],'o',markersize=10)
plt.plot(freqslongpi, CurvasTeoricas[10])
plt.plot(freqslongpi[i_DR], CurvasTeoricas[10][i_DR],'o',markersize=10)
plt.plot(freqslongpi, CurvasTeoricas[20])
plt.plot(freqslongpi[i_DR], CurvasTeoricas[20][i_DR],'o',markersize=10)
plt.xlabel('Detuning (MHz)')
plt.ylabel('Fluorescence')
plt.grid()
#%% #%%
""" """
Ahora interpolo los valores teóricos de las profundidades de esas resonancias Ahora interpolo los valores teóricos de las profundidades de esas resonancias
y aplico la interpolación a las mediciones para obtener temperaturas. y aplico la interpolación a las mediciones para obtener temperaturas.
Luego, grafico las temperaturas en función de los tiempos de calentamiento. Luego, grafico las temperaturas en función de los tiempos de calentamiento.
Now I interpolate the theoretical values of the depths of those resonances
and apply the interpolation to the measurements to obtain temperatures.
After that, I plot the temperatures with respect to the heating times
""" """
from scipy.interpolate import interp1d from scipy.interpolate import interp1d
...@@ -235,7 +284,7 @@ plt.ylabel('Temperatura (mK)') ...@@ -235,7 +284,7 @@ plt.ylabel('Temperatura (mK)')
plt.figure() plt.figure()
#plt.plot(Heating_med, Heating_tim, 'o', color='blue') #plt.plot(Heating_med, Heating_tim, 'o', color='blue')
plt.errorbar(Heating_tim, Heating_med, yerr=ErrorHeating_med, fmt='o', capsize=2, markersize=2) plt.errorbar([t*1e3 for t in Heating_tim], Heating_med, yerr=ErrorHeating_med, fmt='o', capsize=2, markersize=5)
plt.ylabel('Cuentas de DR medidas') plt.ylabel('Cuentas de DR medidas')
plt.xlabel('Heating time (s)') plt.xlabel('Heating time (s)')
...@@ -250,6 +299,7 @@ p1,p2 = curve_fit(lineal, Heating_tim_ms, Temperaturas_interpoladas) ...@@ -250,6 +299,7 @@ p1,p2 = curve_fit(lineal, Heating_tim_ms, Temperaturas_interpoladas)
#%% #%%
""" """
Grafico finalmente el plot del heating rate de la trampa Grafico finalmente el plot del heating rate de la trampa
Finally I plot the heating rate of the trap
""" """
...@@ -271,6 +321,7 @@ print(f'Heating rate: ({round(p1[0],2)} +- {round(np.sqrt(p2[0][0]),2)}) mK/ms') ...@@ -271,6 +321,7 @@ print(f'Heating rate: ({round(p1[0],2)} +- {round(np.sqrt(p2[0][0]),2)}) mK/ms')
#%% #%%
""" """
Ahora voy a ver CPT enteras con tiempos de calentamiento distintos. Ahora voy a ver CPT enteras con tiempos de calentamiento distintos.
Now I see whole CPT curves with different heating times
""" """
jvec = [3, 4] jvec = [3, 4]
...@@ -306,10 +357,14 @@ plt.ylim(1000,2900) ...@@ -306,10 +357,14 @@ plt.ylim(1000,2900)
plt.grid() plt.grid()
plt.legend() plt.legend()
#%%
""" """
La siguiente curva probablemente no este bien medida ya que inmediatamente La siguiente curva probablemente no este bien medida ya que inmediatamente
despues, los laseres se deslockearon. La dejo por las dudas. despues, los laseres se deslockearon. La dejo por las dudas.
This curve is probably not well measured...
""" """
jvec = [5, 6] jvec = [5, 6]
...@@ -330,4 +385,27 @@ plt.legend() ...@@ -330,4 +385,27 @@ plt.legend()
plt.title('Ojo: medicion condicionada por derivas') plt.title('Ojo: medicion condicionada por derivas')
#%%
"""
Ahora ploteo 6 curvas cpt para distintos valores de potencia del UV
This is a plot of 6 different cpt curves for 6 different UV powers. I should fit them
to obtain saturation parameters
"""
jvec = [7,8,9,10,11,12]
plt.figure()
for j in jvec:
plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', capsize=2, markersize=2, label='Without heating')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
#plt.ylim(1000,2900)
plt.grid()
#plt.legend()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 2 16:30:09 2020
@author: oem
"""
import os
import numpy as np
import time
import matplotlib.pyplot as plt
from scipy.signal import argrelextrema
from EITfit.MM_eightLevel_2repumps_python_scripts import CPTspectrum8levels_MM
import random
from scipy.signal import savgol_filter as sf
def PerformExperiment_8levels_MM(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=None):
"""
solvemode=1: resuelve con np.linalg.solve
solvemode=2: resuelve invirtiendo L con la funcion np.linalg.inv
"""
tinicial = time.time()
ProbeDetuningVectorL, Fluovector = CPTspectrum8levels_MM(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe, circularityprobe, beta, drivefreq, freqMin=freqMin, freqMax=freqMax, freqStep=freqStep, plot=False, solvemode=1)
tfinal = time.time()
#print('Done, Total time: ', round((tfinal-tinicial), 2), "s")
return ProbeDetuningVectorL, Fluovector
def GenerateNoisyCPT_MM(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobeVec, kg, kr, v0, drivefreq, freqMin, freqMax, freqStep, circularityprobe=1, plot=False, solvemode=1, detpvec=None, noiseamplitude=0.001):
Frequencyvector, Fluovector = PerformExperiment_8levels_MM(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobeVec, kg, kr, v0, drivefreq, freqMin, freqMax, freqStep, circularityprobe, plot=False, solvemode=1, detpvec=None)
NoisyFluovector = [fluo+noiseamplitude*(2*random.random()-1) for fluo in Fluovector]
return Frequencyvector, NoisyFluovector
def GenerateNoisyCPT_MM_fit(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobeVec, beta, drivefreq, freqs, circularityprobe=1, plot=False, solvemode=1, detpvec=None, noiseamplitude=0.001):
Frequencyvector, Fluovector = PerformExperiment_8levels_MM(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobeVec, beta, drivefreq, freqs[0], freqs[-1], freqs[1]-freqs[0], circularityprobe, plot=False, solvemode=1, detpvec=None)
NoisyFluovector = [fluo+noiseamplitude*(2*random.random()-1) for fluo in Fluovector]
return Frequencyvector, NoisyFluovector
def SmoothNoisyCPT(Fluo, window=11, poly=3):
SmoothenFluo = sf(Fluo, window, poly)
return SmoothenFluo
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 1 17:58:39 2020
@author: nico
"""
import os
import numpy as np
#os.chdir('/home/oem/Nextcloud/G_liaf/liaf-TrampaAnular/Código General/EIT-CPT/Buenos Aires/Experiment Simulations/CPT scripts/Eight Level 2 repumps')
from MM_eightLevel_2repumps_AnalysisFunctions import PerformExperiment_8levels, GenerateNoisyCPT, SmoothNoisyCPT
import matplotlib.pyplot as plt
import time
#from threeLevel_2repumps_AnalysisFunctions import MeasureRelativeFluorescenceFromCPT, IdentifyPolarizationCoincidences, RetrieveAbsoluteCoincidencesBetweenMaps, GetClosestIndex
import seaborn as sns
#C:\Users\Usuario\Nextcloud\G_liaf\liaf-TrampaAnular\Código General\EIT-CPT\Buenos Aires\Experiment Simulations\CPT scripts\Eight Level 2 repumps
ub = 9.27e-24 #magneton de bohr
h = 6.63e-34 #cte de planck
c = (ub/h)*1e-4 #en unidades de MHz/G
u = 32e6 #proportional to the magnetic field of around 5 G
B = (u/(2*np.pi))/c
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6 #anchos de linea de las transiciones
lw = 0.1 #linewidth of the lasers, 0.1 MHz are the actual linewidths of both lasers
DopplerLaserLinewidth, ProbeLaserLinewidth = lw, lw #ancho de linea de los laseres
TempVec = [1e-3, 10e-3] #Temperature vector
alpha = 0 #angle between lasers, which is zero
#Polarization angles (we can keep it fixed in 90)
phidoppler, titadoppler = 0, 90
titaprobe = 90
phiprobe = 0
#este es el desfasaje exp(i.phi) de la componente de la polarizacion y respecto a la x. Con 1 la polarizacion es lineal
CircPr = 1 #this has to do with the circularity of the polarizations and since both are linear it is one
#Simulation parameters
center = -10
span = 120
freqMin = center-span*0.5
freqMax = center+span*0.5
freqStep = 2e-1
noiseamplitude = 0 #i dont know what it is
#parametros de saturacion de los laseres. g: doppler. p: probe (un rebombeo que scanea), r: repump (otro rebombeo fijo)
"""
Good case: sg=0.6, sp=9, DetDoppler=-15
"""
DetDoppler = -15 #nice range: -30 to 0
sgvec = [0.8] #nice range: 0.1 to 10 #g is for green but is the doppler
sp = 9 #nice range: 0.1 to 20 #p is for probe but is the repump
drivefreq=2*np.pi*22.135*1e6 #ignore it
#betavec = np.arange(0,1.1,0.1) #ignore it
betavec=[0] #ignore it
alphavec = [0] #ignore it
fig1, ax1 = plt.subplots()
FrequenciesVec = []
FluorescencesVec = []
for sg in sgvec:
for T in TempVec:
for alpha in alphavec:
for beta in betavec:
Frequencies, Fluorescence = PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, titaprobe, beta, drivefreq, freqMin, freqMax, freqStep, circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
FrequenciesVec.append(Frequencies)
FluorescencesVec.append(Fluorescence)
ax1.plot(Frequencies, [100*f for f in Fluorescence], label=fr'$\alpha={int(alpha*180/np.pi)}°$')
ax1.set_xlabel('Detuning Rebombeo (MHz)')
ax1.set_ylabel('Fluorescencia (AU)')
ax1.set_title(f'Sdop: {sg}, Spr: {sp}, Temp: {int(T*1e3)} mK')
#ax1.legend()
ax1.grid()
#%%
#Este bloque ajusta a las curvas con un beta de micromocion de 0
from scipy.optimize import curve_fit
def FitEIT_MM(freqs, Temp):
BETA = 0
scale=1
offset=0
Detunings, Fluorescence = PerformExperiment_8levels(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, Temp, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA, drivefreq, freqMin, freqMax, freqStep, circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
ScaledFluo = [f*scale + offset for f in Fluorescence]
return ScaledFluo
TempMedidas = []
FittedEIT_fluosVec = []
for j in range(len(betavec)):
SelectedFluo = FluorescencesVec[j]
SelectedFreqs = FrequenciesVec[j]
popt_mm, pcov_mm = curve_fit(FitEIT_MM, SelectedFreqs, SelectedFluo, p0=[1e-3], bounds=((0), (10e-3)))
TempMedidas.append(1e3*popt_mm[2])
print(popt_mm)
FittedEIT_fluo = FitEIT_MM(SelectedFreqs, *popt_mm)
FittedEIT_fluosVec.append(FittedEIT_fluo)
plt.figure()
plt.plot(SelectedFreqs, SelectedFluo, 'o')
plt.plot(SelectedFreqs, FittedEIT_fluo)
plt.figure()
for i in range(len(FluorescencesVec)):
plt.plot(SelectedFreqs, FluorescencesVec[i], 'o', markersize=3)
plt.plot(SelectedFreqs, FittedEIT_fluosVec[i])
plt.figure()
plt.plot(betavec, TempMedidas, 'o', markersize=10)
plt.xlabel('Beta')
plt.ylabel('Temperatura medida (mK)')
plt.axhline(T*1e3, label='Temperatura real', linestyle='--', color='red')
plt.legend()
plt.grid()
\ No newline at end of file
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 barriendo angulo del TISA y viendo kicking de resonancias oscuras
#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/20230510_MotionalSpectrum/Data/')
MOTIONAL_FILES = """000011490-AD9910RAM
000011491-AD9910RAM
000011492-AD9910RAM
000011493-AD9910RAM
000011496-AD9910RAM
000011499-AD9910RAM
000011500-AD9910RAM
000011501-AD9910RAM
000011502-AD9910RAM
000011503-AD9910RAM
000011504-AD9910RAM
000011505-AD9910RAM
000011506-AD9910RAM
000011507-AD9910RAM
000011511-AD9910RAM
000011512-AD9910RAM
000011513-AD9910RAM
000011514-AD9910RAM
000011515-AD9910RAM
000011516-AD9910RAM
000011517-AD9910RAM
000011518-AD9910RAM
000011519-AD9910RAM
000011521-AD9910RAM
000011522-AD9910RAM
000011560-AD9910RAM
000011561-AD9910RAM
000011562-AD9910RAM
000011563-AD9910RAM
000011564-AD9910RAM
000011566-AD9910RAM
000011567-AD9910RAM
000011569-AD9910RAM
000011571-AD9910RAM
000011572-AD9910RAM
000011574-AD9910RAM
000011575-AD9910RAM
000011576-AD9910RAM
000011577-AD9910RAM
000011580-AD9910RAM
000011581-AD9910RAM
000011582-AD9910RAM
"""
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(MOTIONAL_FILES))
#%%
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211101_CPT_DosLaseres_v03\Data
Counts = []
RealFreqs = []
for i, fname in enumerate(MOTIONAL_FILES.split()):
print(str(i) + ' - ' + fname)
data = h5py.File(fname+'.h5', 'r')
RealFreqs.append(np.array(data['datasets']['real_freq']))
Counts.append(np.array(data['datasets']['counts']))
#%%
"""
Ploteo las curvas de referencia
"""
jvec = [29,30]
#jvec = [16]
plt.figure()
i = 0
for j in jvec:
if i==0:
plt.errorbar([1*f*1e-3 for f in RealFreqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), color='red', fmt='-o', capsize=2, markersize=2)
else:
plt.errorbar([1*f*1e-3 for f in RealFreqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='-o', capsize=2, markersize=2)
i = i + 1
plt.xlabel('Frecuencia (kHz)')
plt.ylabel('counts')
plt.xlim(851,856)
plt.ylim(600,1700)
plt.grid()
plt.legend()
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