2017-01-30 09:24:43 +08:00
|
|
|
#!/usr/bin/env python3
|
2016-03-23 17:04:22 +08:00
|
|
|
|
|
|
|
import PyQt5 # make sure pyqtgraph imports Qt5
|
|
|
|
import pyqtgraph
|
|
|
|
|
|
|
|
from artiq.applets.simple import SimpleApplet
|
|
|
|
|
|
|
|
|
|
|
|
class Image(pyqtgraph.ImageView):
|
2023-05-31 22:51:48 +08:00
|
|
|
def __init__(self, args, ctl):
|
2016-03-23 17:04:22 +08:00
|
|
|
pyqtgraph.ImageView.__init__(self)
|
|
|
|
self.args = args
|
|
|
|
|
2023-07-12 12:03:54 +08:00
|
|
|
def data_changed(self, value, metadata, persist, mods):
|
2016-03-23 17:04:22 +08:00
|
|
|
try:
|
2023-07-12 12:03:54 +08:00
|
|
|
img = value[self.args.img]
|
2016-03-23 17:04:22 +08:00
|
|
|
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()
|