Commit 3b62a425 authored by Marcelo Luda's avatar Marcelo Luda
parents 3aa96fcc 45308a48
......@@ -28,9 +28,9 @@
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1"
inkscape:cx="4016.5"
inkscape:cy="60.5"
inkscape:zoom="1.4142136"
inkscape:cx="2526.139"
inkscape:cy="-697.56084"
inkscape:window-width="1846"
inkscape:window-height="1016"
inkscape:window-x="0"
......@@ -39,6 +39,20 @@
inkscape:current-layer="layer1" />
<defs
id="defs2">
<marker
style="overflow:visible"
id="Arrow1Lstart"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow1Lstart"
inkscape:isstock="true">
<path
transform="scale(0.8) translate(12.5,0)"
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path2260" />
</marker>
<marker
style="overflow:visible"
id="marker2546"
......@@ -221,6 +235,34 @@
d="M 0,0 5,-5 -12.5,0 5,5 Z"
id="path2263-5-8" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Lend-2-1"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lend"
inkscape:isstock="true">
<path
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
id="path2263-7-77" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Lend-3-0-1"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lend"
inkscape:isstock="true">
<path
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 0,0 5,-5 -12.5,0 5,5 Z"
id="path2263-5-9-1" />
</marker>
</defs>
<g
inkscape:label="Layer 1"
......@@ -2263,5 +2305,126 @@ YAmFwWDYy/8DHTJV9KTZCpkAAAAASUVORK5CYII=
x="797.51715"
y="-179.36584">7</tspan></text>
</g>
<circle
style="fill:#ffaaaa;stroke:#ff0000;stroke-width:2;stroke-linejoin:round"
id="path615-36-5"
cx="327.50232"
cy="-364.00879"
r="47.990707" />
<circle
style="fill:#ffffff;stroke:#ff0000;stroke-width:2;stroke-linejoin:round"
id="path615-3-0-97"
cx="326.84955"
cy="-363.48508"
r="19.034275" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76"
cx="315.19159"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-3"
cx="350.41907"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-8"
cx="275.83237"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-8-8"
cx="262.91235"
cy="-365.88306"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-8-85"
cx="391.52667"
cy="-365.7836"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-8-0"
cx="379.66742"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-1"
cx="364.76254"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-2"
cx="289.63388"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-2-9"
cx="303.58618"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<ellipse
style="fill:#aa0000;stroke:#aa0000;stroke-width:2;stroke-linejoin:round"
id="path880-7-1-76-9"
cx="338.44809"
cy="-365.55286"
rx="2.9858103"
ry="2.675787" />
<path
style="fill:none;stroke:#000000;stroke-width:1.465;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-2-1)"
d="m 293.72037,-415.09093 c 33.9602,-18.35849 69.11882,-0.53749 69.11882,-0.53749"
id="path1363-7-7" />
<path
style="fill:none;stroke:#000000;stroke-width:1.465;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Lend-3-0-1)"
d="m 362.58046,-427.69186 c -33.9602,-18.35849 -69.11882,-0.5375 -69.11882,-0.5375"
id="path1363-6-9-3" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:17.6389px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.765;stroke-miterlimit:4;stroke-dasharray:none"
x="367.90924"
y="-410.25034"
id="text3907-20-65"><tspan
sodipodi:role="line"
id="tspan3905-2-6"
style="font-size:17.6389px;stroke-width:0.765;stroke-miterlimit:4;stroke-dasharray:none"
x="367.90924"
y="-410.25034"
dy="0">+2</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:17.6389px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.765;stroke-miterlimit:4;stroke-dasharray:none"
x="281.698"
y="-442.39334"
id="text3907-2-3-3"><tspan
sodipodi:role="line"
id="tspan3905-9-7-94"
style="font-size:17.6389px;stroke-width:0.765;stroke-miterlimit:4;stroke-dasharray:none"
x="281.698"
y="-442.39334">-2</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.565;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;marker-start:url(#Arrow1Lstart)"
d="M 234.02309,-365.42417 H 430.02042"
id="path25893" />
<path
style="fill:none;stroke:#000000;stroke-width:0.965;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 326.64383,-369.4001 v 7.81141"
id="path26240" />
</g>
</svg>
......@@ -234,8 +234,10 @@ for med in uvpowermedvec:
if med == 1:
powdepthsdr1.append(1-(UvPowerCounts[med][1:][idxvecdr1[jj]]-bkg)/(np.mean(UvPowerCounts[med][1:][6:26])-bkg))
powdepthsdr2.append(1-(UvPowerCounts[med][1:][idxvecdr2[jj]]-bkg)/(np.mean(UvPowerCounts[med][1:][6:26])-bkg))
errorpowdepthsdr1.append(ErrorDRdepth(UvPowerCounts[med][1:][idxvecdr1[jj]],np.mean(UvPowerCounts[med][1:][6:26]), bkg))
errorpowdepthsdr2.append(ErrorDRdepth(UvPowerCounts[med][1:][idxvecdr2[jj]],np.mean(UvPowerCounts[med][1:][6:26]), bkg))
else:
powdepthsdr1.append(1-(UvPowerCounts[med][1:][idxvecdr1[jj]]-bkg)/(np.mean(UvPowerCounts[med][1:][2:20])-bkg))
powdepthsdr2.append(1-(UvPowerCounts[med][1:][idxvecdr2[jj]]-bkg)/(np.mean(UvPowerCounts[med][1:][2:20])-bkg))
errorpowdepthsdr1.append(ErrorDRdepth(UvPowerCounts[med][1:][idxvecdr1[jj]],np.mean(UvPowerCounts[med][1:][0:20]), bkg))
......@@ -275,6 +277,9 @@ import matplotlib.pyplot as plt
def sens(r,l=2):
return 2*l/r
def sensgauss(angle):
k = 2*np.pi/866e-9
return np.sqrt(k**2 + k**2 - 2*k*k*np.cos(angle*np.pi/180))
radius = np.arange(0.1e-6,10e-6,0.01e-6)
......
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/20230817_RotationalDopplerShift_v4/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
PM_FILES = """VaryingBeamlocation2/000014686-IR_Scan_withcal_optimized
VaryingBeamlocation2/000014687-IR_Scan_withcal_optimized
VaryingBeamlocation2/000014688-IR_Scan_withcal_optimized
VaryingBeamlocation2/000014689-IR_Scan_withcal_optimized
VaryingBeamlocation2/000014691-IR_Scan_withcal_optimized
"""
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()))
print(SeeKeys(PM_FILES))
#print(SeeKeys(MM_FILES))
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211101_CPT_DosLaseres_v03\Data
PmCounts = []
PmFrequencies = []
for i, fname in enumerate(PM_FILES.split()):
print(str(i) + ' - ' + fname)
data = h5py.File(fname+'.h5', 'r')
#Amplitudes.append(np.array(data['datasets']['amplitudes']))
PmCounts.append(np.array(data['datasets']['counts_spectrum']))
PmFrequencies.append(np.array(data['datasets']['IR1_Frequencies']))
# MmCounts = []
# MmFrequencies = []
# for i, fname in enumerate(MM_FILES.split()):
# print(str(i) + ' - ' + fname)
# data = h5py.File(fname+'.h5', 'r')
# #Amplitudes.append(np.array(data['datasets']['amplitudes']))
# MmCounts.append(np.array(data['datasets']['counts_spectrum']))
# MmFrequencies.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)
#%%
import seaborn as sns
"""
Resonancias DD configuracion +2/-2 colineal variando la ubicacion del ion en los haces
"""
palette = sns.color_palette("tab10")
pmlocmedvec = [0, 1, 2, 3, 4]
#pmlocmedvec = []
idxvecdr1 = [402,226, 226, 226, 226]
idxvecdr2 = [1302,732, 732,732,732]
#pmlocmedvec = [2]
LocVecs = ['1', '2', '3', '4', '5']
LocVecsint = np.arange(1,6,1)
plt.figure()
ftrap = 22.1
DR1 = 435.8
DR2 = 444.2
bkg = 150
pmdepthsdr1=[]
errorpmdepthsdr1=[]
pmdepthsdr2=[]
errorpmdepthsdr2=[]
idxtest = 732
jj=0
for med in pmlocmedvec:
pmdepthsdr1.append(1-(PmCounts[med][1:][idxvecdr1[jj]]-bkg)/(np.mean(PmCounts[med][1:][0:20])-bkg))
pmdepthsdr2.append(1-(PmCounts[med][1:][idxvecdr2[jj]]-bkg)/(np.mean(PmCounts[med][1:][0:20])-bkg))
errorpmdepthsdr1.append(ErrorDRdepth(PmCounts[med][1:][idxvecdr1[jj]],np.mean(PmCounts[med][1:][0:20]), bkg))
errorpmdepthsdr2.append(ErrorDRdepth(PmCounts[med][1:][idxvecdr2[jj]],np.mean(PmCounts[med][1:][0:20]), bkg))
plt.plot([2*f*1e-6 for f in PmFrequencies[med][1:]], [c for c in PmCounts[med][1:]], '-o', color=palette[med],markersize=2, alpha=0.7, 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.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(LocVecsint, pmdepthsdr1, yerr=errorpmdepthsdr1, label='DR left', fmt='o',capsize=2, markersize=8)
plt.errorbar(LocVecsint, pmdepthsdr2, yerr=errorpmdepthsdr2, label='DR right', fmt='o',capsize=2, markersize=8)
plt.xlabel('Ion location')
plt.ylabel('DR Relative depth')
plt.xticks([1,2,3,4,5])
plt.ylim(0,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
Mido la profundidad de las resonancias oscuras
"""
palette = sns.color_palette("tab10")
# pmlocmedvec = [0, 4, 3, 5, 1, 7, 6, 2]
# idxvec = [95, 95, 95, 94, 93, 98, 97, 97]
mmlocmedvec = [0,1,2,3,4,5,6]
idxvecdr1 = [160, 160, 160, 160, 159,159, 159]
idxvecdr2 = [394, 394, 394, 394, 394, 394, 394]
#mmlocmedvec = [7]
LocVecs = ['1', '2', '3', '4', '5', '6', '7', '8']
LocVecsint = np.arange(1,8,1)
plt.figure()
ftrap = 22.1
DR1 = 435.8
DR2 = 444.2
bkg = 40
mmdepthsdr1=[]
errormmdepthsdr1=[]
mmdepthsdr2=[]
errormmdepthsdr2=[]
idxtest = 394
jj=0
for med in mmlocmedvec:
mmdepthsdr1.append(1-(MmCounts[med][1:][idxvecdr1[jj]]-bkg)/(np.mean(MmCounts[med][1:][0:20])-bkg))
mmdepthsdr2.append(1-(MmCounts[med][1:][idxvecdr2[jj]]-bkg)/(np.mean(MmCounts[med][1:][0:20])-bkg))
errormmdepthsdr1.append(ErrorDRdepth(MmCounts[med][1:][idxvecdr1[jj]],np.mean(MmCounts[med][1:][0:20]), bkg))
errormmdepthsdr2.append(ErrorDRdepth(MmCounts[med][1:][idxvecdr2[jj]],np.mean(MmCounts[med][1:][0:20]), bkg))
plt.plot([2*f*1e-6 for f in MmFrequencies[med][1:]], [c for c in MmCounts[med][1:]], '-o', color=palette[med],markersize=2, alpha=0.7, label=f'{LocVecs[jj]}')
#plt.plot([2*f*1e-6 for f in MmFrequencies[med][1:]][idxtest], [c for c in MmCounts[med][1:]][idxtest], 'o', color=palette[med],markersize=14, label=f'{LocVecs[jj]}')
jj=jj+1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Counts')
#plt.xlim(442,445)
plt.grid()
plt.legend()
plt.title('Espectros para distintas geometrías')
plt.figure()
plt.errorbar(LocVecsint, mmdepthsdr1, yerr=errormmdepthsdr1, fmt='o',capsize=2, markersize=5)
plt.errorbar(LocVecsint, mmdepthsdr2, yerr=errormmdepthsdr2, fmt='o',capsize=2, markersize=5)
plt.ylabel('DR1 Relative depth config -2/-2')
plt.xticks([])
plt.ylim(0,1)
#%%
"""
grafico la profundidad de la resonancia oscura en funcion de la ubicacion del ion
en el perfil del haz. la ubicacion 1 y 7 son horizontales, izquierda y derecha.
la ubicacion 4 es el centro, arriba. el resto, intermedias
"""
plt.figure()
plt.errorbar(LocVecsint, mmdepthsdr1, yerr=errormmdepthsdr1, fmt='o',capsize=2, markersize=6, color='darkred', label='Same OAM')
plt.errorbar(LocVecsint, pmdepthsdr1, yerr=errorpmdepthsdr2, fmt='o',capsize=2, markersize=6, color='coral', label='Opposite OAM')
plt.ylabel('DR1 Relative depth')
plt.xlabel('Ion angular position')
#plt.xticks([])
plt.grid()
plt.ylim(0,1)
plt.legend()
#%%
"""
Grafico ahora dos gráficos que se vean 3 curvas con buena estadística para mostrar
"""
from scipy.optimize import curve_fit
from scipy.signal import savgol_filter as sf
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]))
print(popt)
yvecnorm = []
for jj in range(len(yvec)):
print(linealfunc(xvec[jj],*popt))
yvecnorm.append(yvec[jj]/linealfunc(xvec[jj],*popt))
return yvecnorm
#pmlocmedvec = [7,2,0,4,3,5,1]
pmlocmedvec = [3,5,7]
mmlocmedvec = [0,1,2]
plt.figure()
plotpm = 1
plotmm = 0
if plotpm:
jj=0
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)
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]}')
jj=jj+1
if plotmm:
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]]
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]}')
jj=jj+1
plt.ylim(0,1.2)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Normalized Counts')
#plt.ylim(412,2500)
plt.grid()
#plt.legend()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment