1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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
import scipy.stats as sts
import seaborn as sns
os.chdir('/home/nico/Documents/artiq_experiments/analisis/plots/20221017_IonStatistics')
plt.rcParams.update({
"font.family": "STIXGeneral"
})
plt.rcParams.update({
"font.size": 14
})
# Solo levanto algunos experimentos
Stat_files = [8731, 8738, 8745, 8819, 8820, 8822]
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 = []
OnOff_Heights = []
OnOff_Bins = []
for i, fname in enumerate(Stat_files[0:3]):
#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)
for i, fname in enumerate(Stat_files[3:6]):
#print(i)
#print(fname)
try:
data = h5py.File('Data/00000'+str(fname)+'-SingleLine.h5', 'r')
except:
data = h5py.File('Data/00000'+str(fname)+'-StationaryFluo.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])
OnOff_Heights.append(heigs)
OnOff_Bins.append(binsf)
#%%
import matplotlib
import seaborn as sns
matplotlib.rcParams['mathtext.fontset'] = 'stix'
matplotlib.rcParams['font.family'] = 'STIXGeneral'
plt.style.use('seaborn-bright')
plt.rcParams.update({
"text.usetex": False,
})
#plt.figure()
#plt.plot(Stat_Bins[0][:-1], Stat_Heigths[0])
#plot figuras papers
colors1=sns.color_palette("rocket", 10)
colors2=sns.color_palette("mako", 10)
color2 = colors2[1]
color3 = colors2[4]
color1 = colors2[8]
bins1 = np.arange(150,300, 1)
bins2 = np.arange(0,50,1)
bins3 = np.arange(30,100,1)
"""
FIGURA ESTADISTICA POISSON
"""
plt.figure(figsize = (3.8,2.8))
plt.hist(Stat_Heigths[0], bins=bins1, histtype='step',density = True,color = color1, alpha = 0.6)#,label = 'BG')
plt.hist(Stat_Heigths[1], bins=bins2, histtype='step',density = True,color = color2, alpha = 0.6)#,label = 'UV laser')
plt.hist(Stat_Heigths[2], bins=bins3, histtype='step',density = True,color = color3, alpha = 0.6)#,label = 'Ion')
poisson1= sts.poisson.pmf(bins1,np.mean(Stat_Heigths[0]))
poisson2= sts.poisson.pmf(bins2,np.mean(Stat_Heigths[1]))
poisson3= sts.poisson.pmf(bins3,np.mean(Stat_Heigths[2]))
plt.plot(bins2+0.5,poisson2,color = color2,label = 'Background')
plt.plot(bins3+0.5,poisson3,color = color3,label = 'UV laser')
plt.plot(bins1+0.5,poisson1,color = color1,label = 'Ion')
plt.legend(loc=(0.15,0.65), prop={'size': 11})
plt.grid()
plt.tight_layout()
plt.xticks([0, 100, 200, 300], fontname='STIXGeneral')
plt.yticks([0,0.02, 0.04, 0.06, 0.08], fontname='STIXGeneral')
plt.xlabel('Counts', fontname='STIXGeneral')
plt.ylabel('Event frequency', fontname='STIXGeneral')
#poissoneidad = np.var(Stat_Heigths)/np.mean(Stat_Heigths)
#plt.title('Varianza/media = {:.4f}'.format(poissoneidad))
#plt.savefig('bg_laser_ion_stats.pdf',dpi = 600 )
name='fig01a'
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.svg')
#%%
import matplotlib
matplotlib.rcParams['mathtext.fontset'] = 'stix'
matplotlib.rcParams['font.family'] = 'STIXGeneral'
plt.style.use('seaborn-bright')
plt.rcParams.update({
"text.usetex": False,
})
"""
FIGURA BACKGROUND, ENCENDIDO AOM Y ENCENDIDO ION
"""
plt.figure(figsize=(4.5,3))
plt.plot([s*1e6 for s in OnOff_Bins[1][:-1]],OnOff_Heights[1], color=color2)
plt.plot([s*1e6 for s in OnOff_Bins[0][:-1]],[(OnOff_Heights[0][j]-OnOff_Heights[1][j])*3.13+OnOff_Heights[1][j] for j in range(len(OnOff_Heights[0]))], color=color3)
plt.plot([s*1e6 for s in OnOff_Bins[2][:-1]],OnOff_Heights[2], color=color1)
plt.xlim(0,1)
plt.grid()
plt.xlabel(r'Time ($\mu$s)', fontname='STIXGeneral')
plt.ylabel(r'Counts /10$~\mu$s', fontname='STIXGeneral')
plt.xticks([0,0.2, 0.4, 0.6, 0.8, 1], fontname='STIXGeneral')
plt.yticks([0,5000, 10000], fontname='STIXGeneral')
plt.tight_layout()
name='fig01b'
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'.pdf')
#plt.savefig('/home/nico/Nextcloud/G_liaf/Publicaciones/Papers/2022 Transient Phenomena JOSA B/Figures/'+name+'_dump.svg')