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

sincronizo todo

parent cd2024f7
......@@ -7,9 +7,23 @@ import ast
from scipy.optimize import curve_fit
import os
from scipy import interpolate
"""
Programa que evidencia la calibración en frecuecnai de un AOM IR
Hay que buscar en otros archivos si no hay una medicion asi pero sin variar la potencia del AOM, o sea, sin calibrar,
para comparar y poiner la curva antes y despues de calibrar
"""
# Solo levanto algunos experimentos
ALL_FILES = """000003316-LaserPowerCalibration.h5"""
ALL_FILES = """000003316-LaserPowerCalibration.h5
"""
FILES_WITHOUTC = """000003283-LaserPowerCalibration.h5
"""
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20210831_PowerStabilization/Data')
def SeeKeys(files):
for i, fname in enumerate(files.split()):
......@@ -21,6 +35,10 @@ print(SeeKeys(ALL_FILES))
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\artiq_master\results\2021-07-14\16
Measurements_vec = []
Calibration_amps_vec = []
Calibration_freqs_vec = []
for i, fname in enumerate(ALL_FILES.split()):
print(i)
print(fname)
......@@ -29,20 +47,107 @@ for i, fname in enumerate(ALL_FILES.split()):
# Aca hago algo repugnante para poder levantar los strings que dejamos
# que además tenian un error de tipeo al final. Esto no deberá ser necesario
# cuando se solucione el error este del guardado.
Calibration_amps = np.array(data['datasets']['Test_Experiment_amps'])
Calibration_freqs = np.array(data['datasets']['Test_Experiment_freqs'])
Measurements = np.array(data['datasets']['Test_Measured_PD_IR_counts'])
Calibration_amps_vec.append(np.array(data['datasets']['Test_Experiment_amps']))
Calibration_freqs_vec.append(np.array(data['datasets']['Test_Experiment_freqs']))
Measurements_vec.append(np.array(data['datasets']['Test_Measured_PD_IR_counts']))
NocMeasurements_vec = []
NocCalibration_amps_vec = []
NocCalibration_freqs_vec = []
NocCalibration_freqsraw_vec = []
NocCounts_vec = []
for i, fname in enumerate(FILES_WITHOUTC.split()):
print(i)
print(fname)
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
# Aca hago algo repugnante para poder levantar los strings que dejamos
# que además tenian un error de tipeo al final. Esto no deberá ser necesario
# cuando se solucione el error este del guardado.
NocCalibration_amps_vec.append(np.array(data['datasets']['Calibration_amps_IR']))
NocCalibration_freqs_vec.append(np.array(data['datasets']['Calibration_freqs_IR']))
NocCalibration_freqsraw_vec.append(np.array(data['datasets']['Calibration_freqs_IR_Raw']))
NocCounts_vec.append(np.array(data['datasets']['PD_IR_counts']))
#%%
plt.figure()
plt.hist(Measurements)
plt.hist(Measurements_vec[0])
#%%
k=0
plt.figure()
plt.plot(Calibration_freqs_vec[k], Measurements_vec[k], 'o')
plt.ylim(0,1)
print(len(Measurements_vec[k]))
#%%
k=0
plt.figure()
plt.plot([f*1e-6 for f in Calibration_freqs_vec[k]], Calibration_amps_vec[k], 'o',markersize=5,color='purple')
plt.xlabel('Frecuencia AOM (MHz)')
plt.ylabel('Amplitud calibrada (a.u.)')
#%%
"""
Sin calibrar. Estas son meds para distintas amps
"""
plt.figure()
plt.plot(Calibration_freqs, Calibration_amps, 'o')
plt.plot([f*1e-6 for f in NocCalibration_freqs_vec[k]], NocCounts_vec[k], 'o',markersize=5,color='purple')
plt.xlabel('Frecuencia AOM (MHz)')
plt.ylabel('Voltaje PD (V)')
plt.ylim(0,1)
#extraigo un chunk
chu = 3
plt.figure()
plt.plot(Calibration_freqs, Measurements, 'o')
plt.plot([f*1e-6 for f in NocCalibration_freqs_vec[k]][51*chu:51*(chu+1)], NocCounts_vec[k][51*chu:51*(chu+1)], 'o',markersize=5,color='purple')
plt.xlabel('Frecuencia AOM (MHz)')
plt.ylabel('Voltaje PD (V)')
plt.ylim(0,1)
Counts_noc = NocCounts_vec[k][51*chu:51*(chu+1)]
#%%
"""
Figura tesis
"""
import seaborn as sns
paleta=sns.color_palette("bright")
fs = 10
ms = 4
fig,ax = plt.subplots(2, sharex=True,figsize=(6,6))
fig.subplots_adjust(hspace=0.1)
ax[0].plot([f*1e-6 for f in Calibration_freqs_vec[k]], Measurements_vec[k], 'o-', color=paleta[0], markersize=ms,label='Con calibración')
ax[0].plot([f*1e-6 for f in Calibration_freqs_vec[k]],Counts_noc[:-1],'o-', color=paleta[1], markersize=ms,label='Sin calibración')
ax[0].set_ylabel('Voltaje PD (V)',fontsize=fs,fontname='STIXgeneral')
ax[0].set_yticks([0.3,0.35,0.4,0.45,0.5])
ax[0].set_yticklabels([0.3,0.35,0.4,0.45,0.5], fontsize=fs, fontname='STIXGeneral')
ax[0].set_ylim(0.26,0.54)
ax[0].legend(prop={'family': 'STIXGeneral', 'size': fs})
ax[1].plot([f*1e-6 for f in Calibration_freqs_vec[k]], Calibration_amps_vec[k], '^-',markersize=ms,color=paleta[0],alpha=0.6)
#ax[1].axhline(0.23,linewidth=ms-1,color=paleta[1],alpha=0.5,linestyle='dashed')
ax[1].set_ylim(0.19,0.274)
ax[1].set_ylabel('Amplitud calibrada (a.u.)',fontsize=fs,fontname='STIXgeneral')
ax[1].set_yticks([0.19,0.20,0.21,0.22,0.23,0.24,0.25,0.26,0.27])
ax[1].set_yticklabels([0.19,0.20,0.21,0.22,0.23,0.24,0.25,0.26,0.27], fontsize=fs, fontname='STIXGeneral')
ax[1].set_xticks([190,200,210,220,230])
ax[1].set_xticklabels([190,200,210,220,230], fontsize=fs, fontname='STIXGeneral')
ax[1].set_xlabel('Frecuencia AOM (MHz)',fontsize=fs,fontname='STIXgeneral')
#ax[1].legend(prop={'family': 'STIXGeneral', 'size': fs})
plt.savefig('/home/nico/Nextcloud/Nico/Doctorado/Tesis/Tesis_doctorado/Chapters/figures/Cap4/calibAOM.pdf')
......
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