Commit 691a66c6 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

hola

parent 45008918
......@@ -198,18 +198,18 @@ drivefreq = 2*np.pi*22.135*1e6
FreqsDR = [2*f*1e-6-offsetxpi for f in Freqs[10]]
CountsDR = Counts[10]
freqslong = np.arange(min(FreqsDR)-20, max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
freqslong = np.arange(min(FreqsDR), max(FreqsDR)+FreqsDR[1]-FreqsDR[0], 0.1*(FreqsDR[1]-FreqsDR[0]))
CircPr = 1
alpha = 0
def FitEIT_MM(freqs, SG, SP, SCALE1, SCALE2, OFFSET, BETA1, BETA2):
def FitEIT_MM(freqs, SG, SP, SCALE1, SCALE2, OFFSET, BETA1, BETA2, TEMP):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#BETA = 1.8
# SG = 0.6
# SP = 8.1
TEMP = 0.2e-3
# TEMP = 0.2e-3
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, Fluorescence2 = PerformExperiment_8levels_MM(SG, SP, gPS, gPD, DetDoppler, u, DopplerLaserLinewidth, ProbeLaserLinewidth, TEMP, alpha, phidoppler, titadoppler, phiprobe, titaprobe, BETA2, drivefreq, min(freqs), max(freqs)+(freqs[1]-freqs[0]), freqs[1]-freqs[0], circularityprobe=CircPr, plot=False, solvemode=1, detpvec=None)
......@@ -220,12 +220,12 @@ def FitEIT_MM(freqs, SG, SP, SCALE1, SCALE2, OFFSET, BETA1, BETA2):
#return ScaledFluo1
popt_2sp, pcov_2sp = curve_fit(FitEIT_MM, FreqsDR, CountsDR, p0=[0.9, 6.2, 3.5e4, 2.9e4, 1.34e3, 3.5, 0.1], bounds=((0, 0, 0, 0, 0, 0, 0), (2, 10, 5e4, 5e4, 4e3, 10, 2)))
popt_2sp, pcov_2sp = curve_fit(FitEIT_MM, FreqsDR, CountsDR, p0=[0.9, 6.2, 3.5e4, 2.9e4, 1.34e3, 3.5, 0.1, 1e-3], bounds=((0, 0, 0, 0, 0, 0, 0, 0), (2, 10, 5e5, 5e5, 4e3, 10, 2, 15e-3)))
#popt, pcov = curve_fit(FitEIT_MM, FreqsDR, CountsDR, p0=[0.8, 8, 4e4, 3.5e3, 0], bounds=((0, 0, 0, 0, 0), (2, 15, 1e5, 1e5, 10)))
#array([7.12876797e-01, 7.92474752e+00, 4.29735308e+04, 1.74240582e+04,
#1.53401696e+03, 1.17073206e-06, 2.53804151e+00])
#%%
FittedEITpi_2sp = FitEIT_MM(freqslong, *popt_2sp)
#FittedEITpi = FitEIT_MM(freqslong, 0.8, 8, 4e4, 3.5e3, 0)
......@@ -341,7 +341,7 @@ CircPr = 1
alpha = 0
def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
def FitEIT_MM_single(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#BETA = 1.8
# SG = 0.6
......@@ -355,22 +355,27 @@ def FitEIT_MM(freqs, SG, SP, SCALE1, OFFSET, BETA1):
#return ScaledFluo1
popt_1sp, pcov_1sp = curve_fit(FitEIT_MM, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2], bounds=((0, 0, 0, 0, 0), (2, 10, 5e4, 5e4, 10)))
popt_1sp, pcov_1sp = curve_fit(FitEIT_MM_single, FreqsDR, CountsDR, p0=[0.9, 6.2, 3e4, 1.34e3, 2], bounds=((0, 0, 0, 0, 0), (2, 10, 5e4, 5e4, 10)))
#array([7.12876797e-01, 7.92474752e+00, 4.29735308e+04, 1.74240582e+04,
#1.53401696e+03, 1.17073206e-06, 2.53804151e+00])
FittedEITpi_1sp = FitEIT_MM(freqslong, *popt_1sp)
#FittedEITpi_1sp = FitEIT_MM(freqslong, 0.9, 6.2, 4e4, 2.9e3, 2)
#%%
FittedEITpi_1sp = FitEIT_MM_single(freqslong, *popt_1sp)
#FittedEITpi_1sp = FitEIT_MM(freqslong, 0.9, 6.2, 4e4, 2.9e3, 2)
plt.figure()
plt.errorbar(FreqsDR, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='darkgreen', alpha=0.5, capsize=2, markersize=2)
plt.plot(freqslong, FittedEITpi_1sp, color='darkgreen', linewidth=3)
#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.grid()
for betita in [0, 0.631, 1, 1.5]:
FittedEITpi_1sp = FitEIT_MM_single(freqslong, popt_1sp[0], popt_1sp[1], popt_1sp[2], popt_1sp[3], betita)
plt.errorbar(FreqsDR, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', color='darkgreen', alpha=0.5, capsize=2, markersize=2)
plt.plot(freqslong, FittedEITpi_1sp, color='darkgreen', linewidth=3)
#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.grid()
......
......@@ -203,6 +203,8 @@ errorpmdepthsdrdiag=[]
Intensitydiag = []
errorIntensitydiag = []
Anchos = []
jj=0
for med in pmlocmedvec:
......@@ -228,7 +230,8 @@ for med in pmlocmedvec:
pmdepthsdrdiag.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdrdiag.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
Anchos.append(popt[-1])
Intens = popt[1]
Intensitydiag.append(Intens)
......@@ -251,6 +254,7 @@ plt.grid()
plt.figure()
plt.plot(np.arange(0,len(Intensitydiag),1), [i/np.max(Intensitydiag) for i in Intensitydiag], '-o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in pmdepthsdrdiag], 'o',markersize=8)
plt.plot(np.arange(0,len(Intensitydiag),1), [p for p in Anchos], 'o',markersize=8)
plt.xlabel('Ion position')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
......@@ -326,6 +330,8 @@ errorpmdepthsdrverd=[]
Intensityverd = []
errorIntensityverd = []
Anchos = []
jj=0
for med in pmlocmedvec:
......@@ -336,7 +342,7 @@ for med in pmlocmedvec:
pmdepthsdrverd.append(1-(np.min(Lorentzian(Freqs,*popt))-bkg)/(popt[1]-bkg))
errorpmdepthsdrverd.append(ErrorDRdepth(np.min(Lorentzian(Freqs,*popt)),popt[1], bkg))
Anchos.append(popt[-1])
Intens = popt[1]
Intensityverd.append(Intens)
......@@ -359,10 +365,12 @@ plt.grid()
plt.figure()
plt.errorbar(np.arange(0,len(Intensityverd),1), [i/np.max(Intensityverd) for i in Intensityverd], yerr=[e/np.max(Intensityverd) for e in errorIntensityverd], fmt='o', capsize=3, markersize=8)
plt.errorbar(np.arange(0,len(Intensityverd),1), [p for p in pmdepthsdrverd], yerr=errorpmdepthsdrverd, fmt='o',color='limegreen',capsize=3,markersize=8)
#plt.plot(np.arange(0,len(Intensityverd),1), [p for p in Anchos], 'o',color='blue',markersize=8)
plt.xlabel('Screw step')
plt.ylabel('Intensity / DR Relative depth')
#plt.xticks([1,2,3,4,5])
plt.xlim(-2,35)
plt.xlim(-2,40)
plt.ylim(-0.1,1.1)
plt.grid()
#plt.axvline(3, color='salmon')
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 1 17:58:39 2020
@author: oem
"""
import os
import numpy as np
#os.chdir('/home/oem/Nextcloud/G_liaf/liaf-TrampaAnular/Código General/EIT-CPT/Buenos Aires/Experiment Simulations/CPT scripts/Eight Level 2 repumps')
from threeLevel_2repumps_AnalysisFunctions import CalculoTeoricoDarkResonances_8levels, GetMinimaInfo, GetPlotsofFluovsAngle_8levels, PerformExperiment_8levels, FindDRFrequencies, FindRelativeFluorescencesOfDR, GenerateNoisyCPT, SmoothNoisyCPT, GetFinalMaps, GenerateNoisyCPT_fixedRabi, GenerateNoisyCPT_fit
import matplotlib.pyplot as plt
import time
from threeLevel_2repumps_AnalysisFunctions import MeasureRelativeFluorescenceFromCPT, IdentifyPolarizationCoincidences, RetrieveAbsoluteCoincidencesBetweenMaps, GetClosestIndex
#C:\Users\Usuario\Nextcloud\G_liaf\liaf-TrampaAnular\Código General\EIT-CPT\Buenos Aires\Experiment Simulations\CPT scripts\Eight Level 2 repumps
ub = 9.27e-24
h = 6.63e-34
c = (ub/h)*1e-4 #en unidades de MHz/G
#u = 1e6
u = 33.5e6
B = (u/(2*np.pi))/c
#sg, sp = 0.6, 5 #parámetros de control, saturación del doppler y repump
#rabG, rabP = sg*gPS, sp*gPD #frecuencias de rabi
gPS, gPD, = 2*np.pi*21.58e6, 2*np.pi*1.35e6 #anchos de linea de las transiciones
lw = 0.1
DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth = lw, lw, lw #ancho de linea de los laseres
DetDoppler = -36 #42
DetRepumpVec = [DetDoppler+29.6]
Tvec = [0.7] #temperatura en mK
alpha = 0*(np.pi/180) #angulo entre los láseres
phidoppler, titadoppler = 0, 90
phirepump, titarepump = 0, 0
phiprobe = 0
titaprobe = 90
#Calculo las resonancias oscuras teóricas
#ResonanciasTeoricas, DRPositivas = CalculoTeoricoDarkResonances_8levels(u/(2*np.pi*1e6), titadoppler, DetDoppler, DetRepump)
#Parametros de la simulacion cpt
center = -45
span = 80
freqMin = center-span*0.5
freqMax = center+span*0.5
""" parametros para tener espectros coherentes
freqMin = -56
freqMax = 14
"""
freqStep = 1e-1
noiseamplitude = 0
RelMinMedido0Vector = []
RelMinMedido1Vector = []
RelMinMedido2Vector = []
RelMinMedido3Vector = []
RelMinMedido4Vector = []
#Sr = np.arange(0, 10, 0.2)
#Sg = np.arange(0.01, 1, 0.05)
#Sp = np.arange(0.1, 6.1, 1)
#Sg = [0.6**2]
#Sp = [2.3**2]
Sg = [1.4]
Sp = [6]
Sr = [11]
i = 0
save = False
showFigures = True
if not showFigures:
plt.ioff()
else:
plt.ion()
fig1, ax1 = plt.subplots()
offsetx = 464
ax1.plot([f-offsetx for f in FreqsDR], CountsDR, 'o')
run = True
Scale = 730
Offset = 600 #600 para 20k cuentas aprox
MaxCoherenceValue = []
for sg in Sg:
for sp in Sp:
rabG, rabP = sg*gPS, sp*gPD
for Ti in Tvec:
T = Ti*1e-3
for DetRepump in DetRepumpVec:
print(T)
for sr in Sr:
rabR = sr*gPD
#MeasuredFreq, MeasuredFluo = GenerateNoisyCPT(rabG, rabR, rabP, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqMin, freqMax, freqStep, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
if run:
MeasuredFreq4, MeasuredFluo4 = GenerateNoisyCPT_fixedRabi(sg, sr, sp, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqMin, freqMax, freqStep, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
#SmoothFluo = SmoothNoisyCPT(MeasuredFluo, window=9, poly=2)
SmoothFluo4 = MeasuredFluo4
#Scale = max(BestC)/max([100*s for s in SmoothFluo4])
ax1.plot(MeasuredFreq4, [Scale*100*f + Offset for f in SmoothFluo4], label=f'Sr = {sr}')
ax1.axvline(DetDoppler, linestyle='--', linewidth=1)
#if sr != 0:
#ax1.axvline(DetRepump, linestyle='--', linewidth=1)
MaxCoherenceValue.append(np.max(SmoothFluo4))
#print(titaprobe)
ax1.set_xlabel('Detuning Rebombeo (MHz)')
ax1.set_ylabel('Fluorescencia (AU)')
ax1.set_title(f'B: {round(B, 2)} G, Sdop: {round(sg, 2)}, Sp: {round(sp, 2)}, Sr: {round(sr, 2)}, lw: {lw} MHz, T: {Ti} mK')
#ax1.set_ylim(0, 8)
#ax1.axvline(DetDoppler, linestyle='dashed', color='red', linewidth=1)
#ax1.axvline(DetRepump, linestyle='dashed', color='black', linewidth=1)
#ax1.set_title('Pol Doppler y Repump: Sigma+ Sigma-, Pol Probe: PI')
#ax1.legend()
ax1.grid()
print (f'{i+1}/{len(Sg)*len(Sp)}')
i = i + 1
if save:
plt.savefig(f'Mapa_plots_100k_1mk/CPT_SMSM_sdop{round(sg, 2)}_sp{round(sp, 2)}_sr{round(sr, 2)}.jpg')
ax1.legend()
"""
plt.figure()
plt.plot(Sr, MaxCoherenceValue, 'o')
plt.xlabel('Sr')
plt.ylabel('Coherence')
"""
"""
plt.figure()
plt.plot(MeasuredFreq, [100*f for f in SmoothFluo], color='darkred')
plt.xlabel('Desintonía 866 (MHz)')
plt.ylabel('Fluorescencia (A.U.)')
plt.axvline(-30, color='darkblue', linewidth=1.2, linestyle='--')
plt.yticks(np.arange(0.4, 1.8, 0.2))
plt.ylim(0.5, 1.6)
plt.grid()
plt.figure()
plt.plot(MeasuredFreq4, [100*f for f in SmoothFluo4], color='darkred')
plt.xlabel('Desintonía 866 (MHz)')
plt.ylabel('Fluorescencia (A.U.)')
plt.axvline(-30, color='darkblue', linewidth=1.2, linestyle='--')
plt.yticks(np.arange(0.8, 2.4, 0.4))
plt.grid()
"""
#%%
from scipy.optimize import curve_fit
T = 0.5e-3
sg = 0.7
sp = 6
sr = 0
DetDoppler = -14
DetRepump = 0
FitsSp = []
FitsOffset = []
Sg = [0.87]
def FitEIT(freqs, SP, offset):
MeasuredFreq, MeasuredFluo = GenerateNoisyCPT_fit(0.87, sr, SP, gPS, gPD, DetDoppler, DetRepump, u, DopplerLaserLinewidth, RepumpLaserLinewidth, ProbeLaserLinewidth, T, alpha, phidoppler, titadoppler, phiprobe, [titaprobe], phirepump, titarepump, freqs, plot=False, solvemode=1, detpvec=None, noiseamplitude=noiseamplitude)
FinalFluo = [f*43000 + 2685 for f in MeasuredFluo]
return FinalFluo
freqs = [f-offsetx+32 for f in FreqsDR]
freqslong = np.arange(min(freqs), max(freqs)+freqs[1]-freqs[0], 0.1*(freqs[1]-freqs[0]))
popt, pcov = curve_fit(FitEIT, freqs, CountsDR, p0=[5, 700], bounds=(0, [10, 1e6]))
FitsSp.append(popt[0])
FitsOffset.append(popt[1])
print(popt)
FittedEIT = FitEIT(freqslong, *popt)
plt.figure()
plt.errorbar(freqs, CountsDR, yerr=2*np.sqrt(CountsDR), fmt='o', capsize=2, markersize=2)
plt.plot(freqslong, FitEIT(freqslong, *popt))
plt.title(f'Sdop: {round(popt[0], 2)}, Spr: {round(popt[1], 2)}, T: {T*1e3} mK, detDop: {DetDoppler} MHz')
np.savetxt('CPT_measured.txt', np.transpose([freqs, CountsDR]))
np.savetxt('CPT_fitted.txt', np.transpose([freqslong, FittedEIT]))
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