mirror of https://github.com/m-labs/artiq.git
gui: add image applet
This commit is contained in:
parent
168113ce55
commit
befbab5571
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3.5
|
||||
|
||||
import numpy as np
|
||||
import PyQt5 # make sure pyqtgraph imports Qt5
|
||||
import pyqtgraph
|
||||
|
||||
from artiq.applets.simple import SimpleApplet
|
||||
|
||||
|
||||
class Image(pyqtgraph.ImageView):
|
||||
def __init__(self, args):
|
||||
pyqtgraph.ImageView.__init__(self)
|
||||
self.args = args
|
||||
|
||||
def data_changed(self, data, mods):
|
||||
try:
|
||||
img = data[self.args.img][1]
|
||||
except KeyError:
|
||||
return
|
||||
self.setImage(img)
|
||||
|
||||
|
||||
def main():
|
||||
applet = SimpleApplet(Image)
|
||||
applet.add_dataset("img", "image data (2D numpy array)")
|
||||
applet.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -185,6 +185,8 @@ _templates = [
|
|||
"--embed {ipc_address} X_DATASET "
|
||||
"HIST_BIN_BOUNDARIES_DATASET "
|
||||
"HISTS_COUNTS_DATASET"),
|
||||
("Image", "{python} -m artiq.applets.image "
|
||||
"--embed {ipc_address} IMG_DATASET"),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue