agrego todo lo de las mediciones

parent 8ffe9870
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 6 16:40:32 2021
@author: Nico
"""
import numpy as np
import matplotlib.pyplot as plt
def GetTemp(Gamma, Det, kb=1.38e-23, hbar=1.03e-34):
T = (1/4)*(hbar/kb)*Gamma*((Gamma/(-2*Det)) + (-2*Det/Gamma))
return np.abs(T*1e3)
GammaUV = 2*np.pi*22.4e6
Det = 2*np.pi*np.arange(1e6, 50e6, 0.1e6)
plt.figure()
plt.plot(Det/GammaUV, GetTemp(GammaUV, Det))
plt.axvline(0.5, linestyle='--', linewidth=1)
plt.xlabel('Detuning/Gamma')
plt.ylabel('Final Temp (mK)')
MinTemp = np.min(GetTemp(GammaUV, Det))
print(f'Min temp: {MinTemp} mK')
#%%
from scipy.special import jv
from scipy.optimize import curve_fit
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2))
def MicromotionSpectra(det, ftrap, gamma, beta, n):
P = (jv(0, beta)**2)/((det**2)+(0.5*gamma)**2)
i = 1
#print(P)
while i <= n:
P = P + ((jv(n, beta))**2)/(((det+n*ftrap)**2)+(0.5*gamma)**2) + ((jv(-n, beta))**2)/(((det-n*ftrap)**2)+(0.5*gamma)**2)
i = i + 1
#print(P)
return P
Det = np.arange(-50, 50, 0.1)
ftrap = 21
gamma = 22
beta = np.arange(0, 2, 0.05)
n = 1
anchos = []
for b in beta:
Micromotion = MicromotionSpectra(Det, ftrap, gamma, b, n)
popt, pcov = curve_fit(Lorentzian, Det, Micromotion)
anchos.append(popt[1])
plt.figure()
plt.plot(beta, anchos, 'o')
plt.xlabel('Micromotion index beta')
plt.ylabel('Apparent linewidth(MHz)')
plt.axhline(22, linewidth=1, linestyle='--')
plt.grid()
#%%
#chosenbeta = 1.25
plt.figure()
for chosenbeta in [0, 1, 1.25, 2]:
plt.plot(Det, MicromotionSpectra(Det, ftrap, gamma, chosenbeta, n), label=f'beta={chosenbeta}')
#plt.ylim(0, 0.005)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Fluorescencia')
plt.grid()
plt.legend()
......@@ -67,6 +67,8 @@ def SaturationCurve_detzero(p, F0, a):
#%%
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20210824_SaturacionTransiciones\Data_IR
IR_powers_vec = []
IR_fluorescence_vec = []
......@@ -99,6 +101,25 @@ plt.plot([popt[1]*p for p in IR_powers_vec_W], IR_fluorescence_vec[j], 'o')
plt.plot([popt[1]*p for p in IR_powers_vec_W], [SaturationCurve_detzero(p, popt[0], popt[1]) for p in IR_powers_vec_W])
plt.xlabel('Sat Parameter DP')
plt.ylabel('counts')
plt.title('Detuning = 0 MHz')
plt.grid()
plt.figure()
plt.plot([1e6*p for p in IR_powers_vec_W], IR_fluorescence_vec[j], 'o')
plt.plot([1e6*p for p in IR_powers_vec_W], [SaturationCurve_detzero(p, popt[0], popt[1]) for p in IR_powers_vec_W])
plt.xlabel('Potencia (uW)')
plt.ylabel('counts')
plt.title('Detuning = 0 MHz')
plt.grid()
plt.figure()
plt.plot([1e6*p for p in IR_powers_vec_W], IR_fluorescence_vec[j], 'o')
plt.plot([1e6*p for p in IR_powers_vec_W], [SaturationCurve_detzero(p, popt[0], popt[1]) for p in IR_powers_vec_W])
plt.xlabel('Potencia (uW)')
plt.ylabel('counts')
plt.title('Detuning = 0 MHz')
plt.xlim(-30, 300)
plt.grid()
print(popt)
......@@ -111,17 +132,20 @@ w_397 = 2*np.pi*755e12
c=3e8
hbar = 1.05e-34
#g21, g23 = 2*np.pi*21.58e6, 2*np.pi*1.35e6
g21, g23 = 2*np.pi*21.58e6, 2*np.pi*1.35e6
g23 = 2*np.pi*23.05*1e6
#g23 = 2*np.pi*23.05*1e6
radius = np.sqrt(6*c*c*1/(hbar*(w_866**3)*g23*factor))
radius = np.sqrt(12*c*c*2/(hbar*(w_866**3)*g23*factor))
print(f'Diametro: {2*radius*1e6} um')
plt.figure()
plt.plot([p*1e6 for p in IR_powers_vec_W], [popt[1]*p for p in IR_powers_vec_W], 'o')
plt.xlim(-10, 100)
plt.ylim(-1, 5)
plt.xlim(-4, 100)
plt.ylim(-0.5, 4)
plt.xlabel('Potencia (uW)')
plt.ylabel('Sat Parameter DP')
plt.grid()
#plt.xlabel()
#%%
#Calculo el coeficiente de proporcionalidad entre S y Pot
......
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
# Solo levanto algunos experimentos
Calib_Files_IR = """000003547-IR_Saturation.h5"""
Calib_Files_UV = """000002865-UV_Saturation.h5
000002866-UV_Saturation.h5
000002867-UV_Saturation.h5
000002868-UV_Saturation.h5
000002869-UV_Saturation.h5
000002870-UV_Saturation.h5
000002871-UV_Saturation.h5
000002872-UV_Saturation.h5
000002873-UV_Saturation.h5
000002874-UV_Saturation.h5
000002875-UV_Saturation.h5"""
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20210824_SaturacionTransiciones\Data_UV
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20210824_SaturacionTransiciones\Data_IR
def SeeKeys(files):
for i, fname in enumerate(files.split()):
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
print(fname)
print(list(data['datasets'].keys()))
def ConvertIRampstoPower(amp):
amps = [0.01, 0.03, 0.05, 0.07, 0.09, 0.11, 0.13, 0.15, 0.17, 0.19, 0.21, 0.23, 0.25, 0.27, 0.29, 0.31, 0.33, 0.35]
powers = [0, 0.22, 1.42, 5.1, 13.13, 27, 48, 78, 116, 161, 211, 261, 310, 363, 412, 448, 486, 516]
f = interpolate.interp1d(amps, powers)
return f(amp)
def SaturationCurve(p, F0, a, det):
return 0.5*F0*a*p*(1/(1+a*p+4*((det**2)/(g23**2))))
def SaturationCurve_detzero(p, F0, a):
return 0.5*F0*a*p*(1/(1+a*p))
#%%
IR_powers_vec = []
IR_fluorescence_vec = []
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20210906_SaturacionTransiciones_MejorAlineacion\Data_IR
for i, fname in enumerate(Calib_Files_IR.split()):
print(i)
#print(fname)
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
#print(list(data['datasets'].keys()))
meas = np.array(data['datasets']['measurements_IR_sat'])
IR_fluorescence_vec.append(meas)
IR_meas_amps = np.array(data['datasets']['IR_amps'])
IR_meas_powers = [ConvertIRampstoPower(amp) for amp in IR_meas_amps]
IR_powers_vec.append(IR_meas_powers)
#%%
#Calculo el coeficiente de proporcionalidad entre S y Pot
j = 0
def SaturationCurve_detzero(p, F0, a):
return 0.5*F0*a*p*(1/(1+a*p))
IR_powers_vec_W = [p*1e-6 for p in IR_powers_vec[j]]
popt, pcov = curve_fit(SaturationCurve_detzero, IR_powers_vec_W, IR_fluorescence_vec[j], p0=(2e3, 5e4))
plt.figure()
plt.plot([popt[1]*p for p in IR_powers_vec_W], IR_fluorescence_vec[j], 'o')
plt.plot([popt[1]*p for p in IR_powers_vec_W], [SaturationCurve_detzero(p, popt[0], popt[1]) for p in IR_powers_vec_W])
plt.xlabel('Sat Parameter DP')
plt.ylabel('counts')
plt.title('Detuning = 0 MHz')
plt.grid()
plt.figure()
plt.plot([1e6*p for p in IR_powers_vec_W], IR_fluorescence_vec[j], 'o')
plt.plot([1e6*p for p in IR_powers_vec_W], [SaturationCurve_detzero(p, popt[0], popt[1]) for p in IR_powers_vec_W])
plt.xlabel('Potencia (uW)')
plt.ylabel('counts')
plt.title('Detuning = 0 MHz')
plt.grid()
print(popt)
factor = popt[1]
w_866 = 2*np.pi*346e12
w_397 = 2*np.pi*755e12
c=3e8
hbar = 1.05e-34
g21, g23 = 2*np.pi*21.58e6, 2*np.pi*1.35e6
g23b = 2*np.pi*23.05*1e6
radius = np.sqrt(6*c*c*2/(hbar*(w_866**3)*g23*factor))
print(f'Diametro: {2*radius*1e6} um')
print(f'Isat: {(2/(factor*np.pi*(radius**2)))*1e3/1e4} mW/cm2')
plt.figure()
plt.plot([p*1e6 for p in IR_powers_vec_W], [popt[1]*p for p in IR_powers_vec_W], 'o')
plt.xlim(-10, 100)
plt.ylim(-1, 5)
#plt.xlabel()
#%%
#Calculo el coeficiente de proporcionalidad entre S y Pot
j = 16
w_866 = 2*np.pi*346e12
w_397 = 2*np.pi*755e12
c=3e8
hbar = 1.05e-34
g21, g23 = 2*np.pi*21.58e6, 2*np.pi*1.35e6
g23 = 2*np.pi*23.05*1e6
def SaturationCurve(p, F0, det):
return 0.5*F0*factor*p*(1/(1+factor*p+4*((det**2)/(g23**2))))
IR_powers_vec_W = [p*1e-6 for p in IR_powers_vec[j]]
popt, pcov = curve_fit(SaturationCurve, IR_powers_vec_W, IR_fluorescence_vec[j], p0=(4e3, 2e7))
plt.figure()
plt.plot([factor*p for p in IR_powers_vec_W], IR_fluorescence_vec[j], 'o', label=f'Det: {round(1e-6*popt[1]/(2*np.pi), 1)} MHz')
plt.plot([factor*p for p in IR_powers_vec_W], [SaturationCurve(p, popt[0], popt[1]) for p in IR_powers_vec_W])
plt.xlabel('Sat Parameter DP')
plt.ylabel('counts')
plt.legend()
plt.grid()
#factor = popt[1]
print(f'Detuning: {1e-6*popt[1]/(2*np.pi)} MHz')
#radius = np.sqrt(12*c*c/(hbar*(w_866**3)*g23*factor))
#print(f'Diametro: {2*radius*1e6} um')
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 25 10:32:58 2021
@author: oem
"""
import numpy as np
import matplotlib.pyplot as plt
def SaturationCurve(S, gamma, det):
return 0.5*S*(1/(1+S+4*((det**2)/(gamma**2))))
gamma = 2*np.pi*1e6*22
det = 2*np.pi*1e6*10
Svec = np.arange(0, 5, 0.01)
SatCurve = np.array([SaturationCurve(s, gamma, det) for s in Svec])
plt.plot(Svec, SatCurve)
\ No newline at end of file
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
# Solo levanto algunos experimentos
Calib_Files = """000003673-IR_LaserPowerCalibration_BS.h5"""
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20210908_fiteodecalibracion\Data
def SeeKeys(files):
for i, fname in enumerate(files.split()):
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
print(fname)
print(list(data['datasets'].keys()))
#%%
for i, fname in enumerate(Calib_Files.split()):
print(SeeKeys(Calib_Files))
print(i)
print(fname)
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
print(list(data['datasets'].keys()))
amps = np.array(data['datasets']['Experiment_amps_IR'])
freqs = np.array(data['datasets']['Experiment_freqs_IR'])
#%%
def Poly(f, a, b, c, d):
return a*(f**3) + b*(f**2) + c*f + d
popt, pcov = curve_fit(Poly, freqs, amps)
plt.figure()
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
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
# Solo levanto algunos experimentos
Calib_Files = """000004035-UV_Scan_withcalib_Haeffner
000004036-UV_Scan_withcalib_Haeffner
000004062-UV_Scan_withcalib_Haeffner
000004063-UV_Scan_withcalib_Haeffner
000004064-UV_Scan_withcalib_Haeffner
000004065-UV_Scan_withcalib_Haeffner
000004066-UV_Scan_withcalib_Haeffner
000004067-UV_Scan_withcalib_Haeffner
000004068-UV_Scan_withcalib_Haeffner
000004069-UV_Scan_withcalib_Haeffner
000004071-UV_Scan_withcalib_Haeffner
000004072-UV_Scan_withcalib_Haeffner
000004073-UV_Scan_withcalib_Haeffner
000004074-UV_Scan_withcalib_Haeffner
000004075-UV_Scan_withcalib_Haeffner
000004077-UV_Scan_withcalib_Haeffner
000004078-UV_Scan_withcalib_Haeffner
000004114-UV_Scan_withcalib_Haeffner
000004115-UV_Scan_withcalib_Haeffner
000004116-UV_Scan_withcalib_Haeffner
000004119-UV_Scan_withcalib_Haeffner
000004120-UV_Scan_withcalib_Haeffner
000004129-UV_Scan_withcalib_Haeffner
000004130-UV_Scan_withcalib_Haeffner
000004131-UV_Scan_withcalib_Haeffner
000004132-UV_Scan_withcalib_Haeffner
000004133-UV_Scan_withcalib_Haeffner
000004134-UV_Scan_withcalib_Haeffner"""
Calib_Files_1005 = """000004114-UV_Scan_withcalib_Haeffner
"""
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211004_EspectrosUV\Data
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()))
#%%
Amps = []
Freqs = []
Counts = []
for i, fname in enumerate(Calib_Files.split()):
print(SeeKeys(Calib_Files))
print(i)
print(fname)
data = h5py.File(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']))
Counts.append(np.array(data['datasets']['counts_spectrum']))
#%%
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 5
j = 17 #el 15 es lindo tambien
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.figure()
#plt.plot([f - 225 for f in FreqsChosen], CountsChosen, 'o', label='2.4 uW')
plt.plot([f - 225 for f in FreqsChosen], CountsChosen, 'o')
plt.plot([f - 225 for f in freqslong], Lorentzian(freqslong, *popt), label='Lorentzian fit')
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*95-225, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
j = 18 #el 15 es lindo tambien
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.plot(FreqsChosen, CountsChosen, 'o', label='1.1 uW')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*95, linestyle='--', linewidth=1, label='UV Cooling Freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
#%%
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 0
j = 22
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*100, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
j = 23
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*105, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
j = 24
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*110, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
#%%
j = 25
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*110, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW, otra polarizacion')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
j = 26
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*110, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW, otra polarizacion')
#plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
j = 27
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*110, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW, otra polarizacion')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
#%% SIMULACION DE DOS CAMPANAS
dif = 20
amprand = 0.001
Suma = Lorentzian(np.array(FreqsChosen), 1, 23, 215) + amprand*(np.random.rand()-0.5) + Lorentzian(np.array(FreqsChosen), 1, 23, 215+dif) + amprand*(np.random.rand()-0.5)
popt, pcov = curve_fit(Lorentzian, FreqsChosen, Suma)
plt.figure()
plt.plot(FreqsChosen, Suma, 'o')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*105, linestyle='--', linewidth=1, label='UV cooling freq')
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.title('Pot UV: 2.8 uW')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz')
\ No newline at end of file
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
# Solo levanto algunos experimentos
Calib_Files = """000004016-UV_LaserPowerCalibration_BS_rpi.h5"""
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211004_fiteodecalibracion2\Data
def SeeKeys(files):
for i, fname in enumerate(files.split()):
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
print(fname)
print(list(data['datasets'].keys()))
#%%
for i, fname in enumerate(Calib_Files.split()):
print(SeeKeys(Calib_Files))
print(i)
print(fname)
data = h5py.File(fname, 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
print(list(data['datasets'].keys()))
amps = np.array(data['datasets']['Experiment_amps_UV'])
freqs = np.array(data['datasets']['Experiment_freqs_UV'])
#%%
def Poly(f, a3, a2, a1, a, b, c, d):
return a3*(f**6) + a2*(f**5) + a1*(f**4) + a*(f**3) + b*(f**2) + c*f + d
popt, pcov = curve_fit(Poly, freqs, amps)
freqslong = np.arange(min(freqs), max(freqs), (freqs[1]-freqs[0])*0.01)
plt.figure()
plt.plot(freqs, amps, 'o')
plt.plot(freqslong, Poly(freqslong, *popt))
plt.figure()
plt.plot(freqs, np.array(amps)-Poly(freqs, *popt), 'o')
analisis/plots/20211006_EspectrosUV_FixedScript/Figuras/fluo_vs_betas.png

29 KB

analisis/plots/20211006_EspectrosUV_FixedScript/Figuras/fluo_vs_betas_2.png

28.3 KB

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
# Solo levanto algunos experimentos
Calib_Files = """000004167-UV_Scan_withcalib_Haeffner
000004168-UV_Scan_withcalib_Haeffner
000004186-UV_Scan_withcalib_Haeffner
000004187-UV_Scan_withcalib_Haeffner
000004188-UV_Scan_withcalib_Haeffner
000004228-UV_Scan_withcalib_Haeffner
000004229-UV_Scan_withcalib_Haeffner
000004230-UV_Scan_withcalib_Haeffner
000004231-UV_Scan_withcalib_Haeffner
000004232-UV_Scan_withcalib_Haeffner
000004233-UV_Scan_withcalib_Haeffner"""
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211006_EspectrosUV_FixedScript\Data
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()))
#%%
Amps = []
Freqs = []
Counts = []
for i, fname in enumerate(Calib_Files.split()):
print(SeeKeys(Calib_Files))
print(i)
print(fname)
data = h5py.File(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']))
Counts.append(np.array(data['datasets']['counts_spectrum']))
#%%
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 5
j = 0 #UV_cooling en 100 MHz
UV_cooling = 100
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='2.4 uW')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 5
j = 1 #UV_cooling en 100 MHz
UV_cooling = 110
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='2.4 uW')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
#%%
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 5
j = 2
UV_cooling = 100
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='Cool_every 20')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 5
j = 3
UV_cooling = 100
Cool_every = 5
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='Cool_every 5')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
j = 4
UV_cooling = 100
Cool_every = 50
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='Cool_every 50')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
#%%
m = 6.6e-26
c = 3e8
T = 100e-6
kb=1.38e-23
hbar=1.03e-34
f0 = 755e12
fL = 22
fG = np.sqrt(8*kb*T*np.log(2)/(m*c*c))*f0*1e-6
print(fG)
"""
wl = 589e-9
T = 300
m2 = 3.5e-23
fG2 = 2*np.pi*(4*np.pi/wl)*np.sqrt(kb*T*2*np.log(2)/(m2))*1e-6
print(fG2)
"""
fV = 0.5*fL + np.sqrt((fL**2)/4 + fG**2)
print(fV)
#%% en teoria esto esta "bien compensado" con -1.21 V en dcB
j = 6
UV_cooling = 90
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
lim = len(FreqsChosen)
popt, pcov = curve_fit(Lorentzian, FreqsChosen[0:lim], CountsChosen[0:lim])
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='dcB=-1.1 V')
#plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.xlim(170, 270)
plt.grid()
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
j = 7
UV_cooling = 90
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
lim = len(FreqsChosen)
popt, pcov = curve_fit(Lorentzian, FreqsChosen[0:lim], CountsChosen[0:lim])
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='dcB=-1.16 V')
#plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.xlim(170, 270)
plt.grid()
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
j = 8
UV_cooling = 90
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
lim = len(FreqsChosen)
popt, pcov = curve_fit(Lorentzian, FreqsChosen[0:lim], CountsChosen[0:lim])
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='dcB=-1.20 V')
#plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.xlim(170, 270)
plt.grid()
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
"""
j = 5
UV_cooling = 90
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
popt, pcov = curve_fit(Lorentzian, FreqsChosen, CountsChosen)
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='dcB=-1.22 V')
plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.xlim(170, 270)
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
#en teoria esto esta mal compensado poniendo -1.1 V en dcB
def Lorentzian(f, A, gamma, x0):
return (A/np.pi)*0.5*gamma/(((f-x0)**2)+((0.5*gamma)**2)) + 100
"""
j = 9
UV_cooling = 90
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
lim = len(FreqsChosen)
popt, pcov = curve_fit(Lorentzian, FreqsChosen[0:lim], CountsChosen[0:lim])
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='dcB=-1.24 V')
#plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.xlim(170, 270)
plt.grid()
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
j = 10
UV_cooling = 90
Cool_every = 20
FreqsChosen = [2*f*1e-6 for f in Freqs[j]]
CountsChosen = Counts[j]
lim = len(FreqsChosen)
popt, pcov = curve_fit(Lorentzian, FreqsChosen[0:lim], CountsChosen[0:lim])
freqslong = np.arange(min(FreqsChosen)-10, max(FreqsChosen)+10, (FreqsChosen[1]-FreqsChosen[0])*0.01)
#plt.figure()
plt.plot(FreqsChosen, CountsChosen, 'o', label='dcB=-1.26 V')
#plt.plot(freqslong, Lorentzian(freqslong, *popt))
#plt.axvline(popt[2]-22.1, linestyle='--', linewidth=1)
#plt.axvline(popt[2]+22.1, linestyle='--', linewidth=1)
#plt.axvline(2*UV_cooling, linestyle='--', linewidth=1)
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('Cuentas')
plt.xlim(170, 270)
plt.grid()
plt.legend()
print(f'Ancho medido: {round(popt[1])} MHz, cooling en {(popt[2]-2*UV_cooling)/23} det/gamma')
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