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
282ee988
Commit
282ee988
authored
May 16, 2023
by
Nicolas Nunez Barreto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agrego todo antes de cagarla
parent
77c85b50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
366 additions
and
0 deletions
+366
-0
Both_spectrum_withcalib_delaysfixed_TwoIRLasers.py
.../Mixed/Both_spectrum_withcalib_delaysfixed_TwoIRLasers.py
+366
-0
No files found.
artiq_master/repository/Experiments/Spectrum/With_calibration/Mixed/Both_spectrum_withcalib_delaysfixed_TwoIRLasers.py
0 → 100644
View file @
282ee988
from
artiq.experiment
import
*
from
pyLIAF.artiq.controllers
import
UrukulCh
#from artiq.coredevice.ad9910 import PHASE_MODE_ABSOLUTE
import
time
import
numpy
as
np
class
BothLasers_Scan_withcal_optimized
(
EnvExperiment
):
"""PENDING - Frequency sweep for all lasers"""
def
build
(
self
):
# Agrego kernel invariants a ver si mejoro algo de la performance
kernel_invariants
=
getattr
(
self
,
'kernel_invariants'
,
set
())
self
.
kernel_invariants
=
kernel_invariants
|
{
"no_measures"
,
"t_cool"
,
"t_trans"
,
"t_readout"
}
self
.
setattr_device
(
"core"
)
self
.
setattr_device
(
"ccb"
)
self
.
pmt
=
self
.
get_device
(
"ttl0"
)
self
.
laserUV
=
UrukulCh
(
self
,
ch
=
2
,
freq
=
110.0
,
amp
=
0.3
,
name
=
"UV"
)
#corresponde a 0.7 Vpp
self
.
laserIR1
=
UrukulCh
(
self
,
ch
=
1
,
freq
=
208.0
,
amp
=
0.35
,
name
=
"IR1"
)
#corresponde a 0.8 Vpp
self
.
laserIR2
=
UrukulCh
(
self
,
ch
=
3
,
freq
=
80.0
,
amp
=
0.2
,
name
=
"IR2"
)
#corresponde a 0.8 Vpp
self
.
laserIR2shift
=
UrukulCh
(
self
,
ch
=
0
,
freq
=
270.0
,
amp
=
0.7
,
name
=
"IR2shift"
)
#corresponde a 0.8 Vpp
self
.
setattr_argument
(
"Fine_scan"
,
BooleanValue
(
1
==
0
),
"Experiment params"
)
self
.
setattr_argument
(
"no_measures"
,
NumberValue
(
2000
,
min
=
1
,
ndecimals
=
0
,
step
=
1
),
"Experiment params"
)
self
.
setattr_argument
(
f
"IR1_cooling_freq"
,
NumberValue
(
229
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"Cooling params"
)
self
.
setattr_argument
(
f
"IR1_cooling_amp"
,
NumberValue
(
0.25
,
min
=
0.0
,
max
=
0.35
),
"Cooling params"
)
self
.
setattr_argument
(
f
"UV_cooling_freq"
,
NumberValue
(
112
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"Cooling params"
)
self
.
setattr_argument
(
f
"UV_cooling_amp"
,
NumberValue
(
0.1
,
min
=
0.0
,
max
=
0.3
),
"Cooling params"
)
self
.
setattr_argument
(
f
"IR2_cooling_freq"
,
NumberValue
(
80
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"Cooling params"
)
self
.
setattr_argument
(
f
"IR2_cooling_amp"
,
NumberValue
(
0.3
,
min
=
0.0
,
max
=
0.8
),
"Cooling params"
)
self
.
setattr_argument
(
f
"UV_CPT_freq"
,
NumberValue
(
118
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"CPT params"
)
self
.
setattr_argument
(
f
"UV_CPT_amp"
,
NumberValue
(
0.1
,
min
=
0.000
,
max
=
0.300
,
step
=
0.001
),
"CPT params"
)
self
.
setattr_argument
(
f
"IR2_CPT_freq"
,
NumberValue
(
85
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"CPT params"
)
self
.
setattr_argument
(
f
"IR2_CPT_amp"
,
NumberValue
(
0.3
,
min
=
0.
,
max
=
0.8
),
"CPT params"
)
self
.
setattr_argument
(
f
"IR1_final_freq"
,
NumberValue
(
229
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"Final params"
)
self
.
setattr_argument
(
f
"IR1_final_amp"
,
NumberValue
(
0.23
,
min
=
0.0
,
max
=
0.35
),
"Final params"
)
self
.
setattr_argument
(
f
"UV_final_freq"
,
NumberValue
(
115
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"Final params"
)
self
.
setattr_argument
(
f
"UV_final_amp"
,
NumberValue
(
0.11
,
min
=
0.0
,
max
=
0.3
),
"Final params"
)
self
.
setattr_argument
(
f
"IR2_final_freq"
,
NumberValue
(
80
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
"Final params"
)
self
.
setattr_argument
(
f
"IR2_final_amp"
,
NumberValue
(
0.3
,
min
=
0.0
,
max
=
0.8
),
"Final params"
)
self
.
setattr_argument
(
f
"t_cool"
,
NumberValue
(
1000
*
us
,
unit
=
'us'
,
scale
=
us
,
min
=
1
*
us
),
"Experiment params"
)
self
.
setattr_argument
(
f
"t_trans"
,
NumberValue
(
10
*
us
,
unit
=
'us'
,
scale
=
us
,
min
=
1
*
us
),
"Experiment params"
)
self
.
setattr_argument
(
f
"t_readout"
,
NumberValue
(
50
*
us
,
unit
=
'us'
,
scale
=
us
,
min
=
1
*
us
),
"Experiment params"
)
self
.
setattr_argument
(
f
"t_heating"
,
NumberValue
(
1
*
ms
,
unit
=
'ms'
,
scale
=
ms
),
"Experiment params"
)
self
.
setattr_argument
(
"Heating"
,
BooleanValue
(
1
==
0
),
"Experiment params"
)
self
.
setattr_argument
(
"Scan_type"
,
EnumerationValue
([
"Calibrated_scan"
,
"Defined_scan"
]),
"Scan params"
)
self
.
setattr_argument
(
"Scanning_frequencies"
,
Scannable
(
default
=
CenterScan
(
210
*
MHz
,
20
*
MHz
,
0.1
*
MHz
),
unit
=
"MHz"
,
scale
=
MHz
,
global_min
=
1
*
MHz
,
global_max
=
400
*
MHz
),
"Scan params"
)
self
.
setattr_argument
(
"Comments"
,
StringValue
(
" "
),
"General comments"
)
@
rpc
def
create_datasets
(
self
):
#self.set_dataset("measurements", np.zeros(len(self.UV_Freqs.sequence)*self.no_measures, dtype=int), broadcast=True, archive=True)
#self.set_dataset("counts_spectrum", np.zeros(len(self.UV_Freqs.sequence), dtype=int), broadcast=True, archive=True)
#self.set_dataset("UV_frequencies", self.UV_Freqs.sequence, broadcast=True, archive=True)
#self.set_dataset("UV_amplitudes", self.Test_Experiment_amps, broadcast=True, archive=True)
#freqs = self.get_dataset("UV_Frequencies")
self
.
set_dataset
(
"no_measures"
,
self
.
no_measures
,
broadcast
=
True
,
archive
=
True
)
#self.set_dataset("no_frequencies", len(self.UV_Freqs.sequence), broadcast=True, archive=True)
self
.
set_dataset
(
"IR1_cooling_freq"
,
self
.
IR1_cooling_freq
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"IR1_cooling_amp"
,
self
.
IR1_cooling_amp
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"UV_cooling_freq"
,
self
.
UV_cooling_freq
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"UV_cooling_amp"
,
self
.
UV_cooling_amp
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"IR2_cooling_freq"
,
self
.
IR2_cooling_freq
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"IR2_cooling_amp"
,
self
.
IR2_cooling_amp
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"UV_CPT_freq"
,
self
.
UV_CPT_freq
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"UV_CPT_amp"
,
self
.
UV_CPT_amp
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"IR2_CPT_freq"
,
self
.
IR2_CPT_freq
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"IR2_CPT_amp"
,
self
.
IR2_CPT_amp
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"t_cool"
,
self
.
t_cool
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"t_trans"
,
self
.
t_trans
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"t_readout"
,
self
.
t_readout
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"t_heating"
,
self
.
t_heating
,
broadcast
=
False
,
archive
=
True
)
self
.
set_dataset
(
"Comments"
,
self
.
Comments
,
broadcast
=
False
,
archive
=
True
)
#self.set_dataset("calibration", self.get_dataset())
#self.laserIR1.generate_dataset()
#self.laserUV.generate_dataset()
@
rpc
(
flags
=
{
"async"
})
def
create_applets
(
self
,
no_freqs
):
self
.
ccb
.
issue
(
"create_applet"
,
"IR_espectro_fixeddelays"
,
"${python} -m pyLIAF.artiq.applets.plot_xy "
"counts_spectrum "
"--x IR1_Frequencies"
)
self
.
ccb
.
issue
(
"create_applet"
,
"Scanning_amps"
,
"${python} -m pyLIAF.artiq.applets.plot_xy "
"IR1_Amplitudes "
"--x IR1_Frequencies"
)
@
rpc
def
Get_Calibrated_Frequencies
(
self
)
->
TList
(
TFloat
):
if
self
.
Fine_scan
:
Calibrated_Experiment_freqs
=
self
.
get_dataset
(
"Experiment_freqs_IR_fine"
)
else
:
Calibrated_Experiment_freqs
=
self
.
get_dataset
(
"Experiment_freqs_IR"
)
self
.
set_dataset
(
"IR1_Frequencies_calibrated"
,
np
.
array
(
Calibrated_Experiment_freqs
),
broadcast
=
True
,
archive
=
True
)
if
self
.
Scan_type
==
"Calibrated_scan"
:
Experiment_freqs
=
Calibrated_Experiment_freqs
elif
self
.
Scan_type
==
"Defined_scan"
:
Experiment_freqs
=
self
.
Scanning_frequencies
.
sequence
self
.
set_dataset
(
"IR1_Frequencies"
,
np
.
array
(
Experiment_freqs
),
broadcast
=
True
,
archive
=
True
)
self
.
set_dataset
(
"no_freqs"
,
len
(
Calibrated_Experiment_freqs
),
broadcast
=
True
,
archive
=
True
)
self
.
set_dataset
(
"counts_spectrum"
,
np
.
zeros
(
len
(
Experiment_freqs
),
dtype
=
int
),
broadcast
=
True
,
archive
=
True
)
return
Experiment_freqs
@
rpc
def
Get_Calibrated_Amplitudes
(
self
)
->
TList
(
TFloat
):
if
self
.
Fine_scan
:
Calibrated_Experiment_amps
=
list
(
self
.
get_dataset
(
"Experiment_amps_IR_fine"
))
else
:
Calibrated_Experiment_amps
=
list
(
self
.
get_dataset
(
"Experiment_amps_IR"
))
self
.
set_dataset
(
"IR1_Amplitudes_calibrated"
,
Calibrated_Experiment_amps
,
broadcast
=
True
,
archive
=
True
)
if
self
.
Scan_type
==
"Calibrated_scan"
:
Experiment_amps
=
Calibrated_Experiment_amps
elif
self
.
Scan_type
==
"Defined_scan"
:
Experiment_amps
=
[]
Experiment_freqs
=
self
.
Scanning_frequencies
.
sequence
if
self
.
Fine_scan
:
Calibrated_Experiment_freqs
=
self
.
get_dataset
(
"Experiment_freqs_IR_fine"
)
else
:
Calibrated_Experiment_freqs
=
self
.
get_dataset
(
"Experiment_freqs_IR"
)
for
f
in
Experiment_freqs
:
idx
=
(
np
.
abs
(
np
.
asarray
(
Calibrated_Experiment_freqs
)
-
f
))
.
argmin
()
#busco el valor mas cercano en las freqs calibradas
Experiment_amps
.
append
(
Calibrated_Experiment_amps
[
idx
])
self
.
set_dataset
(
"IR1_Amplitudes"
,
Experiment_amps
,
broadcast
=
True
,
archive
=
True
)
return
Experiment_amps
@
kernel
def
run
(
self
):
t_cool_mu
=
self
.
core
.
seconds_to_mu
(
self
.
t_cool
)
# Precomputo esto para despues
cuentas
=
0
Freqs
=
self
.
Get_Calibrated_Frequencies
()
#Freqs = self.UV_Freqs.sequence
Amps
=
self
.
Get_Calibrated_Amplitudes
()
self
.
create_datasets
()
self
.
create_applets
(
len
(
Freqs
))
self
.
init_kernel
()
delay
(
1
*
ms
)
self
.
laserIR1
.
on
()
self
.
laserIR2
.
on
()
self
.
laserIR2shift
.
on
()
self
.
laserUV
.
on
()
self
.
enfriar_ion
()
iter_index
=
0
while
iter_index
<
len
(
Freqs
):
#print(Freqs[iter_index])
#print(Amps[iter_index])
Accumulated_counts
=
0
delay
(
10000
*
us
)
self
.
laserIR1
.
set_frequency
(
Freqs
[
iter_index
],
Amps
[
iter_index
],
profile
=
1
)
# Cambio la frec del perfil 1 (estoy en el 0)
for
runN
in
range
(
self
.
no_measures
):
if
runN
%
20
==
0
:
delay
(
self
.
t_cool
)
else
:
delay
(
100
*
us
)
if
self
.
Heating
:
self
.
laserUV
.
off
()
delay
(
self
.
t_heating
)
self
.
laserUV
.
on
()
#self.enfriar_ion()
#delay(0.001*self.t_heating)
cuentas
=
self
.
readout
()
# Hago la medicion y vuelvo con las cuentas
Accumulated_counts
=
Accumulated_counts
+
cuentas
self
.
mutate_dataset
(
"counts_spectrum"
,
iter_index
,
Accumulated_counts
)
delay
(
5000
*
us
)
iter_index
=
iter_index
+
1
delay
(
500
*
us
)
self
.
laserUV
.
select_profile
(
1
)
self
.
laserIR1
.
select_profile
(
1
)
self
.
laserIR2
.
select_profile
(
1
)
self
.
laserUV
.
set_frequency
(
self
.
UV_final_freq
,
self
.
UV_final_amp
,
profile
=
1
)
self
.
laserIR2shift
.
set_frequency
(
270
*
MHz
,
0.7
,
profile
=
1
)
self
.
laserIR1
.
set_frequency
(
self
.
IR1_final_freq
,
self
.
IR1_final_amp
,
profile
=
1
)
self
.
laserIR2
.
set_frequency
(
self
.
IR2_final_freq
,
self
.
IR2_final_amp
,
profile
=
1
)
print
(
"jose maria listorti"
)
@
kernel
def
init_kernel
(
self
):
self
.
core
.
reset
()
self
.
pmt
.
input
()
#self.laserUV.initialize_channel()
#self.laserIR.initialize_channel()
delay
(
1
*
ms
)
# Seteo los perfiles 0 y 1 con los mismos valores
# el 0 va a ser el de ENFRIADO, el 1 va a ser el de MEDICION y el 2 va a ser de CALENTAMIENTO
self
.
laserIR1
.
set_channel
()
self
.
laserUV
.
set_channel
()
self
.
laserIR2
.
set_channel
()
self
.
laserIR2shift
.
set_channel
()
self
.
laserIR1
.
set_frequency
(
self
.
IR1_cooling_freq
,
self
.
IR1_cooling_amp
,
profile
=
0
)
self
.
laserIR2shift
.
set_frequency
(
270
*
MHz
,
0.7
,
profile
=
0
)
self
.
laserUV
.
set_frequency
(
self
.
UV_cooling_freq
,
self
.
UV_cooling_amp
,
profile
=
0
)
self
.
laserIR2
.
set_frequency
(
self
.
IR2_cooling_freq
,
self
.
IR2_cooling_amp
,
profile
=
0
)
self
.
laserIR1
.
set_channel
(
profile
=
1
)
self
.
core
.
break_realtime
()
self
.
laserUV
.
set_channel
(
profile
=
1
)
self
.
core
.
break_realtime
()
self
.
laserIR2shift
.
set_channel
(
profile
=
1
)
self
.
core
.
break_realtime
()
self
.
laserIR2
.
set_channel
(
profile
=
1
)
self
.
core
.
break_realtime
()
self
.
laserUV
.
set_frequency
(
self
.
UV_CPT_freq
,
self
.
UV_CPT_amp
,
profile
=
1
)
#self.laserUV.set_frequency(self.UV_CPT_freq, 0.07, profile=1)
self
.
core
.
break_realtime
()
self
.
laserIR2
.
set_frequency
(
self
.
IR2_CPT_freq
,
self
.
IR2_CPT_amp
,
profile
=
1
)
self
.
core
.
break_realtime
()
self
.
laserIR2shift
.
set_frequency
(
270
*
MHz
,
0.7
,
profile
=
1
)
#self.laserTISA.set_frequency(self.TISA_CPT_freq, 0.035, profile=1)
self
.
core
.
break_realtime
()
#self.laserIR1.set_channel(profile=2)
#self.core.break_realtime()
#self.laserUV.set_channel(profile=2)
#self.core.break_realtime()
#self.laserIR2.set_channel(profile=2)
#self.core.break_realtime()
#self.laserIR2shift.set_channel(profile=2)
#self.core.break_realtime()
#self.laserIR1.set_frequency(self.IR1_cooling_freq, self.IR1_cooling_amp, profile=2)
#self.core.break_realtime()
#self.laserIR2shift.set_frequency(270*MHz, 0.7, profile=2)
#self.core.break_realtime()
#self.laserUV.set_frequency(self.UV_cooling_freq, self.UV_cooling_amp, profile=2)
#self.core.break_realtime()
#self.laserIR2.set_frequency(self.IR2_cooling_freq, self.IR2_cooling_amp, profile=2)
# Me aseguro que todo termine antes de seguir
self
.
core
.
break_realtime
()
self
.
core
.
wait_until_mu
(
now_mu
())
@
kernel
def
enfriar_ion
(
self
):
"""Enfrio llevando el laser IR a una cierta frecuencia"""
self
.
laserIR1
.
select_profile
(
0
)
# Pongo el laser en el perfil referencia
self
.
laserUV
.
select_profile
(
0
)
# Pongo el laser en el perfil referencia
self
.
laserIR2
.
select_profile
(
0
)
self
.
laserIR2shift
.
select_profile
(
0
)
@
kernel
def
calentar_ion
(
self
):
"""Caliento el ion por un tiempo determinado apagando el laser UV"""
self
.
laserUV
.
off
()
@
kernel
def
readout
(
self
)
->
TInt64
:
"""Registro de cuentas emitidas"""
self
.
laserUV
.
select_profile
(
1
)
# Paso al perfil que cambia
self
.
laserIR1
.
select_profile
(
1
)
# Paso al perfil que cambia
self
.
laserIR2
.
select_profile
(
1
)
# Paso al perfil que cambia
self
.
laserIR2shift
.
select_profile
(
1
)
delay
(
self
.
t_trans
)
here
=
self
.
pmt
.
gate_rising
(
self
.
t_readout
)
# Que mida durante t_readout
self
.
enfriar_ion
()
# ya pongo a enfriar, asi todos los retardos estan enfriando
return
self
.
pmt
.
count
(
here
)
# recupero las cuentas medidas
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