Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
artiq_experiments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Nunez Barreto
artiq_experiments
Commits
7b896a0e
Commit
7b896a0e
authored
Oct 17, 2022
by
Nicolas Nunez Barreto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ion statistics
parent
e0876e4d
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
833 additions
and
0 deletions
+833
-0
000008731-IonStatistics.h5
...ts/20221017_IonStatistics/Data/000008731-IonStatistics.h5
+0
-0
IonStatistics.py
analisis/plots/20221017_IonStatistics/IonStatistics.py
+61
-0
OBE3levels_chtime_fitting.py
...7_IonStatistics/Simulaciones/OBE3levels_chtime_fitting.py
+177
-0
OBE3levels_functions.py
...221017_IonStatistics/Simulaciones/OBE3levels_functions.py
+332
-0
error_teorico_tau_det20.csv
...17_IonStatistics/Simulaciones/error_teorico_tau_det20.csv
+11
-0
medidos_powers_taus.csv
...221017_IonStatistics/Simulaciones/medidos_powers_taus.csv
+11
-0
plot_decaytimes_vs_intensity_detunings.py
...cs/Simulaciones/plot_decaytimes_vs_intensity_detunings.py
+50
-0
sim_intensidad_taus_full.csv
...7_IonStatistics/Simulaciones/sim_intensidad_taus_full.csv
+191
-0
No files found.
analisis/plots/20221017_IonStatistics/Data/000008731-IonStatistics.h5
0 → 100644
View file @
7b896a0e
File added
analisis/plots/20221017_IonStatistics/IonStatistics.py
0 → 100644
View file @
7b896a0e
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
# Solo levanto algunos experimentos
Stat_files
=
[
8731
]
def
expo
(
T
,
tau
,
N0
,
C
):
global
T0
return
N0
*
np
.
exp
(
-
(
T
-
T0
)
/
tau
)
+
C
def
pow_from_amp
(
amp
):
"""Paso de amplitud urukul a potencia medida por Nico"""
# Forma altamente ineficiente de hacer esto, pero me salio asi
amplitudes_UV
=
np
.
flip
(
np
.
array
([
0.08
,
0.10
,
0.12
,
0.14
,
0.16
,
0.18
,
0.20
,
0.22
,
0.24
,
0.26
,
0.28
,
0.30
]))
assert
amp
in
amplitudes_UV
potencias_UV
=
np
.
flip
(
np
.
array
([
4
,
10
,
19
,
32
,
49
,
71
,
96
,
125
,
155
,
183
,
208
,
229
]))
return
potencias_UV
[
np
.
where
(
amplitudes_UV
==
amp
)][
0
]
"""
plt.plot(amplitudes_UV, potencias_UV, 'ko-', lw=0.2)
plt.xlabel("Amplitud Urukul")
plt.ylabel("Potencia /uW")
plt.grid()
"""
#%%
BINW
=
10e-9
T0
=
0.0e-6
Stat_Heigths
=
[]
Stat_Bins
=
[]
for
i
,
fname
in
enumerate
(
Stat_files
):
#print(i)
#print(fname)
data
=
h5py
.
File
(
'Data/00000'
+
str
(
fname
)
+
'-IonStatistics.h5'
,
'r'
)
counts
=
np
.
array
(
data
[
'datasets'
][
'counts'
])
bines
=
np
.
arange
(
counts
.
min
(),
counts
.
max
()
+
BINW
,
BINW
)
heigs
,
binsf
=
np
.
histogram
(
counts
,
bines
[
bines
>
T0
])
Stat_Heigths
.
append
(
heigs
)
Stat_Bins
.
append
(
binsf
)
#%%
#plt.figure()
#plt.plot(Stat_Bins[0][:-1], Stat_Heigths[0])
plt
.
figure
()
plt
.
hist
(
Stat_Heigths
[
0
],
bins
=
np
.
arange
(
100
,
350
,
1
),
histtype
=
'step'
)
analisis/plots/20221017_IonStatistics/Simulaciones/OBE3levels_chtime_fitting.py
0 → 100644
View file @
7b896a0e
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
OBE3levels_functions
import
*
from
scipy.optimize
import
curve_fit
from
scipy.stats
import
poisson
,
norm
import
os
import
sys
plt
.
ion
()
"""
Este código simula la dinámica temporal de un ion de calcio sometido a un láser UV y dos láseres IR.
"""
def
expo
(
T
,
tau
,
N0
,
C
):
#global T0
return
N0
*
np
.
exp
(
-
(
T
-
0e-6
)
/
tau
)
+
C
ADD_NOISE
=
True
NOISE_VAR
=
30
# Varianza del ruido
NOISE_ADJ
=
78
# Escaleo del ruido versus el maximo
NOISE_MEAN
=
0
# Media del ruido
NRO_REPS
=
100
# Veces a promediar
species
=
'Calcium'
#Parámetros de saturacion de los láseres rebombeo (IR), que son proporcionales a la intensidad de los mismos
#Para reproducir SP, hay que poner 0 a los dos
SatParRep1
,
SatParRep2
=
0
,
0
sat_intensity
=
43.3e-5
# uW um-2
g21
=
135591138.92893547
#El número de los láseres IR aplicados en el experimento. Para el experimento de la transicion SP, es 0.
Number_IR_lasers
=
0
#Detunings de los láseres en MHz. Si es 0, están en resonancia. En principio
#podría ser un parámetro libre a ajustar porque influye mucho
DetDoppler
=
-
int
(
sys
.
argv
[
1
])
DetRep2
=
0
DetRep1
=
0
#Anchos de línea de los láseres, en MHz. No son tan cruciales, están entre 0.1 y 0.5 MHz
DopplerLaserLinewidth
,
RepumpLaserLinewidth
=
1e3
,
1
# Para trabajar con las curvas teóricas:
# range_inicio = np.arange(sat_intensity/10, sat_intensity, sat_intensity/50)
# range_fin = np.arange(sat_intensity, 30*sat_intensity, sat_intensity/5)
# laser_intensities = np.append(range_inicio, range_fin)
# Para trabajar con nuestros datos, saco las intensidades, a un radio de 100um:
laser_intensities
=
np
.
array
([
0.00662085
,
0.00582507
,
0.0049338
,
0.00397887
,
0.00305577
,
0.00226
,
0.00155972
,
0.00101859
,
0.00060479
,
0.00031831
])
OmegaRabi2
=
(
g21
**
2
)
*
(
laser_intensities
/
sat_intensity
)
SatParDopplerVec
=
OmegaRabi2
/
((
DetDoppler
*
2
*
np
.
pi
*
1e6
)
**
2
+
g21
**
2
)
#Parámetros de la simulación, en us
tfinOBE
=
1
pasoOBE
=
1e-5
#Estado electrónico inicial de la simulacion. Posibilidades: |S> = 1, |P> = 2, |D> = 3
initial_state
=
1
#Corre y simula la dinámica. Devuelve elementos de matriz densidad
# fig1, ax1 = plt.subplots()
alltaus
=
list
()
allN0
=
list
()
allmeans
=
list
()
allstds
=
list
()
temporal_taus
=
list
()
temporal_N0
=
list
()
for
i
,
SatParDoppler
in
enumerate
(
SatParDopplerVec
):
t
,
RealRho11
,
RealRho22
,
RealRho33
,
AbsRho12
,
AbsRho13
,
AbsRho23
=
Solve3LevelBloch
(
EquationSystemModel
,
species
,
SatParDoppler
,
SatParRep1
,
SatParRep2
,
DetDoppler
,
DetRep1
,
DetRep2
,
DopplerLaserLinewidth
,
RepumpLaserLinewidth
,
no_IR_lasers
=
Number_IR_lasers
,
initcond
=
initial_state
,
tfin
=
tfinOBE
,
paso
=
pasoOBE
,
printprogress
=
False
)
k
=
int
(
0.1
*
len
(
t
))
#parametro para que fitee solo la parte final
k
=
np
.
argmin
(
np
.
abs
(
t
-
0.2e-6
))
temporal_taus
=
list
()
incert_estad
=
0
for
nro_rep
in
range
(
NRO_REPS
):
poblacion_fit
=
RealRho22
[
k
:]
.
copy
()
if
ADD_NOISE
:
# Genero ruido similar al medido
ruido_poisson
=
poisson
.
rvs
(
NOISE_VAR
,
size
=
len
(
poblacion_fit
))
# Reescaleo el ruido para que sea compatible con las simulaciones
ruido_poisson
*=
np
.
max
(
poblacion_fit
)
/
NOISE_ADJ
poblacion_fit
+=
ruido_poisson
# poblacion_fit += norm.rvs(0, NOISE_VAR, size=len(poblacion_fit))*np.max(poblacion_fit)/NOISE_ADJ
poblacion_fit
[
np
.
where
(
poblacion_fit
<
0
)]
=
0
# Limpio posibles valores negativos
t_fit
=
t
[
k
+
1
:]
popt
,
pcov
=
curve_fit
(
expo
,
t_fit
,
poblacion_fit
,
p0
=
(
1e-6
,
1e-2
,
1e-2
))
temporal_taus
.
append
(
popt
[
0
])
incert_estad
+=
np
.
sqrt
(
pcov
[
0
,
0
])
# temporal_N0.append(popt[1])
if
not
ADD_NOISE
:
# si no quiere que agregue ruido, entonces solo hace el for una vez
break
print
(
f
" {nro_rep} "
,
end
=
'
\r
'
)
if
ADD_NOISE
:
allmeans
.
append
(
np
.
mean
(
temporal_taus
))
allstds
.
append
(
np
.
std
(
temporal_taus
)
+
incert_estad
/
NRO_REPS
)
else
:
allmeans
.
append
(
np
.
mean
(
temporal_taus
))
#ploteo en funcion de 100*Rho22 para que me devuelva en porcentaje la población del excitado que es proporcional a la fluorescencia detectada
# lbl='Detuning Rep1:' + str(DetRep1) + ' MHz'
# ax1.plot(t[:-1]*1e6, RealRho22, '.', label=lbl, markersize=1)
# ax1.plot(t[:-1]*1e6, 100*RealRho22, '.', label=lbl, markersize=1)
# ax1.plot(t_fit*1e6, 100*expo(t_fit, *popt))
print
(
f
'({i:02d}/{len(SatParDopplerVec)}) Done {SatParDoppler}'
.
ljust
(
50
,
' '
))
# ax1.legend(SatParDopplerVec)
# ax1.set_xlabel('Time (us)')
# ax1.set_ylabel('100*Rho22')
#%% #####################################################################################
### Guardo valores al CSV para analizar luego
# nDet=f"Det{np.abs(DetDoppler)}"
# CSV_FNAME = f"error_teorico_tau_{nDet}.csv"
# try:
# import pandas as pd
# data = pd.read_csv(CSV_FNAME)
# data["meanval"] = allmeans
# data["stdval"] = allstds
# data.to_csv(CSV_FNAME, index=False)
# print(f"SAVED {nDet}".ljust(50, ' '))
# except FileNotFoundError:
# data = pd.DataFrame({'I': laser_intensities, "meanval": allmeans, "stdval": allstds})
# data.to_csv(CSV_FNAME, index=False)
# print(f"CREATED CSV FILE".ljust(50, ' '))
# print(f"SAVED DETUNING {-DetDoppler}".ljust(50, ' '))
#%% ####################################################################################
### Plots de los valores de intensidades medidas para distintos parametros
### Cada axes arma un eje horizontal distinto, es para comparar las posibilidades
# fig4, ax4 = plt.subplots()
# allmeans = [t*1e6 for t in allmeans]
# ax4b = ax4.twinx()
# ax4.plot(SatParDopplerVec, allmeans, '-o', lw=0.4)
# ax4b.plot(SatParDopplerVec, allN0, 'k-^', lw=0.4)
# ax4.set_xlabel("Parametro de saturación")
# ax4.set_ylabel("Tau (circulo)")
# ax4b.set_ylabel("Alturas (triang)")
# ax4.set_title(f"SP; IR_Lasers=0; DetuningDoppler={DetDoppler}; LineWidth={DopplerLaserLinewidth}")
# ax4by = ax4.twiny()
# ax4by.plot(laser_intensities, allmeans, '-', lw=0)
# ax4by.xaxis.set_label_position('bottom')
# ax4by.xaxis.tick_bottom()
# ax4by.spines['bottom'].set_position(("axes", -0.27))
# ax4by.set_xlabel(r"Intensidad [ $\mu$W/$\mu$m$^2$ ]")
# ax4cy = ax4.twiny()
# ax4cy.plot(laser_intensities*np.pi*(35**2), allmeans, '-', lw=0)
# ax4cy.xaxis.set_label_position('bottom')
# ax4cy.xaxis.tick_bottom()
# ax4cy.spines['bottom'].set_position(("axes", -0.58))
# ax4cy.set_xlabel(r"Potencia (r=35$\mu$m) [ $\mu$W ]")
# ax4dy = ax4.twiny()
# ax4dy.plot(laser_intensities*np.pi*(50**2), allmeans, '-', lw=0)
# ax4dy.xaxis.set_label_position('bottom')
# ax4dy.xaxis.tick_bottom()
# ax4dy.spines['bottom'].set_position(("axes", -0.9))
# ax4dy.set_xlabel(r"Potencia (r=50$\mu$m) [ $\mu$W ]")
analisis/plots/20221017_IonStatistics/Simulaciones/OBE3levels_functions.py
0 → 100644
View file @
7b896a0e
This diff is collapsed.
Click to expand it.
analisis/plots/20221017_IonStatistics/Simulaciones/error_teorico_tau_det20.csv
0 → 100644
View file @
7b896a0e
I,meanval,stdval
0.00662085,2.63563456542463e-07,3.62795752e-08
0.00582507,2.674966392578803e-07,3.99478821e-08
0.0049338,2.7426723419290064e-07,3.66249293e-08
0.00397887,2.8263714050526124e-07,3.83554920e-08
0.00305577,2.9770905441813384e-07,3.90291265e-08
0.00226,3.1786383950851434e-07,4.27893803e-08
0.00155972,3.562791436115684e-07,4.67339215e-08
0.00101859,4.198979464288562e-07,5.28900825e-08
0.00060479,5.457916989936301e-07,6.95843326e-08
0.00031831,8.275611779916097e-07,1.30369576e-07
analisis/plots/20221017_IonStatistics/Simulaciones/medidos_powers_taus.csv
0 → 100644
View file @
7b896a0e
Pow,Tau,N0
208.0,4.107136373675053e-07,242.3949275128121
183.0,3.994370315889412e-07,255.700355179914
155.0,4.4882562779198994e-07,226.84461233128172
125.0,4.727871415748306e-07,217.84774878119222
96.0,5.254285404397582e-07,222.57732196795308
71.0,6.079817946589069e-07,189.5426628192835
49.0,7.274218641328625e-07,168.69185328968453
32.0,8.823248220314772e-07,140.40570782757854
19.0,1.280491601444429e-06,90.5188484395718
10.0,1.96934320559994e-06,60.092743064494314
analisis/plots/20221017_IonStatistics/Simulaciones/plot_decaytimes_vs_intensity_detunings.py
0 → 100644
View file @
7b896a0e
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
#plt.ion()
dataREAL
=
pd
.
read_csv
(
"medidos_powers_taus.csv"
)
dataSIM
=
pd
.
read_csv
(
"sim_intensidad_taus_full.csv"
)
errsSIM
=
pd
.
read_csv
(
"error_teorico_tau_det20.csv"
)
I_sat
=
43.3
*
1e-5
#uW/um2
#%% #####################################################################################
### Plot de lineas teoricas tau-intensidad variando detuning + datos medidos
fig2
,
ax2
=
plt
.
subplots
()
detuning_lines
=
[
'Det10'
,
'Det20'
,
'Det30'
,
'Det40'
,
'Det50'
,
'Det60'
,
'Det70'
,
'Det80'
,
'Det90'
]
# Curvas de las simulaciones con tau en unidades de microseg
for
det
in
detuning_lines
:
ax2
.
plot
(
dataSIM
.
I
,
dataSIM
[
det
]
*
1e6
,
'k-'
,
ms
=
1
,
lw
=
0.5
)
# Curvas de las mediciones cambiando el radio posible con tau en microseg
for
cambio
in
[
0
]:
# esto es para shiftear la potencia medida
potencias
=
dataREAL
.
Pow
-
cambio
for
rad
in
[
85.7
]:
# esto evalua con distintos radios
ax2
.
errorbar
([
p
/
(
np
.
pi
*
(
rad
**
2
))
for
p
in
UVpotVec
],
Taus
,
yerr
=
np
.
mean
(
1e6
*
errsSIM
.
stdval
.
values
),
fmt
=
'.--'
,
ms
=
6
,
lw
=
.5
,
\
color
=
"#3949ab"
,
capsize
=
3
)
#ax2.errorbar(potencias/(np.pi*(rad**2)), dataREAL.Tau*1e6, \
# yerr = 1e6*errsSIM.stdval.values, \
# fmt='.--', ms=6, lw=.5, \
# color="#3949ab",
# capsize=3,
# label=f'r={rad}; cambio={cambio}')
ax2
.
set_xlim
([
1.2e-4
,
0.2e-1
])
ax2
.
set_ylim
([
2e-1
,
0.8e1
])
ax2
.
set_ylabel
(
r"$\tau$ [$\mu$s]"
)
#ax2.set_xlabel(r"$I = P / (\pi\,r^2)$ [$\mu$W/$\mu$m$^2$]")
ax2
.
set_xlabel
(
r'UV intensity ($\mu$W/$\mu$m$^2$)'
)
# ax2.set_title(r"datos(punteadas) $r \in [30; 190]\ \mu m$ | simulacion(llenas) $\Delta \in -[10; 90]$ MHz")
#ax2.legend(markerscale=2)
ax2
.
grid
(
which
=
'minor'
,
alpha
=
0.2
)
ax2
.
set_xscale
(
"log"
)
ax2
.
set_yscale
(
"log"
)
analisis/plots/20221017_IonStatistics/Simulaciones/sim_intensidad_taus_full.csv
0 → 100644
View file @
7b896a0e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment