Commit a1ad3e16 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

todo

parent 857cc99a
......@@ -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')
......@@ -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,33 +436,35 @@ 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=(2.5,2))
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.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=(2.5,2))
#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])
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])
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()
......@@ -508,8 +510,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 +549,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))
......
......@@ -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')
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig2_a.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)))
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,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/20240312_RotationalDopplerShift_news/Data')
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20240312_RotationalDopplerShift_news/Data')
"""
......@@ -329,6 +329,45 @@ IntensityChico = [h-np.min(HazChico[x0:xf]) for h in HazChico[x0:xf]]
IntensityGrande = [h-np.min(HazGrande[x0+delta:xf+delta]) for h in HazGrande[x0+delta:xf+delta]]
#%%
"""
Intento suavizar los perfiles de intensidad
"""
from math import factorial as fac
def LGbeam(r,w,E,B,r0):
l=2
r=r-r0
#E = np.sqrt(4*P/(w**2))
return E*np.sqrt(2/(np.pi*(fac(np.abs(l)))))*(((np.sqrt(2)*r)/(w))**np.abs(l))*np.exp(-((r**2)/(w**2)))+B
xvec = [x+shift for x in xchico][x0:xf]
popt_chico, pcov_chico = curve_fit(LGbeam,xvec[0:20],IntensityChico[0:20],p0=(500,10000,1,1800))
print(popt_chico)
plt.figure()
plt.plot(xvec,IntensityChico)
plt.plot(xvec,LGbeam(np.array(xvec),*popt_chico))
plt.plot(xvec[20],IntensityChico[20],'o')
#%%
from scipy.signal import savgol_filter as sf
plt.figure()
plt.plot(xvec,IntensityChico,'o')
plt.plot(xvec,sf(IntensityChico,11,3))
xvec2 = xgrande[x0+delta:xf+delta]
plt.figure()
plt.plot(xvec,IntensityChico,'o')
plt.plot(xvec,sf(IntensityChico,11,3))
plt.figure()
plt.plot(xvec2,IntensityGrande,'o')
plt.plot(xvec2,sf(IntensityGrande,13,3))
#%%
"""
Figura paper (falta el ajuste eventual)
"""
x1 = 100
x2 = 160
......@@ -336,20 +375,26 @@ x2 = 160
xchicofinal = np.arange(0,len(IntensityChico),1)
xgrandefinal = np.arange(0,len(IntensityGrande),1)
plt.figure()
plt.figure(figsize=(3.5,3))
plt.errorbar(np.arange(x1,len(Intensityver1)*20+x1,20), [p for p in pmdepthsdrver1], yerr= errorpmdepthsdrver1, fmt='o',color='red', capsize=3, markersize=8)
plt.plot([x*20 for x in xchicofinal],[i/np.max(IntensityChico) for i in IntensityChico],'o',color='red',alpha=0.3)
ms = 4
cs = 2
plt.errorbar(np.arange(x2,len(Intensityver2)*20+x2,20), [p for p in pmdepthsdrver2], yerr= errorpmdepthsdrver2, fmt='o',color='blue', capsize=3, markersize=8)
plt.plot([x*20 for x in xgrandefinal],[i/np.max(IntensityGrande) for i in IntensityGrande],'o',color='blue',alpha=0.3)
plt.errorbar(np.arange(x1,len(Intensityver1)*20+x1,20), [p for p in pmdepthsdrver1], yerr= errorpmdepthsdrver1, fmt='o',color='red', capsize=cs, markersize=ms)
plt.plot([x*20 for x in xchicofinal],sf([i/np.max(IntensityChico) for i in IntensityChico],11,3),linestyle='dashed',color='red',alpha=0.5)
plt.errorbar(np.arange(x2,len(Intensityver2)*20+x2,20), [p for p in pmdepthsdrver2], yerr= errorpmdepthsdrver2, fmt='o',color='blue', capsize=cs, markersize=ms)
plt.plot([x*20 for x in xgrandefinal],sf([i/np.max(IntensityGrande) for i in IntensityGrande],11,3),linestyle='dashed',color='blue',alpha=0.5)
plt.xlim(-20,600+x2+10)
plt.grid()
plt.xlabel('Distance to center of beam (steps)')
plt.ylabel('DR depth / Beam intensity')
#plt.savefig('/home/nico/Documents/artiq_experiments/analisis/plots/20240312_RotationalDopplerShift_news/scaleinvariance.jpg')
plt.xlabel('Distance to center of beam (um)',fontname='STIXgeneral',fontsize=10)
plt.ylabel('DR Relative depth',fontname='STIXgeneral',fontsize=10)
plt.xticks([0,100,200,300,400,500,600,700],fontname='STIXgeneral',fontsize=10)
plt.yticks([0,0.2,0.4,0.6,0.8,1],fontname='STIXgeneral',fontsize=10)
plt.tight_layout()
plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2024 Rotational Doppler Effect/Figuras/Material/fig3_a.pdf')
#%%
"""
......@@ -509,9 +554,10 @@ Uso los primeros tres puntos de la medicion con haz chico y el resto con el haz
from scipy.optimize import curve_fit
def modelo3(r,a,b,d):
#d=0
return a*(jv(0, b*(1/(r-d))))**2
def modelo3(r,a,b,c):
#c=1
s = (jv(0, b/r) )**2
return a*(s/(1+c*s))
rfit = np.arange(x1,len(Intensityver2)*20+x2,20)
yfit = [pmdepthsdrver1[0],pmdepthsdrver1[1],pmdepthsdrver1[2]] + [p for p in pmdepthsdrver2]
......@@ -519,12 +565,12 @@ yfit = [pmdepthsdrver1[0],pmdepthsdrver1[1],pmdepthsdrver1[2]] + [p for p in pmd
popt,pcov = curve_fit(modelo3,rfit,yfit)
rfit = np.arange(x2,len(Intensityver2)*20+x2,20)
yfit = [p for p in pmdepthsdrver2]
# rfit = np.arange(x2,len(Intensityver2)*20+x2,20)
# yfit = [p for p in pmdepthsdrver2]
rlong = np.arange(-200.1,1000,1)
rlong = np.arange(-20.1,1000,1)
popt,pcov = curve_fit(modelo3,rfit,yfit,p0=(10,100,10))
popt,pcov = curve_fit(modelo3,rfit,yfit,p0=(10,100,2))
print(popt)
plt.figure()
......@@ -535,10 +581,10 @@ plt.plot([x*20 for x in xchicofinal],[i/np.max(IntensityChico) for i in Intensit
plt.errorbar(np.arange(x2,len(Intensityver2)*20+x2,20), [p for p in pmdepthsdrver2], yerr= errorpmdepthsdrver2, fmt='o',color='blue', capsize=3, markersize=8,zorder=1)
plt.plot([x*20 for x in xgrandefinal],[i/np.max(IntensityGrande) for i in IntensityGrande],'o',color='blue',alpha=0.3)
plt.plot(rlong,modelo3(rlong,popt[0],popt[1]*1,popt[2]),zorder=2,color='green',linewidth=3,label=r'$I(r)=a\,(J_0(\frac{b}{r}))^2$')
plt.plot(rlong,modelo3(rlong,*popt),zorder=2,color='green',linewidth=3,label=r'$I(r)=a\,(J_0(\frac{b}{r}))^2$')
plt.xlim(-100,600+x2+10)
plt.legend()
plt.xlim(-10,600+x2+10)
#lt.legend()
plt.grid()
# plt.figure()
......@@ -549,4 +595,3 @@ plt.grid()
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