Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pyLIAF
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
pyLIAF
Commits
7e58c522
Commit
7e58c522
authored
Aug 30, 2021
by
Nicolas Nunez Barreto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agrego applets nuevas, modificacion a readanalog de redp itaya y un toque de cambios al urukul
parent
c59cdbc4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
13 deletions
+179
-13
.Read_analog.py.swp
pyLIAF/RedPitaya/.Read_analog.py.swp
+0
-0
Read_analog.py
pyLIAF/RedPitaya/Read_analog.py
+23
-10
Urukul.py
pyLIAF/artiq/_controllers/Urukul.py
+11
-2
plot_xy_scan.py
pyLIAF/artiq/applets/plot_xy_scan.py
+70
-0
plot_xy_scan_freqorder.py
pyLIAF/artiq/applets/plot_xy_scan_freqorder.py
+70
-0
realtime.py
pyLIAF/artiq/applets/realtime.py
+5
-1
No files found.
pyLIAF/RedPitaya/.Read_analog.py.swp
0 → 100644
View file @
7e58c522
File added
pyLIAF/RedPitaya/Read_analog.py
View file @
7e58c522
...
...
@@ -10,7 +10,8 @@ import sys
#import redpitaya_scpi as scpi
from
time
import
sleep
import
numpy
as
np
#from typing import TFloat
import
time
__author__
=
"Luka Golinar, Iztok Jeras"
__copyright__
=
"Copyright 2015, Red Pitaya"
...
...
@@ -146,24 +147,36 @@ class scpi (object):
return
rp
.
txrx_txt
(
'SYST:ERR:NEXT?'
)
def
ReadVoltage
():
rp_s
=
scpi
(
'192.168.1.244'
)
def
Initiate_comm
():
return
scpi
(
'192.168.1.242'
)
def
ReadVoltage
(
rp_s
):
#rp_s = scpi('192.168.1.242')
print
(
'1'
)
rp_s
.
tx_txt
(
'ACQ:START'
)
print
(
'2'
)
rp_s
.
tx_txt
(
'ACQ:TRIG NOW'
)
while
1
:
print
(
'3'
)
rp_s
.
tx_txt
(
'ACQ:TRIG:STAT?'
)
if
rp_s
.
rx_txt
()
==
'TD'
:
break
rp_s
.
tx_txt
(
'ACQ:SOUR1:DATA?'
)
buff_string
=
rp_s
.
rx_txt
()
print
(
'4'
)
buff_string
=
rp_s
.
txrx_txt
(
'ACQ:SOUR1:DATA?'
)
print
(
'5'
)
#buff_string = rp_s.rx_txt()
buff_string
=
buff_string
.
strip
(
'{}
\n\r
'
)
.
replace
(
" "
,
""
)
.
split
(
','
)
print
(
'6'
)
buff
=
list
(
map
(
float
,
buff_string
))
print
(
'7'
)
return
np
.
mean
(
buff
)
#return np.abs(buff[-1])
def
ReadSlow
(
AI
):
rp_s
=
scpi
(
'192.168.1.242'
)
rp_s
.
tx_txt
(
f
'ANALOG:PIN? AIN{AI}'
)
return
float
(
rp_s
.
rx_txt
())
if
__name__
==
"__main__"
:
for
i
in
range
(
50
):
...
...
pyLIAF/artiq/_controllers/Urukul.py
View file @
7e58c522
...
...
@@ -36,7 +36,10 @@ class UrukulCh(HasEnvironment):
@
kernel
def
initialize_channel
(
self
):
# initialises CPLD the selected channel
#delay(100*ms)
self
.
channel
.
cpld
.
init
()
#self.core.break_realtime()
#delay(1000*ms)
self
.
channel
.
init
()
@
kernel
...
...
@@ -53,8 +56,14 @@ class UrukulCh(HasEnvironment):
self
.
channel
.
cpld
.
set_profile
(
number
)
@
kernel
def
set_frequency
(
self
,
freq
:
TFloat
,
profile
:
TInt32
=
0
):
self
.
channel
.
set
(
freq
,
amplitude
=
self
.
amplitude
,
profile
=
profile
)
def
set_frequency
(
self
,
freq
:
TFloat
,
amp
:
TFloat
=
0.2
,
profile
:
TInt32
=
0
):
#self.channel.set(freq, amplitude=self.amplitude, profile=profile)
self
.
channel
.
set
(
freq
,
amplitude
=
amp
,
profile
=
profile
)
@
kernel
def
set_amp
(
self
,
amp
:
TFloat
,
freq
:
TFloat
,
profile
:
TInt32
=
0
):
self
.
amplitude
=
amp
self
.
channel
.
set
(
freq
,
amplitude
=
amp
,
profile
=
profile
)
def
get_frequency
(
self
)
->
TFloat
:
return
self
.
frequency
...
...
pyLIAF/artiq/applets/plot_xy_scan.py
0 → 100644
View file @
7e58c522
#!/usr/bin/env python3
import
numpy
as
np
import
PyQt5
# make sure pyqtgraph imports Qt5
import
pyqtgraph
from
artiq.applets.simple
import
TitleApplet
class
XYPlot
(
pyqtgraph
.
PlotWidget
):
def
__init__
(
self
,
args
):
pyqtgraph
.
PlotWidget
.
__init__
(
self
)
self
.
args
=
args
def
data_changed
(
self
,
data
,
mods
,
title
):
try
:
y0
=
data
[
self
.
args
.
y
][
1
]
#no_chunk = data[self.args.no_chunk][1]
no_frequencies
=
data
[
self
.
args
.
no_frequencies
][
1
]
#y = np.reshape(y0, (no_chunk,-1)).sum(axis=0)
y
=
np
.
reshape
(
y0
,
(
no_frequencies
,
-
1
))
.
sum
(
axis
=
1
)
#print(y)
except
KeyError
:
return
x
=
data
.
get
(
self
.
args
.
x
,
(
False
,
None
))[
1
]
if
x
is
None
:
x
=
np
.
arange
(
len
(
y
))
error
=
data
.
get
(
self
.
args
.
error
,
(
False
,
None
))[
1
]
fit
=
data
.
get
(
self
.
args
.
fit
,
(
False
,
None
))[
1
]
if
not
len
(
y
)
or
len
(
y
)
!=
len
(
x
):
return
if
error
is
not
None
and
hasattr
(
error
,
"__len__"
):
if
not
len
(
error
):
error
=
None
elif
len
(
error
)
!=
len
(
y
):
return
if
fit
is
not
None
:
if
not
len
(
fit
):
fit
=
None
elif
len
(
fit
)
!=
len
(
y
):
return
self
.
clear
()
self
.
plot
(
x
,
y
,
pen
=
None
,
symbol
=
"x"
)
self
.
setTitle
(
title
)
if
error
is
not
None
:
# See https://github.com/pyqtgraph/pyqtgraph/issues/211
if
hasattr
(
error
,
"__len__"
)
and
not
isinstance
(
error
,
np
.
ndarray
):
error
=
np
.
array
(
error
)
errbars
=
pyqtgraph
.
ErrorBarItem
(
x
=
np
.
array
(
x
),
y
=
np
.
array
(
y
),
height
=
error
)
self
.
addItem
(
errbars
)
if
fit
is
not
None
:
xi
=
np
.
argsort
(
x
)
self
.
plot
(
x
[
xi
],
fit
[
xi
])
def
main
():
applet
=
TitleApplet
(
XYPlot
)
applet
.
add_dataset
(
"y"
,
"Y values"
)
#applet.add_dataset("no_chunk", "Chunk size")
applet
.
add_dataset
(
"no_frequencies"
,
"Chunk size"
,
required
=
False
)
applet
.
add_dataset
(
"x"
,
"X values"
,
required
=
False
)
applet
.
add_dataset
(
"error"
,
"Error bars for each X value"
,
required
=
False
)
applet
.
add_dataset
(
"fit"
,
"Fit values for each X value"
,
required
=
False
)
applet
.
run
()
if
__name__
==
"__main__"
:
main
()
pyLIAF/artiq/applets/plot_xy_scan_freqorder.py
0 → 100644
View file @
7e58c522
#!/usr/bin/env python3
import
numpy
as
np
import
PyQt5
# make sure pyqtgraph imports Qt5
import
pyqtgraph
from
artiq.applets.simple
import
TitleApplet
class
XYPlot
(
pyqtgraph
.
PlotWidget
):
def
__init__
(
self
,
args
):
pyqtgraph
.
PlotWidget
.
__init__
(
self
)
self
.
args
=
args
def
data_changed
(
self
,
data
,
mods
,
title
):
try
:
y0
=
data
[
self
.
args
.
y
][
1
]
no_chunk
=
data
[
self
.
args
.
no_chunk
][
1
]
#no_frequencies = data[self.args.no_frequencies][1]
y
=
np
.
reshape
(
y0
,
(
no_chunk
,
-
1
))
.
sum
(
axis
=
0
)
#y = np.reshape(y0, (no_frequencies,-1)).sum(axis=1)
#print(y)
except
KeyError
:
return
x
=
data
.
get
(
self
.
args
.
x
,
(
False
,
None
))[
1
]
if
x
is
None
:
x
=
np
.
arange
(
len
(
y
))
error
=
data
.
get
(
self
.
args
.
error
,
(
False
,
None
))[
1
]
fit
=
data
.
get
(
self
.
args
.
fit
,
(
False
,
None
))[
1
]
if
not
len
(
y
)
or
len
(
y
)
!=
len
(
x
):
return
if
error
is
not
None
and
hasattr
(
error
,
"__len__"
):
if
not
len
(
error
):
error
=
None
elif
len
(
error
)
!=
len
(
y
):
return
if
fit
is
not
None
:
if
not
len
(
fit
):
fit
=
None
elif
len
(
fit
)
!=
len
(
y
):
return
self
.
clear
()
self
.
plot
(
x
,
y
,
pen
=
None
,
symbol
=
"x"
)
self
.
setTitle
(
title
)
if
error
is
not
None
:
# See https://github.com/pyqtgraph/pyqtgraph/issues/211
if
hasattr
(
error
,
"__len__"
)
and
not
isinstance
(
error
,
np
.
ndarray
):
error
=
np
.
array
(
error
)
errbars
=
pyqtgraph
.
ErrorBarItem
(
x
=
np
.
array
(
x
),
y
=
np
.
array
(
y
),
height
=
error
)
self
.
addItem
(
errbars
)
if
fit
is
not
None
:
xi
=
np
.
argsort
(
x
)
self
.
plot
(
x
[
xi
],
fit
[
xi
])
def
main
():
applet
=
TitleApplet
(
XYPlot
)
applet
.
add_dataset
(
"y"
,
"Y values"
)
applet
.
add_dataset
(
"no_chunk"
,
"Chunk size"
)
#applet.add_dataset("no_frequencies", "Chunk size")
applet
.
add_dataset
(
"x"
,
"X values"
,
required
=
False
)
applet
.
add_dataset
(
"error"
,
"Error bars for each X value"
,
required
=
False
)
applet
.
add_dataset
(
"fit"
,
"Fit values for each X value"
,
required
=
False
)
applet
.
run
()
if
__name__
==
"__main__"
:
main
()
pyLIAF/artiq/applets/realtime.py
View file @
7e58c522
#!/usr/bin/env python3
import
numpy
as
np
import
os
import
PyQt5
# make sure pyqtgraph imports Qt5
import
pyqtgraph
from
collections
import
deque
# CircularBuffer
...
...
@@ -37,11 +38,14 @@ class RTPlot(pyqtgraph.PlotWidget):
self
.
ys
.
append
(
y
[
0
])
self
.
clear
()
self
.
plot
(
self
.
xs
,
self
.
ys
,
pen
=
None
,
symbol
=
"
x
"
)
self
.
plot
(
self
.
xs
,
self
.
ys
,
pen
=
None
,
symbol
=
"
o
"
)
if
y2
is
not
None
:
self
.
y2s
.
append
(
y2
[
0
])
self
.
plot
(
self
.
xs
,
self
.
y2s
,
pen
=
None
,
symbol
=
"+"
,
symbolPen
=
'r'
)
if
not
os
.
path
.
isfile
(
"/tmp/medicion_blinqueo.csv"
):
np
.
savetxt
(
"/tmp/medicion_blinqueo.csv"
,
np
.
array
([
self
.
ys
,
self
.
y2s
])
.
T
,
delimiter
=
','
)
self
.
setTitle
(
title
)
def
main
():
...
...
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