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
52acfe80
Commit
52acfe80
authored
Jun 12, 2021
by
Lucas Giardino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agrego applets
parent
f933471d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
0 deletions
+101
-0
histogram.py
pyLIAF/artiq/applets/histogram.py
+46
-0
realtime.py
pyLIAF/artiq/applets/realtime.py
+55
-0
No files found.
pyLIAF/artiq/applets/histogram.py
0 → 100644
View file @
52acfe80
#!/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
()
pyLIAF/artiq/applets/realtime.py
0 → 100644
View file @
52acfe80
#!/usr/bin/env python3
import
numpy
as
np
import
PyQt5
# make sure pyqtgraph imports Qt5
import
pyqtgraph
from
collections
import
deque
# CircularBuffer
from
artiq.applets.simple
import
TitleApplet
class
RTPlot
(
pyqtgraph
.
PlotWidget
):
def
__init__
(
self
,
args
):
pyqtgraph
.
PlotWidget
.
__init__
(
self
)
self
.
args
=
args
self
.
xs
=
None
self
.
ys
=
None
self
.
y2s
=
None
def
data_changed
(
self
,
data
,
mods
,
title
):
try
:
y
=
data
.
get
(
self
.
args
.
y
)[
1
]
except
KeyError
:
return
y2
=
data
.
get
(
self
.
args
.
y2
,
(
False
,
None
))[
1
]
if
self
.
xs
is
None
:
# Should be only first iteration
num
=
int
(
self
.
args
.
num
)
self
.
xs
=
np
.
arange
(
0.
,
num
)
# Fixed x-values
self
.
ys
=
deque
(
np
.
full
(
num
,
0.
),
num
)
# Y-vals are a CircBuff of len num
if
(
y2
is
not
None
):
# make extra one if y2 is passed
self
.
y2s
=
deque
(
np
.
full
(
num
,
0.0
),
num
)
return
self
.
ys
.
append
(
y
[
0
])
self
.
clear
()
self
.
plot
(
self
.
xs
,
self
.
ys
,
pen
=
None
,
symbol
=
"x"
)
if
y2
is
not
None
:
self
.
y2s
.
append
(
y2
[
0
])
self
.
plot
(
self
.
xs
,
self
.
y2s
,
pen
=
None
,
symbol
=
"+"
,
symbolPen
=
'r'
)
self
.
setTitle
(
title
)
def
main
():
applet
=
TitleApplet
(
RTPlot
)
applet
.
add_dataset
(
"num"
,
"Number of measures"
)
applet
.
add_dataset
(
"y"
,
"Y value"
)
applet
.
add_dataset
(
"y2"
,
"Second Y value"
,
required
=
False
)
applet
.
run
()
if
__name__
==
"__main__"
:
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