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
a5bd07d8
Commit
a5bd07d8
authored
Jun 19, 2021
by
Lucas Giardino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subo archivos randoms que no se que son y no lei realmente
parent
391ddd82
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
520 additions
and
1 deletion
+520
-1
contar_pulsos.py
artiq_master/repository/Examples/TTL/contar_pulsos.py
+33
-0
histograms_ions.py
artiq_master/repository/Experiments/histograms_ions.py
+62
-0
pmt_calibration_chunks.py
...q_master/repository/Experiments/pmt_calibration_chunks.py
+134
-0
pmt_calibration_realtimeplotting.py
...epository/Experiments/pmt_calibration_realtimeplotting.py
+95
-0
histograms.py
artiq_master/repository/Plotting/histograms.py
+1
-1
histograms_pmtsimulation_v2.py
...master/repository/Plotting/histograms_pmtsimulation_v2.py
+117
-0
pmt_mock_counts_display.py
artiq_master/repository/pmt_mock_counts_display.py
+78
-0
No files found.
artiq_master/repository/Examples/TTL/contar_pulsos.py
0 → 100644
View file @
a5bd07d8
from
artiq.experiment
import
*
class
TTLOUT
(
EnvExperiment
):
"""
"""
def
build
(
self
):
# Busco en el archivo device_db.py estos 'componentes', y los traigo como
# partes del constructor este.
self
.
setattr_device
(
"core"
)
self
.
setattr_device
(
"ttl4"
)
self
.
setattr_device
(
"ttl0"
)
@
kernel
def
run
(
self
):
self
.
core
.
reset
()
# self.ttl4.output()
self
.
ttl0
.
input
()
# self.ttl4.on()
pulsos_base
=
self
.
ttl0
.
count
(
now_mu
())
delay
(
3
*
ms
)
datos
=
[]
for
_
in
range
(
1
,
5
):
hasta_aca
=
self
.
ttl0
.
gate_rising
(
1000
*
ms
)
pulsos
=
self
.
ttl0
.
count
(
hasta_aca
)
datos
=
datos
+
[
pulsos
]
delay
(
3
*
ms
)
#print(_)
print
(
datos
)
artiq_master/repository/Experiments/histograms_ions.py
0 → 100644
View file @
a5bd07d8
import
numpy
as
np
from
artiq.experiment
import
*
class
HistogramsIons
(
EnvExperiment
):
"""
Plotear y guardar histogramas de iones y oscuridad
"""
def
build
(
self
):
self
.
setattr_device
(
"ccb"
)
self
.
setattr_device
(
"core"
)
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
.
laserIR
=
UrukulCh
(
self
,
ch
=
1
,
freq
=
208.0
,
amp
=
0.35
,
name
=
"IR"
)
#corresponde a 0.8 Vpp
self
.
setattr_argument
(
"Number_Measurements"
,
NumberValue
(
300
),
"Histogram Params"
)
self
.
setattr_argument
(
f
"t_readout"
,
NumberValue
(
100
*
ms
,
unit
=
'ms'
,
scale
=
ms
,
min
=
1
*
ms
),
"Histogram Params"
)
@
rpc
def
create_datasets
(
self
):
self
.
set_dataset
(
"pmt_counts_on"
,
np
.
zeros
(
self
.
Number_Measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"pmt_counts_off"
,
np
.
zeros
(
self
.
Number_Measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
@
rpc
def
create_applets
(
self
):
# self.ccb.issue("create_applet", "calibration_pmt_blinking",
# "${python} -m pyLIAF.artiq.applets.realtime "
# "200 "
# "pmt_counts_on "
# "--y2 pmt_counts_off")
pass
@
kernel
def
init_kernel
(
self
):
self
.
core
.
reset
()
self
.
pmt
.
input
()
delay
(
1
*
s
)
# print(1)
self
.
laserIR
.
initialize_channel
()
# self.core.break_realtime()
# print(2)
self
.
laserUV
.
initialize_channel
()
# self.core.break_realtime()
# print(3)
self
.
laserIR
.
set_channel
()
self
.
laserUV
.
set_channel
()
self
.
core
.
wait_until_mu
(
now_mu
())
artiq_master/repository/Experiments/pmt_calibration_chunks.py
0 → 100644
View file @
a5bd07d8
import
numpy
as
np
from
artiq.experiment
import
*
from
pyLIAF.artiq.controllers
import
UrukulCh
class
PMTCalibration
(
EnvExperiment
):
"""Not working - Chunk blinking histograms measurement for pmt calibration """
def
build
(
self
):
self
.
setattr_device
(
"ccb"
)
self
.
setattr_device
(
"core"
)
self
.
pmt
=
self
.
get_device
(
"ttl0"
)
self
.
laserUV
=
UrukulCh
(
self
,
ch
=
0
,
freq
=
110.0
,
amp
=
0.3
)
#0.7 Vpp
self
.
laserIR
=
UrukulCh
(
self
,
ch
=
1
,
freq
=
208.0
,
amp
=
0.35
)
#0.8 Vpp
self
.
setattr_argument
(
"Total_Number_measurements"
,
NumberValue
(
20
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
"Shown_measurements"
,
NumberValue
(
5
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
"Chunks"
,
NumberValue
(
5
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
f
"t_readout"
,
NumberValue
(
50
*
ms
,
unit
=
'ms'
,
scale
=
ms
,
min
=
1
*
ms
),
"Experiment params"
)
self
.
lim
=
0
@
rpc
def
process
(
self
,
i
=
0
):
self
.
measurement
=
self
.
get_dataset
(
"partial_chunk"
)
self
.
mean_value_off
=
np
.
mean
(
self
.
measurement
[
0
:
self
.
Chunks
])
self
.
mean_value_on
=
np
.
mean
(
self
.
measurement
[
self
.
Chunks
:])
self
.
mean_diff
=
self
.
mean_value_on
-
self
.
mean_value_off
self
.
mutate_dataset
(
"mean_value_off_vec"
,
i
,
self
.
mean_value_off
)
self
.
mutate_dataset
(
"mean_value_on_vec"
,
i
,
self
.
mean_value_on
)
self
.
mutate_dataset
(
"mean_diff_vec"
,
i
,
self
.
mean_diff
)
# return [self.mean_value_off, self.mean_value_on, self.mean_diff]
@
rpc
def
create_datasets
(
self
):
self
.
set_dataset
(
"partial_chunk"
,
np
.
zeros
(
2
*
self
.
Chunks
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"mean_value_off_vec"
,
np
.
zeros
(
self
.
Shown_measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"mean_value_on_vec"
,
np
.
zeros
(
self
.
Shown_measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"mean_diff_vec"
,
np
.
zeros
(
self
.
Shown_measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"bins"
,
np
.
arange
(
0
,
600
,
5
),
broadcast
=
True
,
archive
=
False
)
@
rpc
def
create_applets
(
self
):
self
.
ccb
.
issue
(
"create_applet"
,
"calibration_fluo_diff"
,
"${artiq_applet}plot_xy "
"mean_diff_vec"
,
group
=
"blinking_applets"
)
# Custom histogram plot creator (needs a reasonable --update-delay)
self
.
ccb
.
issue
(
"create_applet"
,
"calibration_fluo_diff_histo"
,
"${python} -m pyLIAF.artiq.applets.histogram "
"partial_chunk --x bins "
"--update-delay 0.5"
,
group
=
"blinking_applets"
)
@
kernel
def
run
(
self
):
self
.
create_datasets
()
self
.
create_applets
()
self
.
init_kernel
()
delay
(
100
*
ms
)
i
=
0
while
self
.
lim
<
self
.
Total_Number_measurements
:
self
.
measure_counts
()
self
.
process
(
i
)
self
.
lim
=
self
.
lim
+
1
if
i
<
self
.
Shown_measurements
-
1
:
i
=
i
+
1
else
:
i
=
0
#print(f'Done {self.lim}')
print
(
"That's all folks!"
)
@
kernel
def
readout
(
self
):
"""Registro cuentas emitidas con el laser UV prendido"""
# Prendo y apago la TTL para ver en el osc.
here
=
self
.
pmt
.
gate_rising
(
self
.
t_readout
)
self
.
pmt_state
.
pulse
(
self
.
t_readout
)
cuentas
=
self
.
pmt
.
count
(
here
)
delay
(
1
*
us
)
return
cuentas
@
kernel
def
init_kernel
(
self
):
self
.
core
.
reset
()
self
.
pmt
.
input
()
self
.
pmt_state
.
output
()
delay
(
1
*
s
)
self
.
laserIR
.
initialize_channel
()
self
.
laserUV
.
initialize_channel
()
self
.
pmt_state
.
off
()
self
.
core
.
wait_until_mu
(
now_mu
())
@
kernel
def
measure_counts
(
self
):
# bin_boundaries = np.arange(self.bin_init, self.bin_end, self.bin_step)
# self.set_dataset("hd_bins", bin_boundaries,
# broadcast=True, archive=False)
self
.
core
.
break_realtime
()
self
.
laserIR
.
off
()
for
j
in
range
(
self
.
Chunks
):
self
.
core
.
break_realtime
()
self
.
mutate_dataset
(
"partial_chunk"
,
j
,
self
.
readout
())
self
.
core
.
break_realtime
()
self
.
laserIR
.
on
()
for
j
in
range
(
self
.
Chunks
,
2
*
self
.
Chunks
):
self
.
core
.
break_realtime
()
self
.
mutate_dataset
(
"partial_chunk"
,
j
,
self
.
readout
())
artiq_master/repository/Experiments/pmt_calibration_realtimeplotting.py
0 → 100644
View file @
a5bd07d8
import
numpy
as
np
from
artiq.experiment
import
*
from
pyLIAF.artiq.controllers
import
UrukulCh
class
PMTCalibration
(
EnvExperiment
):
"""Non blinking script for pmt checking with both lasers on"""
def
build
(
self
):
self
.
setattr_device
(
"ccb"
)
self
.
setattr_device
(
"core"
)
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
.
laserIR
=
UrukulCh
(
self
,
ch
=
1
,
freq
=
208.0
,
amp
=
0.35
,
name
=
"IR"
)
#corresponde a 0.8 Vpp
self
.
setattr_argument
(
f
"t_readout"
,
NumberValue
(
100
*
ms
,
unit
=
'ms'
,
scale
=
ms
,
min
=
1
*
ms
),
"PMT Calibration"
)
@
rpc
def
create_datasets
(
self
):
self
.
set_dataset
(
"pmt_counts_on"
,
np
.
zeros
(
1
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"pmt_counts_off"
,
np
.
zeros
(
1
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
@
rpc
def
create_applets
(
self
):
self
.
ccb
.
issue
(
"create_applet"
,
"calibration_pmt_nonblinking"
,
"${python} -m pyLIAF.artiq.applets.realtime "
"200 "
"pmt_counts_on "
"--y2 pmt_counts_off"
)
@
kernel
def
init_kernel
(
self
):
self
.
core
.
reset
()
self
.
pmt
.
input
()
delay
(
1
*
s
)
print
(
1
)
self
.
laserIR
.
initialize_channel
()
self
.
core
.
break_realtime
()
print
(
2
)
self
.
laserUV
.
initialize_channel
()
self
.
core
.
break_realtime
()
print
(
3
)
self
.
core
.
wait_until_mu
(
now_mu
())
@
kernel
def
run
(
self
):
self
.
create_datasets
()
self
.
create_applets
()
self
.
init_kernel
()
delay
(
100
*
ms
)
i
=
0
self
.
core
.
break_realtime
()
self
.
laserIR
.
on
()
self
.
core
.
break_realtime
()
self
.
laserUV
.
on
()
self
.
core
.
break_realtime
()
while
True
:
self
.
measure_counts
()
@
kernel
def
readout
(
self
):
"""Registro cuentas emitidas con el laser UV prendido"""
# Prendo y apago la TTL para ver en el osc.
here
=
self
.
pmt
.
gate_rising
(
self
.
t_readout
)
cuentas
=
self
.
pmt
.
count
(
here
)
delay
(
1
*
us
)
return
cuentas
@
kernel
def
measure_counts
(
self
):
self
.
core
.
break_realtime
()
#
self
.
mutate_dataset
(
"pmt_counts_off"
,
0
,
self
.
readout
())
# self.core.break_realtime()
# self.laserIR.on()
self
.
core
.
break_realtime
()
self
.
mutate_dataset
(
"pmt_counts_on"
,
0
,
self
.
readout
())
artiq_master/repository/Plotting/histograms.py
View file @
a5bd07d8
...
...
@@ -20,7 +20,7 @@ class Histograms(EnvExperiment):
# Custom histogram plot creator (needs a reasonable --update-delay)
self
.
ccb
.
issue
(
"create_applet"
,
"ticks_histogram"
,
"${artiq_applet}plot_hist "
"histo --x hd_bins --title tit
"
f
"histo --x hd_bins --title {tit}
"
f
"--update-delay {self.histo_delay}"
,
group
=
"ExampleHistogram"
)
...
...
artiq_master/repository/Plotting/histograms_pmtsimulation_v2.py
0 → 100644
View file @
a5bd07d8
from
time
import
sleep
,
time
from
scipy.stats
import
poisson
import
numpy
as
np
from
artiq.experiment
import
*
class
MockPMT
():
#{{{
def
__init__
(
self
,
mean
=
20
):
self
.
mean
=
mean
def
count
(
self
)
->
TInt32
:
medida
=
poisson
.
rvs
(
self
.
mean
)
return
medida
def
change_mean
(
self
,
new_mean
):
self
.
mean
=
new_mean
# }}}
class
MockLaser
():
def
__init__
(
self
,
pmt
):
self
.
pmt
=
pmt
def
on
(
self
):
self
.
pmt
.
change_mean
(
500
)
sleep
(
0.1
)
def
off
(
self
):
self
.
pmt
.
change_mean
(
100
)
sleep
(
0.1
)
class
Histograms
(
EnvExperiment
):
"""Histograms mockpmt simulation blinking v2"""
def
build
(
self
):
self
.
setattr_argument
(
"Total_Number_measurements"
,
NumberValue
(
20
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
"Shown_measurements"
,
NumberValue
(
10
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
"Chunks"
,
NumberValue
(
5
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_device
(
"ccb"
)
self
.
setattr_device
(
"core"
)
def
analyze
(
self
,
i
=
0
):
self
.
measurement
=
self
.
get_dataset
(
"partial_chunk"
)
self
.
mean_value_off
=
np
.
mean
(
self
.
measurement
[
0
:
self
.
Chunks
])
self
.
mean_value_on
=
np
.
mean
(
self
.
measurement
[
self
.
Chunks
:])
self
.
mean_diff
=
self
.
mean_value_on
-
self
.
mean_value_off
return
self
.
mean_value_off
,
self
.
mean_value_on
,
self
.
mean_diff
def
run
(
self
):
self
.
set_dataset
(
"partial_chunk"
,
np
.
zeros
(
2
*
self
.
Chunks
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"mean_value_off_vec"
,
np
.
zeros
(
self
.
Shown_measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"mean_value_on_vec"
,
np
.
zeros
(
self
.
Shown_measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"mean_diff_vec"
,
np
.
zeros
(
self
.
Shown_measurements
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"bins"
,
np
.
arange
(
0
,
600
,
5
),
broadcast
=
True
,
archive
=
False
)
print
(
self
.
get_dataset
(
"bins"
))
self
.
ccb
.
issue
(
"create_applet"
,
"fluo_diff"
,
"${artiq_applet}plot_xy "
"mean_diff_vec"
,
group
=
"blinking_applets"
)
# Custom histogram plot creator (needs a reasonable --update-delay)
self
.
ccb
.
issue
(
"create_applet"
,
"fluo_diff_histo"
,
"${artiq_applet}histogram "
"partial_chunk --x bins "
"--update-delay 0.5"
,
group
=
"blinking_applets"
)
self
.
pmt
=
MockPMT
(
100
)
self
.
laser
=
MockLaser
(
self
.
pmt
)
i
=
0
self
.
lim
=
0
while
self
.
lim
<
self
.
Total_Number_measurements
:
self
.
run_kernel
()
mean_off
,
mean_on
,
mean_diff
=
self
.
analyze
(
i
)
self
.
mutate_dataset
(
"mean_value_off_vec"
,
i
,
mean_off
)
self
.
mutate_dataset
(
"mean_value_on_vec"
,
i
,
mean_on
)
self
.
mutate_dataset
(
"mean_diff_vec"
,
i
,
mean_diff
)
sleep
(
0.1
)
self
.
lim
=
self
.
lim
+
1
if
i
<
self
.
Shown_measurements
-
1
:
i
=
i
+
1
else
:
i
=
0
print
(
f
'Done {self.lim}'
)
print
(
"That's all folks!"
)
@
kernel
def
run_kernel
(
self
):
# bin_boundaries = np.arange(self.bin_init, self.bin_end, self.bin_step)
# self.set_dataset("hd_bins", bin_boundaries,
# broadcast=True, archive=False)
self
.
laser
.
off
()
for
j
in
range
(
self
.
Chunks
):
self
.
mutate_dataset
(
"partial_chunk"
,
j
,
self
.
pmt
.
count
())
self
.
laser
.
on
()
for
j
in
range
(
self
.
Chunks
,
2
*
self
.
Chunks
):
self
.
mutate_dataset
(
"partial_chunk"
,
j
,
self
.
pmt
.
count
())
sleep
(
0.3
)
artiq_master/repository/pmt_mock_counts_display.py
0 → 100644
View file @
a5bd07d8
from
artiq.experiment
import
*
import
time
import
numpy
as
np
from
scipy.stats
import
poisson
class
MockPMT
():
#{{{
def
__init__
(
self
,
mean
=
50
):
self
.
mean
=
mean
def
count
(
self
):
return
poisson
.
rvs
(
self
.
mean
)
def
change_mean
(
self
,
new_mean
):
self
.
mean
=
new_mean
# }}}
class
PMTCountRealtime
(
EnvExperiment
):
"""Realtime PMT counts visualization"""
def
build
(
self
):
self
.
setattr_argument
(
"no_measures"
,
NumberValue
(
10
,
min
=
1
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
"freqs"
,
Scannable
(
default
=
CenterScan
(
200
*
MHz
,
20
*
MHz
,
1
*
MHz
),
unit
=
"MHz"
,
scale
=
MHz
,
global_min
=
1
*
MHz
,
global_max
=
400
*
MHz
)
)
self
.
setattr_device
(
"ccb"
)
# To issue the applets
self
.
pmt
=
MockPMT
(
mean
=
6
)
def
run
(
self
):
self
.
set_dataset
(
"current_freq"
,
np
.
full
(
1
,
0.
),
broadcast
=
True
,
archive
=
False
)
# Applet creation {{{
self
.
ccb
.
issue
(
"create_applet"
,
"output_frecuency"
,
"${artiq_applet}big_number "
"current_freq"
,
group
=
"realtime_pmt"
)
self
.
ccb
.
issue
(
"create_applet"
,
"ticks_plot"
,
"${artiq_applet}plot_xy "
"ticks"
,
group
=
"realtime_pmt"
)
# Custom histogram plot creator (needs a reasonable --update-delay)
self
.
ccb
.
issue
(
"create_applet"
,
"ticks_histogram"
,
"${artiq_applet}histogram "
"ticks "
"--update-delay 0.5"
,
group
=
"realtime_pmt"
)
# }}}s
# # Change freq and read {{{
# # this emulates a change in frequency, then many pmt readings
# # and storing (displaying) the mean
# self.set_dataset("ticks", np.full(len(self.freqs), np.nan),
# broadcast=True, archive=False)
# counts = 0
# for fn, curr_freq in enumerate(self.freqs):
# self.mutate_dataset("current_freq", 0, curr_freq)
# # self.pmt.change_mean(60 + 5*fn)
# counts = 0
# for i in range(self.no_measures):
# counts += self.pmt.count()
# time.sleep(20e-6)
# self.mutate_dataset("ticks", fn, counts/self.no_measures)
# # }}}
# PMT count reading {{{
# This emulates just reading from the PMT: e.g. dark counts distr
self
.
set_dataset
(
"ticks"
,
np
.
full
(
self
.
no_measures
,
np
.
nan
),
broadcast
=
True
,
archive
=
False
)
for
i
in
range
(
self
.
no_measures
):
self
.
mutate_dataset
(
"ticks"
,
i
,
self
.
pmt
.
count
())
time
.
sleep
(
20e-3
)
# }}}
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