Commit 24e382ca authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

todotodo

parent a3abe32e
......@@ -241,8 +241,38 @@ plt.legend()
plt.title('Comparacion de config colineal (insensible) con desplazada (sensible)')
#%%
"""
Ploteo una bien linda
"""
extramedvec = [1]
#AmpsVecs = [0.05, 0.08, 0.12, 0.17, 0.22]
plt.figure()
ftrap = 22.1
DR1 = 435.8
DR2 = 444.2
freqDR=435.8
secular=False
plt.plot([2*f*1e-6 for f in ExtraIR1_Freqs[1][1:]], [1e-3*c for c in ExtraCounts[1][1:]], '-o', markersize=2, label='Colineales')
plt.xlabel('Frequency (MHz)', fontname='STIXgeneral',fontsize=15)
plt.ylabel('kCounts',fontname='STIXgeneral',fontsize=15)
plt.xlim(425, 455)
plt.yticks([1,1.5,2,2.5,3],fontname='STIXgeneral',fontsize=15)
plt.xticks([425,430,435,440,445,450,455],fontname='STIXgeneral',fontsize=15)
plt.ylim(1.,3.2)
plt.grid()
plt.tight_layout()
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/DDresonancesexperimental.pdf')
#plt.legend()
#plt.title('Comparacion de config colineal (insensible) con desplazada (sensible)')
#%%
......
......@@ -356,6 +356,8 @@ pmlocmedvec = [7]
mmlocmedvec = [0]
fi = 440
paletita = sns.color_palette('rocket')
plt.figure()
......@@ -366,7 +368,7 @@ for med in mmlocmedvec:
print(Countsmm)
NormCountsmm = normalizeplot(Freqsmm, Countsmm, skip=0)
NormCountsmm[97]=1
plt.plot(Freqsmm, NormCountsmm, '-o', color=paletita[jj], markersize=2, alpha=1, label='+2/+2')
plt.plot([f-fi for f in Freqsmm], NormCountsmm, '-o', color=paletita[jj], markersize=2, alpha=1, label='+2/+2')
#plt.plot(Freqs, sf(NormCounts,5,2), 'o', color=palette[jj], markersize=2, label=f'{LocVecs[jj]}')
#plt.plot([2*f*1e-6 for f in PmFrequencies[med][1:]][idxtest], [c for c in PmCounts[med][1:]][idxtest], 'o', color=palette[med],markersize=14, label=f'{LocVecs[jj]}')
jj=jj+1
......@@ -381,7 +383,7 @@ for med in pmlocmedvec:
NormCountspm[214]=1
NormCountspm[285]=1
NormCountspm[293]=1
plt.plot(Freqspm, NormCountspm, '-o', color=paletita[jj+2], markersize=2, alpha=1, label='+2/-2')
plt.plot([f-fi for f in Freqspm], NormCountspm, '-o', color=paletita[jj+2], markersize=2, alpha=1, label='+2/-2')
#plt.plot(Freqs, sf(NormCounts,5,2), 'o', color=palette[jj], markersize=2, label=f'{LocVecs[jj]}')
#plt.plot([2*f*1e-6 for f in PmFrequencies[med][1:]][idxtest], [c for c in PmCounts[med][1:]][idxtest], 'o', color=palette[med],markersize=14, label=f'{LocVecs[jj]}')
jj=jj+1
......@@ -389,11 +391,17 @@ for med in pmlocmedvec:
#plt.ylim(0,1.2)
plt.xlabel('IR1 Frequency (MHz)',fontsize=14,fontname='STIXgeneral')
plt.ylabel('Normalized Counts',fontsize=14,fontname='STIXgeneral')
plt.xlabel('IR1 Frequency (MHz)',fontsize=15,fontname='STIXgeneral')
plt.ylabel('Normalized Counts',fontsize=15,fontname='STIXgeneral')
plt.xticks([-10,-5,0,5,10],fontname='STIXgeneral',fontsize=18)
plt.yticks([0.4,0.6,0.8,1],fontname='STIXgeneral',fontsize=18)
plt.ylim(0.3,1.1)
plt.xlim(-10,7)
plt.grid()
plt.tight_layout()
plt.legend(fontsize=14,markerscale=5)
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/sensitivityofparalellantiparalell.pdf')
......
......@@ -12,7 +12,7 @@ from scipy import interpolate
#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/20230817_RotationalDopplerShift_v5/Data')
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230817_RotationalDopplerShift_v5/Data')
"""
......
......@@ -12,7 +12,7 @@ from scipy import interpolate
#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/20230817_RotationalDopplerShift_v5/Data')
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230817_RotationalDopplerShift_v5/Data')
"""
......@@ -80,11 +80,16 @@ def ErrorDRdepth(p, f, b):
derivadab = ((p-f)/((f-b)**2))**2
return 1*np.sqrt(derivadap*ep*ep + derivadaf*ef*ef + derivadab*eb*eb)
def Lorentzian( x, A, B, x0, gam,C):
#C=0
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x - x0)
#%%
import seaborn as sns
"""
Resonancias DD configuracion +2/-2 colineal variando la ubicacion del ion en los haces
Resonancias DD configuracion -2/-2 colineal variando la ubicacion del ion en los haces
TODO EL OAM
"""
......@@ -151,6 +156,98 @@ for med in pmlocmedvec:
# #plt.title('Espectros para distintas geometrías')
plt.figure()
plt.errorbar(np.arange(0,len(Intensity),1), [i/np.max(Intensity) for i in Intensity], yerr=[i/np.max(Intensity) for i in errorIntensity], fmt='o',capsize=2, markersize=8)
plt.errorbar(np.arange(0,len(Intensity),1), [p for p in pmdepthsdr], yerr=errorpmdepthsdr, fmt='o',capsize=2, markersize=8)
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
#plt.xlim(200,3200)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
#%%
import seaborn as sns
"""
Resonancias DD configuracion +2/-2 colineal variando la ubicacion del ion en los haces
Mismo analisis pero con fiteos
"""
palette = sns.color_palette("tab10")
pmlocmedvec = list(np.arange(0,12,1))+[13,12]+list(np.arange(15,len(PIEZO1_FILES),1))
"""
Hay que invertir la 12 con la 13, y la 14 es la misma que la 12, por las dudas
"""
#pmlocmedvec = [30]
plt.figure()
bkg = np.min(Piezo1Counts[1])
pmdepthsdr=[]
errorpmdepthsdr=[]
Intensity = []
errorIntensity = []
idxtest = 185
print(idxtest)
Gamas = []
ErrorGamas = []
jj=0
for med in pmlocmedvec:
print(med)
Freqs = [2*f*1e-6 for f in Piezo1Frequencies[med][1:]]
Counts = [c for c in Piezo1Counts[med][1:]]
if med==30:
Freqs=Freqs[90:]
Counts=Counts[90:]
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1e4)))
else:
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1e4)))
pmdepthsdr.append(1-(np.min(Lorentzian(np.array(Freqs),*popt))-bkg)/(popt[1]-bkg))
#pmdepthsdr.append(1-(Piezo1Counts[med][1:][idxvecdr[jj]]-bkg)/(np.mean(Piezo1Counts[med][1:][0:20])-bkg))
#errorpmdepthsdr.append(ErrorDRdepth(Piezo1Counts[med][1:][idxvecdr[jj]],np.mean(Piezo1Counts[med][1:][0:20]), bkg))
errorpmdepthsdr.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
Intens = popt[1]
Gamas.append(popt[3])
ErrorGamas.append(np.sqrt(pcov[3,3]))
Intensity.append(Intens)
errorIntensity.append(2*np.sqrt(np.mean(Piezo1Counts[med][1:][0:20]))+np.sqrt(bkg))
plt.plot([2*f*1e-6 for f in Piezo1Frequencies[med][1:]], [c for c in Piezo1Counts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot([f*1 for f in Freqs],Lorentzian(Freqs,*popt))
#plt.plot([2*f*1e-6 for f in Piezo1Frequencies[med][1:]][idxtest], [c for c in Piezo1Counts[med][1:]][idxtest], 'o',markersize=14)
jj=jj+1
# plt.xlabel('Frecuencia (MHz)')
# plt.ylabel('Counts')
# plt.xlim(432, 446.5)
# plt.grid()
# plt.legend()
# #plt.title('Espectros para distintas geometrías')
plt.figure()
plt.errorbar(np.arange(0,len(Intensity),1), [i/np.max(Intensity) for i in Intensity], yerr=[i/np.max(Intensity) for i in errorIntensity], fmt='o',capsize=2, markersize=8)
plt.errorbar(np.arange(0,len(Intensity),1), [p for p in pmdepthsdr], yerr=errorpmdepthsdr, fmt='o',capsize=2, markersize=8)
......@@ -170,6 +267,8 @@ import seaborn as sns
Resonancias DD configuracion +2/+2 colineal variando la ubicacion del ion en los haces
TODO EL OAM
esto es hecho a mano... se puede ignorar
"""
palette = sns.color_palette("tab10")
......@@ -238,21 +337,139 @@ plt.legend()
#%%
import seaborn as sns
"""
Resonancias DD configuracion +2/+2 colineal variando la ubicacion del ion en los haces
TODO EL OAM
AHORA CON FITEOS LPM
"""
palette = sns.color_palette("tab10")
mmlocmedvec = list(np.arange(0,10,1))+[11,10]+list(np.arange(12,len(PIEZO2_FILES),1))
"""
s
"""
plotcurvita=1
#mmlocmedvec = [37]
plt.figure()
plt.errorbar(np.arange(0,len(Intensity),1), [i/np.max(Intensity) for i in Intensity], yerr=[i/np.max(Intensity) for i in errorIntensity], fmt='o',capsize=2, markersize=8)
plt.errorbar(np.arange(0,len(Intensity),1), [p for p in pmdepthsdr], yerr=errorpmdepthsdr, fmt='o',capsize=2, markersize=8)
plt.errorbar(np.arange(0,len(Intensity),1), [p for p in mmdepthsdr[3:]], yerr=[0.5*m for m in errormmdepthsdr[3:]], fmt='o',capsize=2, markersize=8)
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
bkg = np.min(Piezo2Counts[1])
mmdepthsdr=[]
errormmdepthsdr=[]
Intensity2 = []
errorIntensity2 = []
print(idxtest)
jj=0
for med in mmlocmedvec:
print(med)
Freqs = [2*f*1e-6 for f in Piezo2Frequencies[med][1:]]
Counts = [c for c in Piezo2Counts[med][1:]]
if med==18:
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,210,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1e4)))
else:
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1e4)))
mmdepthsdr.append(1-(np.min(Lorentzian(np.array(Freqs),*popt))-bkg)/(popt[1]-bkg))
errormmdepthsdr.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
Intens = popt[1]
Gamas.append(popt[3])
ErrorGamas.append(np.sqrt(pcov[3,3]))
Intensity2.append(Intens)
errorIntensity.append(2*np.sqrt(np.mean(Piezo2Counts[med][1:][0:20]))+np.sqrt(bkg))
plt.plot([2*f*1e-6 for f in Piezo2Frequencies[med][1:]], [c for c in Piezo2Counts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot([f*1 for f in Freqs],Lorentzian(Freqs,*popt))
# plt.plot([2*f*1e-6 for f in Piezo2Frequencies[med][1:]], [c for c in Piezo2Counts[med][1:]], '-o', markersize=2, alpha=0.7)
# plt.plot([2*f*1e-6 for f in Piezo2Frequencies[med][1:]][idxtest], [c for c in Piezo2Counts[med][1:]][idxtest], 'o',markersize=14)
jj=jj+1
# plt.xlabel('Frecuencia (MHz)')
# plt.ylabel('Counts')
# plt.xlim(432, 446.5)
# plt.grid()
# plt.legend()
# #plt.title('Espectros para distintas geometrías')
if plotcurvita:
plt.figure()
#plt.errorbar(np.arange(0,len(Intensity2),1), [i/np.max(Intensity2) for i in Intensity2], yerr=[i/np.max(Intensity2) for i in errorIntensity2], fmt='o',capsize=2, markersize=8)
plt.errorbar(np.arange(0,len(Intensity2),1), [p for p in mmdepthsdr], yerr=errormmdepthsdr, fmt='o',capsize=2, markersize=8)
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
#plt.xlim(200,3200)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
#%%
"""
graficos de:
1) intensidad del haz
2) profundidad de las resonancias en caso +2/+2 y en caso +2/-2
"""
import seaborn as sns
paletadenico=sns.color_palette('rocket')
plt.figure()
plt.errorbar(np.arange(-16,18,1), [i/np.max(Intensity) for i in Intensity], yerr=[i/np.max(Intensity) for i in errorIntensity], fmt='o',capsize=2, markersize=8,color=paletadenico[1])
#plt.errorbar(np.arange(0,len(Intensity),1), [p for p in pmdepthsdr], yerr=errorpmdepthsdr, fmt='o',capsize=2, markersize=8)
#plt.errorbar(np.arange(0,len(Intensity),1), [p for p in mmdepthsdr[3:]], yerr=[0.5*m for m in errormmdepthsdr[3:]], fmt='o',capsize=2, markersize=8)
plt.xlabel('Distance to center (motor steps)', fontname='STIXgeneral',fontsize=15)
plt.ylabel('Beam intensity', fontname='STIXgeneral',fontsize=15)
plt.xticks([-15,-10,-5,0,5,10,15], fontname='STIXgeneral',fontsize=15)
plt.yticks([0,0.2,0.4,0.6,0.8,1], fontname='STIXgeneral',fontsize=15)
#plt.xlim(200,3200)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
plt.tight_layout()
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/beamintensityradial.pdf')
#%%
plt.figure()
#plt.errorbar(np.arange(0,len(Intensity),1), [i/np.max(Intensity) for i in Intensity], yerr=[i/np.max(Intensity) for i in errorIntensity], fmt='o',capsize=2, markersize=8)
plt.errorbar(np.arange(-16,18,1), [p for p in pmdepthsdr], yerr=errorpmdepthsdr, fmt='o',capsize=2, markersize=8,color=paletadenico[3])
plt.errorbar(np.arange(-16,18,1), [p for p in mmdepthsdr[2:-1]], yerr=[1*m for m in errormmdepthsdr[2:-1]], fmt='o',capsize=2, markersize=8,color=paletadenico[0])
plt.xlabel('Distance to center (motor steps)', fontname='STIXgeneral',fontsize=15)
plt.ylabel('DR Relative depth', fontname='STIXgeneral',fontsize=15)
plt.xticks([-15,-10,-5,0,5,10,15], fontname='STIXgeneral',fontsize=15)
plt.yticks([0,0.2,0.4,0.6,0.8,1], fontname='STIXgeneral',fontsize=15)
#plt.xlim(200,3200)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
plt.tight_layout()
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/depthsradial.pdf')
#%%
"""
Intento ajustar un modelo para la profundidad
......
......@@ -95,7 +95,7 @@ palette = sns.color_palette("tab10")
pmlocmedvec = np.arange(0,len(PIEZOAZ_FILES),1)
#pmlocmedvec = [14]
#pmlocmedvec = [15]
FullCurve = True
Angles = np.arange(0,360,22.5)
......@@ -155,23 +155,28 @@ print('')
print(popt)
AnglesLong = np.arange(-10,370,1)
#%%
if FullCurve:
plt.figure()
plt.errorbar(Angles, [p for p in pmdepthsdraz], yerr=errorpmdepthsdraz, color='violet', fmt='o', capsize=3, markersize=8, zorder=0)
plt.errorbar(Angles, [p for p in pmdepthsdraz], yerr=[1*e for e in errorpmdepthsdraz], color='violet', fmt='o', capsize=3, markersize=8, zorder=0)
plt.plot(AnglesLong,SinFit(AnglesLong,*popt), color='indigo', linewidth=4)
indang = find_nearest(SinFit(AnglesLong,*popt), np.min(SinFit(AnglesLong,*popt)))
plt.axvline(AnglesLong[indang])
plt.xlabel('Azimuthal angle (°)')
plt.ylabel('DR Relative depth')
#plt.xticks([1,2,3,4,5])
plt.axvline(74,linestyle='dashed')
#plt.axvline(AnglesLong[indang])
plt.xlabel('Azimuthal angle (°)',fontname='STIXgeneral',fontsize=14)
plt.ylabel('DR Relative depth',fontname='STIXgeneral',fontsize=14)
plt.xticks([0,50,100,150,200,250,300,350],fontname='STIXgeneral',fontsize=14)
plt.yticks([0.1,0.2,0.3,0.4,0.5],fontname='STIXgeneral',fontsize=14)
#plt.xlim(200,3200)
#plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/varyingazimut.pdf')
#%%
"""
Ahora voy a intentar ajustarlas con una lorentziana que es mejor
......
......@@ -46,8 +46,8 @@ def SeeKeys(files):
print(fname)
print(list(data['datasets'].keys()))
def Lorentzian( x, A, B, x0, gam):
C=0
def Lorentzian( x, A, B, x0, gam,C):
#C=0
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x - x0)
......@@ -608,7 +608,7 @@ pmlocmedvec = np.arange(0,len(HS_FILES),1)
#pmlocmedvec = [-2, -1]
plt.figure()
plt.figure(figsize=(7,8))
#bkg = np.min(PiezoS1Counts[5])
bkg=200
......@@ -642,16 +642,19 @@ for med in pmlocmedvec:
# Intensityver.append(Intens)
# errorIntensity.append(2*np.sqrt(np.mean(Piezo1Counts[med][1:][0:20]))+np.sqrt(bkg))
fi=775
if med not in [800]:
plt.plot([2*f*1e-6 for f in PiezoHSFrequencies[med][1:]], [c for c in PiezoHSCounts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot([f for f in Freqs],Lorentzian(Freqs,*popt))
plt.plot([1e3*(2*f*1e-6-435)-fi for f in PiezoHSFrequencies[med][1:]], [1e-3*c for c in PiezoHSCounts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot([1e3*(f-435)-fi for f in Freqs],[l*1e-3 for l in Lorentzian(Freqs,*popt)],linewidth=5)
jj=jj+1
# plt.xlabel('Frecuencia (MHz)')
# plt.ylabel('Counts')
#plt.xlim(435.2, 436.5)
plt.xlabel('Frequency (kHz)',fontname='STIXgeneral',fontsize=50)
plt.ylabel('kCounts',fontname='STIXgeneral',fontsize=50)
plt.xticks([-50,-25,0,25,50],fontname='STIXgeneral',fontsize=35)
plt.yticks([3.5,4,4.5],fontname='STIXgeneral',fontsize=35)
plt.tight_layout()
plt.grid()
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/DDresonancesexperimental_fine.pdf')
# plt.legend()
plt.title(f'Ancho: {round(1e3*popt[3],2)} kHz')
#plt.title(f'Ancho: {round(1e3*popt[3],2)} kHz')
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 1 17:58:39 2020
@author: oem
"""
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 threeLevel_2repumps_AnalysisFunctions import CalculoTeoricoDarkResonances_8levels, GetMinimaInfo, GetPlotsofFluovsAngle_8levels, PerformExperiment_8levels, FindDRFrequencies, FindRelativeFluorescencesOfDR, GenerateNoisyCPT, SmoothNoisyCPT, GetFinalMaps, GenerateNoisyCPT_fixedRabi, GenerateNoisyCPT_fit
import matplotlib.pyplot as plt
import time
from threeLevel_2repumps_AnalysisFunctions import MeasureRelativeFluorescenceFromCPT, IdentifyPolarizationCoincidences, RetrieveAbsoluteCoincidencesBetweenMaps, GetClosestIndex
#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
h = 6.63e-34
c = (ub/h)*1e-4 #en unidades de MHz/G
#u = 1e6
u = 33.5e6
B = (u/(2*np.pi))/c
#sg, sp = 0.6, 5 #parámetros de control, saturación del doppler y repump
#rabG, rabP = sg*gPS, sp*gPD #frecuencias de rabi
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6 #anchos de linea de las transiciones
lw = 0.1
DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth = lw, lw, lw #ancho de linea de los laseres
DetDoppler = -36 #42
DetRepumpVec = [DetDoppler+29.6]
Tvec = [0.7] #temperatura en mK
alpha = 0*(np.pi/180) #angulo entre los láseres
phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0, 0
phiprobe = 0
titaprobe = 90
#Calculo las resonancias oscuras teóricas
#ResonanciasTeoricas, DRPositivas = CalculoTeoricoDarkResonances_8levels(u/(2*np.pi*1e6), titadoppler, DetDoppler, DetRepump)
#Parametros de la simulacion cpt
center = -45
span = 80
freqMin = center-span*0.5
freqMax = center+span*0.5
""" parametros para tener espectros coherentes
freqMin = -56
freqMax = 14
"""
freqStep = 1e-1
noiseamplitude = 0
RelMinMedido0Vector = []
RelMinMedido1Vector = []
RelMinMedido2Vector = []
RelMinMedido3Vector = []
RelMinMedido4Vector = []
#Sr = np.arange(0, 10, 0.2)
#Sg = np.arange(0.01, 1, 0.05)
#Sp = np.arange(0.1, 6.1, 1)
#Sg = [0.6**2]
#Sp = [2.3**2]
Sg = [1.4]
Sp = [6]
Sr = [11]
i = 0
save = False
showFigures = True
if not showFigures:
plt.ioff()
else:
plt.ion()
fig1, ax1 = plt.subplots()
offsetx = 464
ax1.plot([f-offsetx for f in FreqsDR], CountsDR, 'o')
run = True
Scale = 730
Offset = 600 #600 para 20k cuentas aprox
MaxCoherenceValue = []
for sg in Sg:
for sp in Sp:
rabG, rabP = sg*gPS, sp*gPD
for Ti in Tvec:
T = Ti*1e-3
for DetRepump in DetRepumpVec:
print(T)
for sr in Sr:
rabR = sr*gPD
#MeasuredFreq, MeasuredFluo = GenerateNoisyCPT(rabG, rabR, rabP, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqMin, freqMax, freqStep, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
if run:
MeasuredFreq4, MeasuredFluo4 = GenerateNoisyCPT_fixedRabi(sg, sr, sp, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqMin, freqMax, freqStep, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
#SmoothFluo = SmoothNoisyCPT(MeasuredFluo, window=9, poly=2)
SmoothFluo4 = MeasuredFluo4
#Scale = max(BestC)/max([100*s for s in SmoothFluo4])
ax1.plot(MeasuredFreq4, [Scale*100*f + Offset for f in SmoothFluo4], label=f'Sr = {sr}')
ax1.axvline(DetDoppler, linestyle='--', linewidth=1)
#if sr != 0:
#ax1.axvline(DetRepump, linestyle='--', linewidth=1)
MaxCoherenceValue.append(np.max(SmoothFluo4))
#print(titaprobe)
ax1.set_xlabel('Detuning Rebombeo (MHz)')
ax1.set_ylabel('Fluorescencia (AU)')
ax1.set_title(f'B: {round(B, 2)} G, Sdop: {round(sg, 2)}, Sp: {round(sp, 2)}, Sr: {round(sr, 2)}, lw: {lw} MHz, T: {Ti} mK')
#ax1.set_ylim(0, 8)
#ax1.axvline(DetDoppler, linestyle='dashed', color='red', linewidth=1)
#ax1.axvline(DetRepump, linestyle='dashed', color='black', linewidth=1)
#ax1.set_title('Pol Doppler y Repump: Sigma+ Sigma-, Pol Probe: PI')
#ax1.legend()
ax1.grid()
print (f'{i+1}/{len(Sg)*len(Sp)}')
i = i + 1
if save:
plt.savefig(f'Mapa_plots_100k_1mk/CPT_SMSM_sdop{round(sg, 2)}_sp{round(sp, 2)}_sr{round(sr, 2)}.jpg')
ax1.legend()
"""
plt.figure()
plt.plot(Sr, MaxCoherenceValue, 'o')
plt.xlabel('Sr')
plt.ylabel('Coherence')
"""
"""
plt.figure()
plt.plot(MeasuredFreq, [100*f for f in SmoothFluo], color='darkred')
plt.xlabel('Desintonía 866 (MHz)')
plt.ylabel('Fluorescencia (A.U.)')
plt.axvline(-30, color='darkblue', linewidth=1.2, linestyle='--')
plt.yticks(np.arange(0.4, 1.8, 0.2))
plt.ylim(0.5, 1.6)
plt.grid()
plt.figure()
plt.plot(MeasuredFreq4, [100*f for f in SmoothFluo4], color='darkred')
plt.xlabel('Desintonía 866 (MHz)')
plt.ylabel('Fluorescencia (A.U.)')
plt.axvline(-30, color='darkblue', linewidth=1.2, linestyle='--')
plt.yticks(np.arange(0.8, 2.4, 0.4))
plt.grid()
"""
#%%
from scipy.optimize import curve_fit
T = 0.5e-3
sg = 0.7
sp = 6
sr = 0
DetDoppler = -14
DetRepump = 0
FitsSp = []
FitsOffset = []
Sg = [0.87]
def FitEIT(freqs, SP, offset):
MeasuredFreq, MeasuredFluo = GenerateNoisyCPT_fit(0.87, sr, SP, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqs, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
FinalFluo = [f*43000 + 2685 for f in MeasuredFluo]
return FinalFluo
freqs = [f-offsetx+32 for f in FreqsDR]
freqslong = np.arange(min(freqs), max(freqs)+freqs[1]-freqs[0], 0.1*(freqs[1]-freqs[0]))
popt, pcov = curve_fit(FitEIT, freqs, CountsDR, p0=[5, 700], bounds=(0, [10, 1e6]))
FitsSp.append(popt[0])
FitsOffset.append(popt[1])
print(popt)
FittedEIT = FitEIT(freqslong, *popt)
plt.figure()
plt.errorbar(freqs, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', capsize=2, markersize=2)
plt.plot(freqslong, FitEIT(freqslong, *popt))
plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {T*1e3} mK, detDop: {DetDoppler} MHz')
np.savetxt('CPT_measured.txt', np.transpose([freqs, CountsDR]))
np.savetxt('CPT_fitted.txt', np.transpose([freqslong, FittedEIT]))
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/20230912_RotationalDopplerShift_v7/Data')
"""
en este codigo ploteo espectros CPT de resonancias D-D para configuracion +2/+2 y +2/-2 (usando pentaprisma)
"""
def find_nearest(array, value):
array = np.asarray(array)
idx = (np.abs(array - value)).argmin()
return idx
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
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()))
def Lorentzian( x, A, B, x0, gam,C):
#C=0
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x - x0)
def Lorentzian2( x, A, B, x0, gam):
C=0
A=0
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x - x0)
Piezo1Counts = []
Piezo1Frequencies = []
PIEZOS1_FILES = [59,60,62,63,64,65,66,70,71,72,75,76,77,78,79,80,81,82]
for i in PIEZOS1_FILES:
#print(str(i) + ' - ' + fname)
if i < 100 and i > 9:
data = h5py.File(f'VaryingBeamsize/Size1/0000159{i}-IR_Scan_withcal_optimized'+'.h5', 'r')
elif i <= 9:
data = h5py.File(f'VaryingBeamsize/Size1/00001570{i}-IR_Scan_withcal_optimized'+'.h5', 'r')
else:
data = h5py.File(f'VaryingBeamsize/Size4vertical/000015{i}-IR_Scan_withcal_optimized'+'.h5', 'r')
Piezo1Counts.append(np.array(data['datasets']['counts_spectrum']))
Piezo1Frequencies.append(np.array(data['datasets']['IR1_Frequencies']))
def ErrorDRdepth(p, f, b):
ep = np.sqrt(p)
ef = np.sqrt(f)
eb = np.sqrt(b)
derivadap = 1/((f-b)**2)
derivadaf = ((p-b)/((f-b)**2))**2
derivadab = ((p-f)/((f-b)**2))**2
return 2*np.sqrt(derivadap*ep*ep + derivadaf*ef*ef + derivadab*eb*eb)
#%%
"""
Ahora voy a intentar ajustarlas con una lorentziana que es mejor
"""
import seaborn as sns
"""
Resonancias DD configuracion +2/-2 colineal variando la ubicacion del ion en los haces
Moviendo VERTICALMENTE el haz, pasos de a 50 (updated), lente 200 mm, haz chiquito
"""
power=1
palette = sns.color_palette("tab10")
pmlocmedvec2 = np.arange(0,len(PIEZOS1_FILES),1)
pmlocmedvec2 = [0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18]
#pmlocmedvec2 = []
plotcurvita = 1
plt.figure()
bkg=np.mean(Piezo1Counts[2][64:70])
pmdepthsdrver2=[]
errorpmdepthsdrver2=[]
Intensityver2 = []
errorIntensityver2 = []
Gamas2 = []
ErrorGamas2 = []
jj=0
for med in pmlocmedvec2:
if power==0:
Freqs = [2*f*1e-6 for f in Piezo1Frequencies[med][1:]]
Counts = [c for c in Piezo1Counts[med][1:]]
else:
Freqs = [2*f*1e-6 for f in Piezo1Frequencies[med][1:]]
Counts = [c for c in Piezo1Counts[med][1:]]
if med == 7:
Counts = Counts[20:]
Freqs= Freqs[20:]
# popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-265,1700,435.5,0.,0), bounds=((-10000,0,435.,0,0),(0,1e4, 436, 100,1)))
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1)))
if med == 8:
Counts = Counts[20:]
Freqs= Freqs[20:]
# popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-265,1700,435.5,0.,0), bounds=((-10000,0,435.,0,0),(0,1e4, 436, 100,1)))
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1)))
elif med == 2:
Counts = Counts[0:60]
Freqs= Freqs[0:60]
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,21000,435.8,0.5,0), bounds=((-10000,0,435.5,0.0005,0),(0,1e8, 436.1, 1,1e3)))
elif med == 10:
Counts = Counts[20:]
Freqs= Freqs[20:]
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,21000,435.8,0.05,0), bounds=((-10000,0,435.5,0,0),(0,1e8, 436.1, 1,1e3)))
elif med == 1114:
# Counts = Counts[50:150]
# Freqs= Freqs[50:150]
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,21000,435.8,0.05,0), bounds=((-10000,0,435.5,0,0),(0,1e4, 436.1, 1,1e4)))
else:
popt, pcov = curve_fit(Lorentzian, np.array(Freqs), np.array(Counts), p0=(-200,21000,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,0),(0,1e8, 436.1, 1,1e4)))
if med==0:
pmdepthsdrver2.append(1-(np.min(Lorentzian(np.array(Freqs),*popt))-bkg)/(popt[1]-bkg))
#errorpmdepthsdrver1.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
errorpmdepthsdrver2.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
else:
pmdepthsdrver2.append(1-(np.min(Lorentzian(np.array(Freqs),*popt))-bkg)/(popt[1]-bkg))
#errorpmdepthsdrver1.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
errorpmdepthsdrver2.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
Intens2 = popt[1]
Gamas2.append(popt[3])
ErrorGamas2.append(np.sqrt(pcov[3,3]))
Intensityver2.append(Intens2)
# errorIntensity.append(2*np.sqrt(np.mean(Piezo1Counts[med][1:][0:20]))+np.sqrt(bkg))
if med not in [1000]:
if power==0:
plt.plot([2*f*1e-6 for f in Piezo1Frequencies[med][1:]], [c for c in Piezo1Counts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot([f*1 for f in Freqs],Lorentzian(Freqs,*popt))
else:
plt.plot([2*f*1e-6 for f in Piezo1Frequencies[med][1:]], [c for c in Piezo1Counts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot([f*1 for f in Freqs],Lorentzian(Freqs,*popt))
plt.axhline(bkg,linestyle='dashed',color='k')
jj=jj+1
plt.grid()
if plotcurvita:
plt.figure()
plt.errorbar(np.arange(0,len(Intensityver2),1), [i/np.max(Intensityver2) for i in Intensityver2], yerr=np.sqrt(Intensityver2)/np.max(Intensityver2), fmt='-o', capsize=3,markersize=8)
plt.errorbar(np.arange(0,len(Intensityver2),1), [p for p in pmdepthsdrver2], yerr= errorpmdepthsdrver2, fmt='o', capsize=3, markersize=8)
#plt.errorbar(np.arange(0,len(Intensityver2),1), [p for p in Gamas2], yerr=ErrorGamas2, fmt='o', capsize=3, markersize=8)
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
#plt.xlim(200,3200)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
# plt.figure()
# plt.errorbar(np.arange(0,len(Intensityver1)-1,1), [p*1e3 for p in Gamas1[1:]], yerr=[e*1e3 for e in ErrorGamas1[1:]], fmt='o', capsize=3, markersize=3)
# plt.yscale('log')
# plt.grid()
# plt.yticks([1e3, 1e2, 1e1])
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