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
cb287172
Commit
cb287172
authored
Jun 19, 2021
by
Lucas Giardino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
limpio algunos archivos que fueron quedando
parent
2fed3ca3
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
2108 deletions
+0
-2108
histograms_pmtsimulation.py
artiq_master/repository/Plotting/histograms_pmtsimulation.py
+0
-71
exp1_vcd.vcd
artiq_master/repository/exp1_vcd.vcd
+0
-1754
exp_1.py
artiq_master/repository/exp_1.py
+0
-87
histogram.py
artiq_master/repository/histogram.py
+0
-46
test_ttl
artiq_master/repository/test_ttl
+0
-92
un_solo_output.py
artiq_master/repository/un_solo_output.py
+0
-58
No files found.
artiq_master/repository/Plotting/histograms_pmtsimulation.py
deleted
100644 → 0
View file @
2fed3ca3
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
):
return
poisson
.
rvs
(
self
.
mean
)
def
change_mean
(
self
,
new_mean
):
self
.
mean
=
new_mean
# }}}
class
Histograms
(
EnvExperiment
):
"""Histograms mockpmt simulation"""
def
build
(
self
):
self
.
setattr_argument
(
"npoints"
,
NumberValue
(
100
,
ndecimals
=
0
,
step
=
5
))
self
.
setattr_argument
(
"chunks"
,
NumberValue
(
5
,
ndecimals
=
0
,
step
=
1
))
self
.
setattr_argument
(
"bin_init"
,
NumberValue
(
-
10
,
ndecimals
=
0
,
step
=
1
),
"Binning parameters"
)
self
.
setattr_argument
(
"bin_end"
,
NumberValue
(
30
,
ndecimals
=
0
,
step
=
1
),
"Binning parameters"
)
self
.
setattr_argument
(
"bin_step"
,
NumberValue
(
1
,
ndecimals
=
0
,
step
=
1
),
"Binning parameters"
)
self
.
setattr_argument
(
"nbins"
,
NumberValue
(
100
,
ndecimals
=
0
,
step
=
10
))
self
.
setattr_argument
(
"histo_delay"
,
NumberValue
(
0.6
,
ndecimals
=
2
,
step
=
0.01
))
self
.
setattr_device
(
"ccb"
)
def
run
(
self
):
self
.
pmt
=
MockPMT
()
# Custom histogram plot creator (needs a reasonable --update-delay)
self
.
ccb
.
issue
(
"create_applet"
,
"mockpmt_histogram"
,
"${artiq_applet}plot_hist "
"histo --x hd_bins --title mockpmt "
f
"--update-delay {self.histo_delay}"
,
group
=
"ExampleHistogram"
)
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
.
set_dataset
(
"histo"
,
np
.
zeros
(
len
(
bin_boundaries
)
-
1
,
dtype
=
int
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"medidas"
,
np
.
empty
(
self
.
npoints
*
self
.
chunks
),
broadcast
=
True
,
archive
=
False
)
self
.
set_dataset
(
"partial_chunk"
,
np
.
empty
(
self
.
chunks
),
broadcast
=
True
,
archive
=
False
)
for
i
in
range
(
self
.
npoints
):
for
j
in
range
(
self
.
chunks
):
self
.
mutate_dataset
(
"partial_chunk"
,
j
,
self
.
pmt
.
count
())
print
(
1
)
histogram_partial
,
_
=
np
.
histogram
(
self
.
partial_chunk
,
bin_boundaries
)
print
(
2
)
for
k
in
range
(
len
(
histo
)):
self
.
mutate_dataset
(
"histo"
,
k
,
self
.
histo
[
k
]
+
histogram_partial
[
k
])
print
(
3
)
sleep
(
0.5
)
sleep
(
0.3
)
artiq_master/repository/exp1_vcd.vcd
deleted
100644 → 0
View file @
2fed3ca3
This diff is collapsed.
Click to expand it.
artiq_master/repository/exp_1.py
deleted
100644 → 0
View file @
2fed3ca3
from
artiq.experiment
import
*
class
Set_All_Urukul_Freqs
(
EnvExperiment
):
"""Exp1_test
Set the frecuencies/amplitudes of every Urukul channel
"""
def
build
(
self
):
# sets core device drivers as attributes
self
.
setattr_device
(
"core"
)
self
.
pmt
=
self
.
get_device
(
"ttl0"
)
# global attenuation
self
.
setattr_argument
(
"attenuation"
,
NumberValue
(
0
*
dB
,
unit
=
'dB'
,
scale
=
dB
,
min
=
0
*
dB
,
max
=
31
*
dB
),
)
for
ch
in
range
(
4
):
# sets urukul0, channel 0-3 device drivers as attributes
self
.
setattr_device
(
f
"urukul0_ch{ch}"
)
### This two attributes will be shown in the GUI grouped by channel
# use/don't use each channel
self
.
setattr_argument
(
f
"state_ch{ch}"
,
BooleanValue
(
ch
==
0
),
f
"canal_{ch}"
)
# each channel's frequency
self
.
setattr_argument
(
f
"freq_ch{ch}"
,
NumberValue
(
200.0
*
MHz
,
unit
=
'MHz'
,
scale
=
MHz
,
min
=
1
*
MHz
,
max
=
400
*
MHz
),
f
"canal_{ch}"
)
# each channel's amplitude
self
.
setattr_argument
(
f
"amp_ch{ch}"
,
NumberValue
(
0.5
,
min
=
0.
,
max
=
1.
),
f
"canal_{ch}"
)
self
.
all_amps
=
[
self
.
amp_ch0
,
self
.
amp_ch1
,
self
.
amp_ch2
,
self
.
amp_ch3
]
self
.
all_freqs
=
[
self
.
freq_ch0
,
self
.
freq_ch1
,
self
.
freq_ch2
,
self
.
freq_ch3
]
self
.
states
=
[
self
.
state_ch0
,
self
.
state_ch1
,
self
.
state_ch2
,
self
.
state_ch3
]
self
.
all_channels
=
[
self
.
urukul0_ch0
,
self
.
urukul0_ch1
,
self
.
urukul0_ch2
,
self
.
urukul0_ch3
]
self
.
use_amps
=
[]
self
.
use_freqs
=
[]
self
.
use_channels
=
[]
for
state
,
ch_n
,
freq_n
,
amp_n
in
zip
(
self
.
states
,
self
.
all_channels
,
self
.
all_freqs
,
self
.
all_amps
):
if
state
:
self
.
use_channels
.
append
(
ch_n
)
self
.
use_freqs
.
append
(
freq_n
)
self
.
use_amps
.
append
(
amp_n
)
@
kernel
def
run
(
self
):
self
.
core
.
reset
()
# self.pmt.reset()
self
.
pmt
.
input
()
# initialises CPLD all the selected channels
for
channel
in
self
.
use_channels
:
channel
.
cpld
.
init
()
channel
.
init
()
delay
(
10
*
ms
)
for
i
in
range
(
len
(
self
.
use_channels
)):
# writes global attenuation and specific
# frequency and amplitude variables to each
# urukul channel outputting function
self
.
use_channels
[
i
]
.
set_att
(
self
.
attenuation
)
#self.use_channels[i].set_amplitude(self.use_amps[i])
self
.
use_channels
[
i
]
.
set
(
self
.
use_freqs
[
i
],
amplitude
=
self
.
use_amps
[
i
])
# turn on every selected channel
for
i
in
range
(
4
):
if
self
.
states
[
i
]
==
True
:
self
.
all_channels
[
i
]
.
sw
.
on
()
else
:
self
.
all_channels
[
i
]
.
sw
.
off
()
delay
(
2
*
s
)
pulsos
=
self
.
pmt
.
count
(
self
.
pmt
.
gate_both
(
3
*
us
))
delay
(
2
*
s
)
print
(
pulsos
)
artiq_master/repository/histogram.py
deleted
100644 → 0
View file @
2fed3ca3
#!/usr/bin/env python3
import
numpy
as
np
import
PyQt5
# make sure pyqtgraph imports Qt5
import
pyqtgraph
from
artiq.applets.simple
import
TitleApplet
class
MakeHistogramAndPlot
(
pyqtgraph
.
PlotWidget
):
def
__init__
(
self
,
args
):
pyqtgraph
.
PlotWidget
.
__init__
(
self
)
self
.
args
=
args
def
data_changed
(
self
,
data
,
mods
,
title
):
#print(data)
try
:
y
=
data
[
self
.
args
.
y
][
1
]
y
=
y
[
~
np
.
isnan
(
y
)]
#print(self.args.x)
#if len(y[~np.isnan(y)]) > 5: return
if
self
.
args
.
x
is
None
:
x
=
'auto'
else
:
x
=
data
[
self
.
args
.
x
][
1
]
except
KeyError
:
return
# This makes the histogram with the full datasets
# may be slow so it should be run with a reasonable
# --update-delay value
heigs
,
binsides
=
np
.
histogram
(
y
,
bins
=
x
,
density
=
True
)
self
.
clear
()
self
.
plot
(
binsides
,
heigs
,
stepMode
=
True
,
fillLevel
=
0
,
brush
=
(
0
,
0
,
255
,
150
))
self
.
setTitle
(
title
)
def
main
():
applet
=
TitleApplet
(
MakeHistogramAndPlot
)
applet
.
add_dataset
(
"y"
,
"Y values"
)
applet
.
add_dataset
(
"x"
,
"Bin boundaries"
,
required
=
False
)
applet
.
run
()
if
__name__
==
"__main__"
:
main
()
artiq_master/repository/test_ttl
deleted
100644 → 0
View file @
2fed3ca3
from artiq.experiment import *
class Set_All_Urukul_Freqs(EnvExperiment):
"""Exp1_test
Set the frecuencies/amplitudes of every Urukul channel
"""
def build(self):
# sets core device drivers as attributes
self.setattr_device("core")
self.pmt = self.get_device("ttl0")
# global attenuation
self.setattr_argument("attenuation",
NumberValue(0*dB, unit='dB', scale=dB, min=0*dB, max=31*dB),
)
for ch in range(4):
# sets urukul0, channel 0-3 device drivers as attributes
self.setattr_device(f"urukul0_ch{ch}")
### This two attributes will be shown in the GUI grouped by channel
# use/don't use each channel
self.setattr_argument(f"state_ch{ch}", BooleanValue(ch==0), f"canal_{ch}")
# each channel's frequency
self.setattr_argument(f"freq_ch{ch}",
NumberValue(200.0*MHz, unit='MHz', scale=MHz, min=1*MHz, max=400*MHz),
f"canal_{ch}")
# each channel's amplitude
self.setattr_argument(f"amp_ch{ch}",
NumberValue(0.5, min=0., max=1.),
f"canal_{ch}")
self.all_amps = [self.amp_ch0, self.amp_ch1, self.amp_ch2, self.amp_ch3]
self.all_freqs = [self.freq_ch0, self.freq_ch1, self.freq_ch2, self.freq_ch3]
self.states = [self.state_ch0, self.state_ch1, self.state_ch2, self.state_ch3]
self.all_channels = [self.urukul0_ch0, self.urukul0_ch1, self.urukul0_ch2, self.urukul0_ch3]
self.use_amps = []
self.use_freqs = []
self.use_channels = []
for state, ch_n, freq_n, amp_n in zip(self.states, self.all_channels,
self.all_freqs, self.all_amps):
if state:
self.use_channels.append(ch_n)
self.use_freqs.append(freq_n)
self.use_amps.append(amp_n)
@kernel
def run(self):
self.core.reset()
# self.pmt.reset()
self.pmt.input()
delay(1*s)
pulsos=self.pmt.count(self.pmt.gate_both(1*s))
delay(1*s)
# initialises CPLD all the selected channels
for channel in self.use_channels:
channel.cpld.init()
channel.init()
delay(10 * ms)
for i in range(len(self.use_channels)):
# writes global attenuation and specific
# frequency and amplitude variables to each
# urukul channel outputting function
self.use_channels[i].set_att(self.attenuation)
#self.use_channels[i].set_amplitude(self.use_amps[i])
self.use_channels[i].set(self.use_freqs[i], amplitude=self.use_amps[i])
# turn on every selected channel
for i in range(4):
if self.states[i] == True:
self.all_channels[i].sw.on()
else:
self.all_channels[i].sw.off()
print("AAAAA")
delay(1*s)
# self.core.break_realtime()
# print("BBBBBBBBBBB")
print(pulsos)
artiq_master/repository/un_solo_output.py
deleted
100644 → 0
View file @
2fed3ca3
from
artiq.experiment
import
*
# EXTRACTED LOOSELY FROM: https://github.com/cnourshargh/Bham-ARTIQ-examples/blob/master/Urukul_SingleOutput.py
class
Urukul_Frequency_Pulse
(
EnvExperiment
):
"""Urukul Single Frequency Pulse:
Initial Urukul test:
Outputs a single sine wave of specified frecuency and duration.
"""
def
build
(
self
):
# sets core device drivers as attributes
self
.
setattr_device
(
"core"
)
# sets urukul0, channel 0 device drivers as attributes
# this name is the same as seen in the device_db.py
self
.
setattr_device
(
"urukul0_ch0"
)
# This is not the 'Urukul' phy, but actually is the one corresponding to
# the inside DDS chip, which has the methods described in:
# https://m-labs.hk/artiq/manual-legacy/core_drivers_reference.html#artiq.coredevice.ad9910.AD9910
# BEWARE the manual-legacy thing.
# self.freq = NumberValue(21, unit='MHz', scale=1e6)
self
.
setattr_argument
(
"freq"
,
NumberValue
(
21
,
unit
=
'MHz'
,
scale
=
1e6
))
@
kernel
def
run
(
self
):
self
.
core
.
reset
()
# initialises CPLD on channel 0
self
.
urukul0_ch0
.
cpld
.
init
()
self
.
urukul0_ch0
.
init
()
### Variable declaration:
# Defines frequency variable, range: 1 MHz - 400MHz
# defines amplitude variable as an amplitude scale factor(0 to 1)
amp
=
1.0
# defines attenuation variable from 0 (no attenuation) to max val (check) -31,5dB
attenuation
=
3.0
*
dB
duration
=
10
*
(
1
/
self
.
freq
)
delay
(
10
*
ms
)
# writes attenuation to urukul channel
self
.
urukul0_ch0
.
set_att
(
attenuation
)
#self.urukul0_ch0.set_phase(0.0)
# writes frequency and amplitude variables to urukul channel thus outputting function
self
.
urukul0_ch0
.
set
(
self
.
freq
,
amplitude
=
amp
)
# We can access this switch thanks to the entry in this constructor method:
# ...
# sw_device – Name of the RF switch device. The RF switch is a TTLOut channel available as the sw attribute of this instance.
# ...
self
.
urukul0_ch0
.
sw
.
on
()
delay
(
duration
)
delay
(
20
*
s
)
self
.
urukul0_ch0
.
sw
.
off
()
delay
(
duration
)
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