Commit d6fb2ba9 authored by Muriel Bonetto's avatar Muriel Bonetto

version 0 codigo

parent 7fec71de
......@@ -9,17 +9,14 @@ import os
from scipy import interpolate
# Solo levanto algunos experimentos
Calib_Files = """000007155-UV_Scan_withcalib_Haeffner
000007160-UV_Scan_withcalib_Haeffner
000007161-UV_Scan_withcalib_Haeffner
000007163-UV_Scan_withcalib_Haeffner
000007165-UV_Scan_withcalib_Haeffner
000007198-UV_Scan_withcalib_Haeffner
000007209-UV_Scan_withcalib_Haeffner
000007211-UV_Scan_withcalib_Haeffner
000007212-UV_Scan_withcalib_Haeffner"""
Calib_Files = """000007324-UV_Scan_withcalib_Haeffner
000007325-IR_Scan_withcal_optimized
000007326-UV_Scan_withcalib_Haeffner
000007327-IR_Scan_withcal_optimized
000007328-UV_Scan_withcalib_Haeffner
000007327-IR_Scan_withcal_optimized"""
directory = '/home/liaf-murib/Documents/Artiq/artiq_experiments/analisis/plots/20220503_EspectrosUVnuevos/Data/'
directory = '/home/liaf-murib/Documents/Artiq/artiq_experiments/analisis/plots/20220520_EspectrosUVyCPT_descompensacion/Data/'
#carpeta pc nico labo escritorio:
......@@ -44,8 +41,14 @@ for i, fname in enumerate(Calib_Files.split()):
print(fname)
data = h5py.File(directory + fname+'.h5', 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
print(list(data['datasets'].keys()))
Amps.append(np.array(data['datasets']['UV_Amplitudes']))
Freqs.append(np.array(data['datasets']['UV_Frequencies']))
try:
Amps.append(np.array(data['datasets']['UV_Amplitudes']))
except KeyError:
Amps.append(np.array(data['datasets']['IR_Amplitudes']))
try:
Freqs.append(np.array(data['datasets']['UV_Frequencies']))
except KeyError:
Freqs.append(np.array(data['datasets']['IR_Frequencies']))
Counts.append(np.array(data['datasets']['counts_spectrum']))
T_readouts.append(np.array(data['datasets']['t_readout']))
......@@ -61,7 +64,7 @@ def Lorentzian(f, A, x0, gamma, offset):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + offset #40 es el piso de ruido estimado
jvec = [8] #UV_cooling en 90 MHz
jvec = [4] #UV_cooling en 90 MHz
plt.figure()
......@@ -72,20 +75,20 @@ for j in jvec:
portion = 0.
popt, pcov = curve_fit(Lorentzian, FreqsChosen[int(portion*len(FreqsChosen)):], CountsChosen[int(portion*len(FreqsChosen)):], p0=[12000, 208, 30, 30])
#popt, pcov = curve_fit(Lorentzian, FreqsChosen[int(portion*len(FreqsChosen)):], CountsChosen[int(portion*len(FreqsChosen)):], p0=[12000, 208, 30, 30])
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.errorbar(FreqsChosen, CountsChosen, yerr=np.sqrt(np.array(CountsChosen)), fmt='o', capsize=5, markersize=5)
#plt.plot(freqslong, Lorentzian(freqslong, popt[0], popt[1], popt[2]), label=f'FWHM {round(popt[1])} MHz')
plt.plot(freqslong, Lorentzian(freqslong, popt[0], popt[1], popt[2], popt[3]), label=f'FWHM 30 MHz')
#plt.plot(freqslong, Lorentzian(freqslong, popt[0], popt[1], popt[2], popt[3]), label=f'FWHM 30 MHz')
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.legend()
print(f'Ancho medido: {round(popt[2])} MHz')
#print(f'Ancho medido: {round(popt[2])} MHz')
#%%
......@@ -101,7 +104,7 @@ def Lorentzian(f, A, gamma, x0):
def MicromotionSpectra(det, A, beta, x0, offset):
ftrap=22.1
gamma=23
gamma= 29
P = A*(jv(0, beta)**2)/(((det-x0)**2)+(0.5*gamma)**2)+ offset
i = 1
#print(P)
......@@ -112,7 +115,7 @@ def MicromotionSpectra(det, A, beta, x0, offset):
return P
jvec = [7] #UV_cooling en 90 MHz
jvec = [2] #UV_cooling en 90 MHz
"""
plt.figure()
......@@ -149,7 +152,7 @@ for j in jvec:
portion = 0.
popt, pcov = curve_fit(MicromotionSpectra, FreqsChosen[int(portion*len(FreqsChosen)):], CountsChosen[int(portion*len(FreqsChosen)):],p0=[70000,0.5,215,200], bounds=((70000,0.1,200,-500),(100000,10,300,500)))
popt, pcov = curve_fit(MicromotionSpectra, FreqsChosen[int(portion*len(FreqsChosen)):], CountsChosen[int(portion*len(FreqsChosen)):],p0=[100000,1.5,220,200], bounds=((70000,0.1,200,-500),(1000000,10,300,500)))
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
......@@ -164,3 +167,4 @@ for j in jvec:
plt.legend()
print(f'Beta medido: {popt[1]}')
print(popt)
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