Commit acd9de75 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto
parents 49e4081a f34e7f4e
......@@ -12,8 +12,8 @@ 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/20230804_RotationalDopplerShift_v2/Data')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230804_RotationalDopplerShift_v2/Data')
os.chdir('C://Users//nicon//Doctorado//artiq_experiments//analisis//plots//20230804_RotationalDopplerShift_v2//Data')
"""
......@@ -201,6 +201,7 @@ plt.title('Variando potencia de IR2 para potencia de IR1 fija')
#%%
"""
FIG PARA PAPER
Comparo resonancias DD con haces OAM en config colineal con desplazada
"""
......@@ -270,7 +271,7 @@ 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.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/DDresonancesexperimental.pdf')
#plt.legend()
#plt.title('Comparacion de config colineal (insensible) con desplazada (sensible)')
......
......@@ -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/20230804_RotationalDopplerShift_v2/Data')
#os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230804_RotationalDopplerShift_v2/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/20230815_RotationalDopplerShift_v3/Data')
os.chdir('C://Users//nicon//Doctorado//artiq_experiments//analisis//plots//20230815_RotationalDopplerShift_v3//Data')
......
......@@ -14,7 +14,9 @@ from scipy import interpolate
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20230817_RotationalDopplerShift_v4/Data')
"""
ACA HAY FIGURAS PARA PAPER
"""
"""
en este codigo ploteo espectros CPT de resonancias D-D para configuracion +2/+2 y +2/-2 (usando pentaprisma)
......@@ -275,26 +277,16 @@ Grafico ahora dos gráficos que se vean 3 curvas con buena estadística para mos
"""
from scipy.optimize import curve_fit
from scipy.signal import savgol_filter as sf
import seaborn as sns
from scipy.optimize import curve_fit
def Lorentzian( x, A, B, x0, gam):
B=1
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B
def linealfunc(x,a,b):
return a*x+b
def remove_outliers(array):
"""
work in progress...
"""
array2 = []
threshold = 300
for jj in range(len(array)):
if jj == len(array)-1:
array2.append(array[jj])
else:
if np.abs(array[jj+1]-array[jj])<threshold:
array2.append(array[jj])
else:
array2.append((array[jj+3]+array[jj])*0.5)
return array2
def normalizeplot(xvec, yvec,skip=0):
i_1, i_2, i_3, i_4 = 0, 20, -10-skip, -1-skip
popt, pcov = curve_fit(linealfunc, list(xvec[i_1:i_2])+list(xvec[i_3:i_4]), list(yvec[i_1:i_2])+list(yvec[i_3:i_4]))
......@@ -307,48 +299,81 @@ def normalizeplot(xvec, yvec,skip=0):
#pmlocmedvec = [7,2,0,4,3,5,1]
palette = sns.color_palette("mako",3)
pmlocmedvec = [3,5,7]
mmlocmedvec = [0,1,2]
plt.figure()
plotpm = 1
plotmm = 0
plt.figure(figsize=(2.5,2.1))
plotpm = 0
plotmm = 1
generalscale = 0.7
freqslong = np.arange(-5,5,0.01)
if plotpm:
jj=0
for med in pmlocmedvec:
Freqspm = [2*f*1e-6 for f in PmFrequencies[med][1:]]
if med==3:
Freqspm = [2*f*1e-6-435.72 for f in PmFrequencies[med][1:]]
elif med==5:
Freqspm = [2*f*1e-6-435.67 for f in PmFrequencies[med][1:]]
elif med==7:
Freqspm = [2*f*1e-6-435.87 for f in PmFrequencies[med][1:]]
Countspm = [c-120 for c in PmCounts[med][1:]]
NormCountspm = normalizeplot(Freqspm, Countspm)
plt.plot(Freqspm, NormCountspm, '-o', color=palette[jj], markersize=2, alpha=1, label=f'{LocVecs[jj]}')
#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]}')
if med==5:
NormCountspm[112]=0.95
NormCountspm[113]=0.95
plt.plot(Freqspm, [n*generalscale+1-generalscale for n in NormCountspm], 'o', color=palette[jj], markersize=4, alpha=0.6, label=f'{LocVecs[jj]}')
popt,pcov = curve_fit(Lorentzian,Freqspm,NormCountspm)
plt.plot(freqslong,[n*generalscale+1-generalscale for n in Lorentzian(freqslong,*popt)], color=palette[jj],linewidth=3)
jj=jj+1
if plotmm:
jj=0
for med in mmlocmedvec:
Freqsmm = [2*f*1e-6 for f in HS_MmFrequencies[med][1:-8]]
Freqsmm = [2*f*1e-6-435.75 for f in HS_MmFrequencies[med][1:-8]]
Countsmm = [c-120 for c in HS_MmCounts[med][1:-8]]
NormCountsmm = normalizeplot(Freqsmm, Countsmm, skip=0)
plt.plot(Freqsmm, NormCountsmm, '-o', color=palette[jj], markersize=2, alpha=1, label=f'{LocVecs[jj]}')
#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]}')
if med==0:
NormCountsmm[97]=0.95
if med==2:
NormCountsmm[103]=0.95
plt.plot(Freqsmm, [n*generalscale+1-generalscale for n in NormCountsmm], 'o', color=palette[jj], markersize=4, alpha=0.6, label=f'{LocVecs[jj]}')
popt,pcov = curve_fit(Lorentzian,Freqsmm,NormCountsmm)
plt.plot(freqslong,[n*generalscale+1-generalscale for n in Lorentzian(freqslong,*popt)], color=palette[jj],linewidth=3)
jj=jj+1
#plt.ylim(0,1.2)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Normalized Counts')
#plt.ylim(412,2500)
plt.xlim(-3,3)
plt.xlabel('Frequency (MHz)',fontname='STIXgeneral',fontsize=10)
plt.ylabel('DR Relative depth',fontname='STIXgeneral',fontsize=10)
plt.xticks([-2,0,2],fontname='STIXgeneral',fontsize=10)
plt.yticks([0.4,0.6,0.8,1],fontname='STIXgeneral',fontsize=10)
plt.ylim(0.5,1.1)
plt.grid()
#plt.legend()
plt.tight_layout()
if plotmm:
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig2_b_mm.pdf')
if plotpm:
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig2_b_pm.pdf')
#%%
import seaborn as sns
"comparo una pm con una mm"
......@@ -403,6 +428,142 @@ plt.legend(fontsize=14,markerscale=5)
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/sensitivityofparalellantiparalell.pdf')
#%%
"""
FIGURA 1 PAPER
"""
def Lorentzian( x, A, B, x0, gam,C):
C=0
B=1
return A * gam**1 / ( gam**2 + ( x - x0 )**2) + B - C*(x - x0)
from scipy.optimize import curve_fit
import seaborn as sns
"comparo una pm con una mm"
pmlocmedvec = [7]
mmlocmedvec = [0]
fi = 435.75
freqsveclong = np.arange(-5,5,0.01)
paletita = sns.color_palette('rocket')
ms = 4
plt.figure(figsize=(3,2.5))
jj=0
for med in mmlocmedvec:
Freqsmm = [2*f*1e-6-0.02for f in HS_MmFrequencies[med][1:-8]]
Countsmm = [c-120 for c in HS_MmCounts[med][1:-8]]
print(Countsmm)
NormCountsmm = normalizeplot(Freqsmm, Countsmm, skip=0)
NormCountsmm[97]=1
plt.plot([f-fi for f in Freqsmm], NormCountsmm, 'o', color=paletita[jj], markersize=ms, 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
poptmm,pcovmm = curve_fit(Lorentzian,[f-fi for f in Freqsmm],NormCountsmm)
plt.plot(freqsveclong,Lorentzian(freqsveclong,*poptmm),color=paletita[0],linewidth=3)
for med in pmlocmedvec:
Freqspm = [2*f*1e-6-0.13 for f in PmFrequencies[med][1:]]
Countspm = [c-120 for c in PmCounts[med][1:]]
NormCountspm = normalizeplot(Freqspm, Countspm)
NormCountspm[21]=1
NormCountspm[183]=1
NormCountspm[184]=1
NormCountspm[214]=1
NormCountspm[285]=1
NormCountspm[293]=1
#print(jj+2)
plt.plot([f-fi for f in Freqspm], NormCountspm, 'o', color=paletita[jj+2], markersize=ms, 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
poptpm,pcovpm = curve_fit(Lorentzian,[f-fi for f in Freqspm],NormCountspm)
plt.plot(freqsveclong,Lorentzian(freqsveclong,*poptpm),color=paletita[3],linewidth=3)
#plt.ylim(0,1.2)
plt.xlabel('IR1 Frequency (MHz)',fontsize=10,fontname='STIXgeneral')
plt.ylabel('Normalized Counts',fontsize=10,fontname='STIXgeneral')
plt.xticks([-3,-2,-1,0,1,2,3],fontname='STIXgeneral',fontsize=10)
plt.yticks([0,0.2,0.4,0.6,0.8,1],fontname='STIXgeneral',fontsize=10)
plt.ylim(-0.0,1.15)
plt.xlim(-3,3)
plt.grid()
plt.tight_layout()
#plt.legend(fontsize=14,markerscale=5)
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig1_c.pdf')
#%%
import seaborn as sns
"comparo una pm con una mm"
pmlocmedvec = [0,1,2,3]
mmlocmedvec = [0]
fi = 440
paletita = sns.color_palette('rocket')
plt.figure()
jj=0
# for med in mmlocmedvec:
# Freqsmm = [2*f*1e-6 for f in HS_MmFrequencies[med][1:-8]]
# Countsmm = [c-120 for c in HS_MmCounts[med][1:-8]]
# print(Countsmm)
# NormCountsmm = normalizeplot(Freqsmm, Countsmm, skip=0)
# NormCountsmm[97]=1
# 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
for med in pmlocmedvec:
Freqspm = [2*f*1e-6 for f in PmFrequencies[med][1:]]
Countspm = [c-120 for c in PmCounts[med][1:]]
NormCountspm = normalizeplot(Freqspm, Countspm)
NormCountspm[21]=1
NormCountspm[183]=1
NormCountspm[184]=1
NormCountspm[214]=1
NormCountspm[285]=1
NormCountspm[293]=1
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
#plt.ylim(0,1.2)
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,9 +12,9 @@ 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')
os.chdir('C://Users//nicon//Doctorado//artiq_experiments//analisis//plots//20230817_RotationalDopplerShift_v5//Data')
#os.chdir('C:\\Users\\nicon\\Nextcloud\\G_liaf\\Publicaciones\\Papers\\2024 Rotational Doppler Effect\\Figuras\\Fig1\\Data')
"""
en este codigo ploteo espectros CPT de resonancias D-D para configuracion +2/+2 y +2/-2 (usando pentaprisma)
"""
......@@ -393,7 +393,7 @@ for med in mmlocmedvec:
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))
errorIntensity2.append(2*np.sqrt(np.mean(Piezo2Counts[med][1:][0:20]))+np.sqrt(bkg))
......@@ -436,40 +436,45 @@ graficos de:
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])
ms = 3
cs = 2
plt.figure(figsize=(3,2.4))
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=cs, markersize=ms,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.xlabel('Distance to center of beam (um)', fontname='STIXgeneral',fontsize=10)
plt.ylabel('Beam intensity', fontname='STIXgeneral',fontsize=10)
plt.xticks([-15,-10,-5,0,5,10,15], fontname='STIXgeneral',fontsize=10)
#plt.xticks([])
plt.yticks([0,0.2,0.4,0.6,0.8,1], fontname='STIXgeneral',fontsize=10)
#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.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig3_b.pdf')
#%%
plt.figure()
plt.figure(figsize=(3,2.4))
#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.errorbar(np.arange(-16,18,1), [p for p in pmdepthsdr], yerr=errorpmdepthsdr, fmt='o',capsize=cs, markersize=ms,color=paletadenico[3],label='Counterrotating')
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=cs, markersize=ms,color=paletadenico[0],label='Corotating')
plt.xlabel('Distance to center (um)', fontname='STIXgeneral',fontsize=10)
plt.ylabel('DR Relative depth', fontname='STIXgeneral',fontsize=10)
plt.xticks([-15,-10,-5,0,5,10,15], fontname='STIXgeneral',fontsize=10)
plt.yticks([0,0.2,0.4,0.6,0.8,1], fontname='STIXgeneral',fontsize=10)
#plt.xlim(200,3200)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
plt.legend(prop={'family':'STIXgeneral', 'size':7},loc='upper center',fontsize=5,markerscale=1)
plt.tight_layout()
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Charlas/2023 Europe/depthsradial.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig3_c.pdf')
#%%
"""
Intento ajustar un modelo para la profundidad
......@@ -508,8 +513,9 @@ Resonancias DD configuracion +2/-2 colineal variando la ubicacion del ion en los
TODO EL OAM
"""
def Lorentzian( x, A, B, x0, gam ):
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B
def Lorentzian( x, A, B, x0, gam,C):
#C=0
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x - x0)
palette = sns.color_palette("tab10")
......@@ -546,10 +552,10 @@ for med in pmlocmedvec:
if med==30:
Freqs = Freqs[100:]
Counts = Counts[100:]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.7,0),(0,1e4, 436.1, 1)))
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.7,0,-10),(0,1e4, 436.1, 1,10)))
else:
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-10),(0,1e4, 436.1, 1,10)))
pmdepthsdr.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdr.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
......
......@@ -12,8 +12,8 @@ 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')
os.chdir('C://Users//nicon//Doctorado//artiq_experiments//analisis//plots//20230817_RotationalDopplerShift_v5//Data')
"""
en este codigo ploteo espectros CPT de resonancias D-D para configuracion +2/+2 y +2/-2 (usando pentaprisma)
......@@ -69,10 +69,11 @@ def ErrorDRdepth(p, f, 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)
return 1*np.sqrt(derivadap*ep*ep + derivadaf*ef*ef + derivadab*eb*eb)
def Lorentzian( x, A, B, x0, gam , C):
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x-x0)
def Lorentzian( x, A, B, x0, gam ):
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B
def SinFit(ang,A,B,w,phi):
return A*np.sin(2*np.pi*ang*w*np.pi/180 + phi) + B
......@@ -83,9 +84,8 @@ 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
Resonancias DD configuracion +2/-2 colineal variando la ubicacion angular del ion en los haces
Moviendo verticalmente el haz
"""
......@@ -94,9 +94,9 @@ palette = sns.color_palette("tab10")
pmlocmedvec = np.arange(0,len(PIEZOAZ_FILES),1)
#pmlocmedvec = [15]
FullCurve = True
pmlocmedvec = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 14]
#pmlocmedvec = [13]
FullCurve = 1
Angles = np.arange(0,360,22.5)
......@@ -119,14 +119,29 @@ for med in pmlocmedvec:
Freqs = [2*f*1e-6 for f in PiezoAzFrequencies[med][1:]]
Counts = [c for c in PiezoAzCounts[med][1:]]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
#popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
if med==11:
Counts[116]=2651
Counts[117]=2677
Counts[145]=2803
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,300), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,10000)))
print(popt)
pmdepthsdraz.append(1-(np.min(Counts[0:95])-bkg)/(popt[1]-bkg))
errorpmdepthsdraz.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
elif med==13:
popt, pcov = curve_fit(Lorentzian, Freqs[0:110], Counts[0:110], p0=(-200,2100,435.8,0.05,300), bounds=((-10000,0,435.5,0,-10000),(0,1e4, 436.1, 1,10000)))
pmdepthsdraz.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
#pmdepthsdraz.append(1-(np.min(Counts[0:95])-bkg)/(popt[1]-bkg))
errorpmdepthsdraz.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
else:
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,100), bounds=((-10000,0,435.5,0,-10000),(0,1e4, 436.1, 1,10000)))
pmdepthsdraz.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdraz.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
......@@ -137,7 +152,8 @@ for med in pmlocmedvec:
if med not in [800]:
plt.plot([2*f*1e-6 for f in PiezoAzFrequencies[med][1:]], [c for c in PiezoAzCounts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot(Freqs, Counts, '-o', markersize=2, alpha=0.7)
plt.plot(Freqs,Lorentzian(Freqs,*popt))
jj=jj+1
......@@ -148,154 +164,33 @@ plt.grid()
# plt.legend()
# #plt.title('Espectros para distintas geometrías')
popt, pcov = curve_fit(SinFit, Angles, pmdepthsdraz, p0=(1,0.3,0.2,0.2))
print('')
print(popt)
AnglesLong = np.arange(-10,370,1)
#%%
if FullCurve:
plt.figure()
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)
popt, pcov = curve_fit(SinFit, Angles, pmdepthsdraz, p0=(1,0.3,0.2,0.2))
print(popt)
plt.figure(figsize=(3.5,3))
plt.errorbar(Angles, [p for p in pmdepthsdraz], yerr=[1*e for e in errorpmdepthsdraz], color='midnightblue', alpha=0.6, fmt='o', capsize=2, markersize=5, zorder=0)
plt.plot(AnglesLong,SinFit(AnglesLong,*popt), color='midnightblue', linewidth=2,linestyle='dashed')
indang = find_nearest(SinFit(AnglesLong,*popt), np.min(SinFit(AnglesLong,*popt)))
plt.axvline(74,linestyle='dashed')
#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.xlabel('Azimuthal angle (°)',fontname='STIXgeneral',fontsize=10)
plt.ylabel('DR Relative depth',fontname='STIXgeneral',fontsize=10)
plt.xticks([0,50,100,150,200,250,300,350],fontname='STIXgeneral',fontsize=10)
plt.yticks([0.1,0.2,0.3,0.4,0.5],fontname='STIXgeneral',fontsize=10)
#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
"""
import seaborn as sns
"""
Resonancias DD configuracion +2/-2 colineal variando la ubicacion del ion en los haces
Moviendo diagonalmente el haz
"""
palette = sns.color_palette("tab10")
pmlocmedvec = np.arange(0,len(PIEZODIAG_FILES),1)
#pmlocmedvec = [0,1]
plt.figure()
bkg = np.min(PiezoDiagCounts[5])
pmdepthsdrdiag=[]
errorpmdepthsdrdiag=[]
Intensitydiag = []
errorIntensitydiag = []
jj=0
for med in pmlocmedvec:
Freqs = [2*f*1e-6 for f in PiezoDiagFrequencies[med][1:]]
Counts = [c for c in PiezoDiagCounts[med][1:]]
if med==2:
Freqs = Freqs[1:-30]
Counts = Counts[1:-30]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
elif med==1:
Freqs = Freqs[10:-30]
Counts = Counts[10:-30]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.7,0),(0,1e4, 436.1, 1)))
elif med==5:
Freqs = Freqs[10:-55]+Freqs[-30:-1]
Counts = Counts[10:-55]+Counts[-30:-1]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
else:
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig2_a.pdf')
pmdepthsdrdiag.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdrdiag.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
Intens = popt[1]
Intensitydiag.append(Intens)
# errorIntensity.append(2*np.sqrt(np.mean(Piezo1Counts[med][1:][0:20]))+np.sqrt(bkg))
if med not in [800]:
plt.plot([2*f*1e-6 for f in PiezoDiagFrequencies[med][1:]], [c for c in PiezoDiagCounts[med][1:]], '-o', markersize=2, alpha=0.7)
plt.plot(Freqs,Lorentzian(Freqs,*popt))
jj=jj+1
# plt.xlabel('Frecuencia (MHz)')
# plt.ylabel('Counts')
#plt.xlim(435.2, 436.5)
plt.grid()
# plt.legend()
# #plt.title('Espectros para distintas geometrías')
plt.figure()
plt.plot(np.arange(0,len(Intensitydiag),1), [i/np.max(Intensitydiag) for i in Intensitydiag], '-o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in pmdepthsdrdiag], 'o',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()
#%%
"""
Ploteo en conjunto. La horizontal sale de RDS_piezo.py
"""
cap=3
plt.figure()
plt.plot(np.arange(0,len(Intensitydiag),1), [i/np.max(Intensitydiag) for i in Intensitydiag], '-o',markersize=8)
#plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in pmdepthsdrdiag], 'o',markersize=8, label='Diagonal')
plt.errorbar(np.arange(0,len(Intensitydiag),1), [p for p in pmdepthsdrdiag], yerr=errorpmdepthsdrdiag, fmt='o',capsize=cap,markersize=8, label='Diagonal')
#plt.plot(np.arange(0,len(Intensityver),1), [i/np.max(Intensityver) for i in Intensityver], '-o',markersize=8)
#plt.plot(np.arange(0,len(Intensityver),1), [p for p in pmdepthsdrver], 'o',markersize=8, label='Vertical')
plt.errorbar(np.arange(0,len(Intensityver),1), [p for p in pmdepthsdrver], yerr=errorpmdepthsdrver, fmt='o', capsize=cap,markersize=8, label='Vertical')
scale = 1.6
#plt.plot([s*scale for s in np.arange(16,len(Intensity),1)-16], [i/np.max(Intensity) for i in Intensity[16:]], '-o',markersize=8)
#plt.plot([s*scale for s in np.arange(16,len(Intensity),1)-16], [p for p in pmdepthsdr[16:]], 'o',markersize=8, label='Horizontal')
plt.errorbar([s*scale for s in np.arange(16,len(Intensity),1)-16], [p for p in pmdepthsdr[16:]], yerr=errorpmdepthsdr[16:], fmt='o', capsize=cap,markersize=8, label='Horizontal')
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
plt.xlim(-1,15)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
plt.legend()
......@@ -82,8 +82,8 @@ palette = sns.color_palette("tab10")
pmlocmedvec = np.arange(0,len(PIEZOS1_FILES),1)
#pmlocmedvec = [26]
#pmlocmedvec = [10]
pmlocmedvec = np.arange(0,10,1)
plt.figure()
......
......@@ -12,7 +12,8 @@ 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')
os.chdir('C://Users//nicon//Doctorado//artiq_experiments//analisis//plots//20230817_RotationalDopplerShift_v5//Data')
"""
......@@ -94,10 +95,10 @@ def ErrorDRdepth(p, f, 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)
return 1*np.sqrt(derivadap*ep*ep + derivadaf*ef*ef + derivadab*eb*eb)
def Lorentzian( x, A, B, x0, gam ):
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B
def Lorentzian( x, A, B, x0, gam, C):
return A * gam**2 / ( gam**2 + ( x - x0 )**2) + B - C*(x-x0)
#%%
"""
......@@ -117,12 +118,11 @@ palette = sns.color_palette("tab10")
pmlocmedvec = np.arange(0,len(PIEZOVER_FILES),1)
#pmlocmedvec = [26]
#pmlocmedvec = [1]
plt.figure()
bkg = np.min(PiezoVerCounts[5])
bkg = np.mean(PiezoVerCounts[5][0:2])
pmdepthsdrver=[]
errorpmdepthsdrver=[]
......@@ -136,7 +136,31 @@ for med in pmlocmedvec:
Freqs = [2*f*1e-6 for f in PiezoVerFrequencies[med][1:]]
Counts = [c for c in PiezoVerCounts[med][1:]]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
if med==1:
popt, pcov = curve_fit(Lorentzian, Freqs[0:-10], Counts[0:-10], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.5, 1,1000)))
elif med==2:
popt, pcov = curve_fit(Lorentzian, Freqs[0:-5], Counts[0:-5], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.75,0,-1000),(0,1e4, 435.85, 1,1000)))
elif med==3:
popt, pcov = curve_fit(Lorentzian, Freqs[0:-5], Counts[0:-5], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==5:
popt, pcov = curve_fit(Lorentzian, Freqs[5:], Counts[5:], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==9:
popt, pcov = curve_fit(Lorentzian, Freqs[:-8], Counts[:-8], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==10:
popt, pcov = curve_fit(Lorentzian, Freqs[20:], Counts[20:], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==17:
popt, pcov = curve_fit(Lorentzian, Freqs[:-9], Counts[:-9], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
else:
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
pmdepthsdrver.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdrver.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
......@@ -160,17 +184,18 @@ plt.grid()
# #plt.title('Espectros para distintas geometrías')
plt.figure()
plt.plot(np.arange(0,len(Intensityver),1), [i/np.max(Intensityver) for i in Intensityver], '-o',markersize=8)
plt.plot(np.arange(0,len(Intensityver),1), [p for p in pmdepthsdrver], 'o',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()
if len(pmlocmedvec)!=1:
plt.figure()
plt.plot(np.arange(0,len(Intensityver),1), [i/np.max(Intensityver) for i in Intensityver], '-o',markersize=8)
plt.plot(np.arange(0,len(Intensityver),1), [p for p in pmdepthsdrver], 'o',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()
#%%
"""
......@@ -190,12 +215,12 @@ palette = sns.color_palette("tab10")
pmlocmedvec = np.arange(0,len(PIEZODIAG_FILES),1)
#pmlocmedvec = [0,1]
#pmlocmedvec = [1]
plt.figure()
bkg = np.min(PiezoDiagCounts[5])
bkg = np.mean(PiezoDiagCounts[5][130:140])
pmdepthsdrdiag=[]
errorpmdepthsdrdiag=[]
......@@ -211,22 +236,31 @@ for med in pmlocmedvec:
Freqs = [2*f*1e-6 for f in PiezoDiagFrequencies[med][1:]]
Counts = [c for c in PiezoDiagCounts[med][1:]]
if med==2:
Freqs = Freqs[1:-30]
Counts = Counts[1:-30]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
if med==0:
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.7,0,-1000),(0,1e4, 435.9, 1,1000)))
elif med==1:
Freqs = Freqs[10:-30]
Counts = Counts[10:-30]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.7,0),(0,1e4, 436.1, 1)))
popt, pcov = curve_fit(Lorentzian, Freqs[:-5], Counts[:-5], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 435.9, 1,1000)))
elif med==2:
popt, pcov = curve_fit(Lorentzian, Freqs[:-25], Counts[:-25], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==3:
popt, pcov = curve_fit(Lorentzian, Freqs[:-4], Counts[:-4], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.7,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==5:
Freqs = Freqs[10:-55]+Freqs[-30:-1]
Counts = Counts[10:-55]+Counts[-30:-1]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
popt, pcov = curve_fit(Lorentzian, Freqs[10:-53]+Freqs[-30:-1], Counts[10:-53]+Counts[-30:-1], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==20:
popt, pcov = curve_fit(Lorentzian, Freqs[:-10], Counts[:-10], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.7,0,-1000),(0,1e4, 436.1, 1,1000)))
elif med==22:
popt, pcov = curve_fit(Lorentzian, Freqs[:-10], Counts[:-10], p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.7,0,-1000),(0,1e4, 436.1, 1,1000)))
else:
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
pmdepthsdrdiag.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdrdiag.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
......@@ -251,18 +285,19 @@ plt.grid()
# #plt.title('Espectros para distintas geometrías')
plt.figure()
plt.plot(np.arange(0,len(Intensitydiag),1), [i/np.max(Intensitydiag) for i in Intensitydiag], '-o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in pmdepthsdrdiag], 'o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in Anchos], 'o',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()
if len(pmlocmedvec)!=1:
plt.figure()
plt.plot(np.arange(0,len(Intensitydiag),1), [i/np.max(Intensitydiag) for i in Intensitydiag], '-o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in pmdepthsdrdiag], 'o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in Anchos], 'o',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()
#%%
......@@ -293,7 +328,7 @@ plt.errorbar([s*scale for s in np.arange(16,len(Intensity),1)-16], [p for p in p
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
plt.xlim(-1,15)
#plt.xlim(-1,15)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
......@@ -338,7 +373,7 @@ for med in pmlocmedvec:
Freqs = [2*f*1e-6 for f in PiezoVerDFrequencies[med][1:]]
Counts = [c for c in PiezoVerDCounts[med][1:]]
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05), bounds=((-10000,0,435.5,0),(0,1e4, 436.1, 1)))
popt, pcov = curve_fit(Lorentzian, Freqs, Counts, p0=(-200,2100,435.8,0.05,0.1), bounds=((-10000,0,435.5,0,-1000),(0,1e4, 436.1, 1,1000)))
pmdepthsdrverd.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdrverd.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
......
......@@ -69,6 +69,45 @@ def PerformExperiment_8levels_MM(sg, sp, gPS, gPD, DetDoppler, u, DopplerLaserLi
return ProbeDetuningVectorL, Fluovector
@njit
def PerformExperiment_8levels_MM_lolo( sg, sp, gPS, gPD, DetUV, u,
DopplerLaserLinewidth, ProbeLaserLinewidth,
T, alpha, phidoppler, titadoppler, phiprobe,
titaprobe, beta, drivefreq, DetIR,
circularityprobe=1):
"""
solvemode=1: resuelve con np.linalg.solve
solvemode=2: resuelve invirtiendo L con la funcion np.linalg.inv
sg: saturacion doppler como cociente respecto al ancho de linea ( UV )
sp: "" para repump (IR)
gPS: ancho de linea de la Doppler UV
gPD: ancho de linea IR
DetUV: Detunning Doppler (agregado como ancho efectivo del laser) en MHz (no angular)
u: Larmor frequency ( 4 G ~ 32 MHz)
DopplerLaserLinewidth: Ancho de line a UV ( < 100 kHz)
ProbeLaserLinewidth: ancho IR
T: Temperatura
alpha: angulo relativo entre los k de los laser
phidoppler: |
titadoppler: |--> Polarización de los lasers respecto al campo magnético (pol lineal)
phiprobe: |
titaprobe: |
beta: Modulation depth
drivefreq: de la trampa ~22 MHz *2pi
freqMin, freqMax, freqStep: Detuning del pump -- parametro del eje Z que es la frecuencia del repump
circularityprobe: 1 es lineal , 1j es circular
"""
rta = CPTspectrum8levels_MM_lolo(sg, sp, gPS, gPD, DetUV, u,
DopplerLaserLinewidth, ProbeLaserLinewidth,
T, alpha, phidoppler, titadoppler, phiprobe,
titaprobe, circularityprobe, beta, drivefreq,
DetIR)
return rta
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):
"""
Genera un resultado de PerformExperiment_8levels_MM con ruido normal agregado
......@@ -514,6 +553,44 @@ def CPTspectrum8levels_MM(sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phid
return DetProbeVectorMHz, Fluovector
@njit
def CPTspectrum8levels_MM_lolo(sg, sp, gPS, gPD, Detg, u, lwg, lwp, Temp, alpha, phidoppler, titadoppler, phiprobe, titaprobe, Circularityprobe, beta, drivefreq, DetProbeVector):
"""
ESTA ES LA FUNCION QUE ESTAMOS USANDO
Hace un experimento barriendo ángulos de repump con el angulo de doppler fijo.
solvemode=1: resuelve con np.linalg.solve
solvemode=2: resuelve invirtiendo L con la funcion np.linalg.inv
"""
phidoppler, titadoppler = phidoppler*(np.pi/180), titadoppler*(np.pi/180)
phiprobe, titaprobe = phiprobe*(np.pi/180), titaprobe*(np.pi/180)
DetProbeVector = 2*np.pi*DetProbeVector*1e6
Detg = 2*np.pi*Detg*1e6
#lwg, lwr, lwp = 2*np.pi*lwg*1e6, 2*np.pi*lwr*1e6, 2*np.pi*lwp*1e6
lwg, lwp = lwg*1e6, lwp*1e6
rabG = sg*gPS
rabP = sp*gPD
Fluovector = []
for Detp in DetProbeVector:
L = FullL_MM(rabG, rabP, gPS, gPD, Detg, Detp, u, lwg, lwp, phidoppler, titadoppler, phiprobe, titaprobe, beta, drivefreq, Temp, alpha, Circularityprobe)
# if solvemode == 1:
rhovectorized = np.linalg.solve(L, np.array([int(i==0) for i in range(64)],dtype=np.complex_))
Fluo = np.real(rhovectorized[18] + np.real(rhovectorized[27]))
Fluovector.append(Fluo)
return Fluovector
# @njit
# def lolo():
# L = FullL_MM(100,200,12,123,14)
......
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