Commit 3e350a31 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto
parents 6858949d b6f6ebf4
......@@ -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')
......
......@@ -12,6 +12,9 @@ from scipy import interpolate
CPT con tres laseres pero lso dos IR son el mismo entonces las DD son mas finas
"""
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20231218_CPT_DosLaseres_Reflotoajustes/Data/')
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211223_CPT_DosLaseres_v07_ChristmasSpecial\Data
ALL_FILES = """000016420-IR_Scan_withcal_optimized
......@@ -140,6 +143,13 @@ if do_fit:
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
FittedEITpi_1_long, Detunings_1_long = FitEIT_MM_1ion(freqslong, *popt_1, plot=True)
DetDop = popt_1[1]
DetRep = popt_1[2]
Sdop = popt_1[3]
Spr = popt_1[4]
Srep = popt_1[5]
#%%
plt.figure()
......
......@@ -89,8 +89,8 @@ plt.legend()
from scipy.optimize import curve_fit
import time
cwd = os.getcwd()
os.chdir('../20231123_CPTconmicromocion3')
# cwd = os.getcwd()
# os.chdir('../20231123_CPTconmicromocion3')
from Data.EITfit.lolo_modelo_full_3niveles import GenerateNoisyCPT_fit
os.chdir(cwd)
......
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
"""
Primero tengo mediciones de espectros cpt de un ion variando la tension dc_A
"""
#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/CPT/')
"""
CPT con tres laseres pero lso dos IR son el mismo entonces las DD son mas finas
"""
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211223_CPT_DosLaseres_v07_ChristmasSpecial\Data
ALL_FILES = """000017121-IR_Scan_withcal_optimized
000017123-IR_Scan_withcal_optimized
000017170-IR_Scan_withcal_optimized
"""
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(ALL_FILES))
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211101_CPT_DosLaseres_v03\Data
Counts = []
Freqs = []
AmpTisa = []
UVCPTAmp = []
No_measures = []
for i, fname in enumerate(ALL_FILES.split()):
print(str(i) + ' - ' + fname)
#print(fname)
data = h5py.File(fname+'.h5', '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.
Freqs.append(np.array(data['datasets']['IR1_Frequencies']))
Counts.append(np.array(data['datasets']['counts_spectrum']))
#AmpTisa.append(np.array(data['datasets']['TISA_CPT_amp']))
#UVCPTAmp.append(np.array(data['datasets']['UV_CPT_amp']))
#No_measures.append(np.array(data['datasets']['no_measures']))
#%%
#Barriendo angulo del IR con tisa apagado
jvec = [1]
jselected = jvec
plt.figure()
i = 0
for j in jvec:
if j in jselected:
plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', capsize=2, markersize=2)
#plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'Amp Tisa: {AmpTisa[i]}', mb arkersize=3)
i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
plt.legend()
#%%
from scipy.optimize import curve_fit
import time
phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0, 90
phiprobe = 0
titaprobe = 0.1
Temp = 0.5e-3
sg = 0.544
sp = 4.5
sr = 0
DetRepump = 0
lw = 0.1
DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth = lw, lw, lw #ancho de linea de los laseres
u = 32.5e6
#B = (u/(2*np.pi))/c
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6
alpha = 0
drivefreq = 2*np.pi*22.135*1e6
noiseamplitude = 0
selectedcurve=1
FreqsDR = Freqs[selectedcurve]
CountsDR = Counts[selectedcurve]
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
CircPr = 1
alpha = 0
def FitEIT_MM_1ion(Freqs, offset, DetDoppler, DetRepump, SG, SP, SR, SCALE1, OFFSET, TEMP, U, plot=False):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
# BETA1 = 0
# SG = 0.6
# SP = 8.1
# TEMP = 0.2e-3
# U = 32.5e6
freqs = [2*f*1e-6-offset for f in Freqs[:-1]]
#Detunings, Fluorescence1 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA1, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
Detunings, Fluorescence1 = GenerateNoisyCPT_fit(SG, SR, SP, gPS, gPD, DetDoppler, DetRepump, U, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqs, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
ScaledFluo1 = np.array([f*SCALE1 + OFFSET for f in Fluorescence1])
if plot:
return ScaledFluo1, Detunings
else:
return ScaledFluo1
#return ScaledFluo1
do_fit = True
if do_fit:
popt_2, pcov_2 = curve_fit(FitEIT_MM_1ion, FreqsDR, CountsDR, p0=[430, -25, 12, 0.5, 13, 11, 3e4, 2e3, 0.5e-3, 32e6], bounds=((0, -100, -20, 0, 0, 0, 0, 0, 0,20e6), (1000, 0, 50, 2, 20, 20, 5e6, 5e4, 15e-3,40e6)))
FittedEITpi_1_short, Detunings_1_short = FitEIT_MM_1ion(FreqsDR, *popt_2, plot=True)
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
FittedEITpi_1_long, Detunings_1_long = FitEIT_MM_1ion(freqslong, *popt_2, plot=True)
DetDop = popt_2[1]
DetRep = popt_2[2]
Sdop = popt_2[3]
Spr = popt_2[4]
Srep = popt_2[5]
#%%
plt.figure()
plt.errorbar(Detunings_1_short, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='red', alpha=0.5, capsize=2, markersize=2)
plt.plot(Detunings_1_long, FittedEITpi_1_long, color='darkolivegreen', linewidth=3, label='med 1')
#plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {round(popt[2]*1e3, 2)} mK, detDop: {DetDoppler} MHz')
plt.xlabel('Detuning (MHz)')
plt.ylabel('Counts')
#plt.xlim(-20,0)
plt.legend(loc='upper left', fontsize=20)
plt.grid()
\ No newline at end of file
......@@ -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')
"""
......@@ -559,8 +559,9 @@ from scipy.optimize import curve_fit
def modelo3(r,a,b,c):
#c=1
s = (jv(0, b/r) )**2
return a*(s/(1+c*s))
s = a*(jv(0, b/(r)) )**2
return s
#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]
......
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