<s> """<STR_LIT>""" <EOL> import time <EOL> import numpy as np <EOL> import pyqtgraph as pg <EOL> from lantz import Q_ <EOL> from lantz . utils . qt import QtGui , QtCore <EOL> from lantz . ui . blocks import Loop , LoopUi <EOL> from lantz . ui . app import Frontend , Backend , InstrumentSlot <EOL> class LoopOsciMeasure ( Backend ) : <EOL> """<STR_LIT>""" <EOL> osci = InstrumentSlot <EOL> loop = Loop <EOL> new_data = QtCore . Signal ( object ) <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( ) . __init__ ( * args , ** kwargs ) <EOL> self . loop . body = self . measure <EOL> def measure ( self , counter , iterations , overrun ) : <EOL> data = self . osci . measure ( ) <EOL> self . new_data . emit ( data ) <EOL> class LoopPlot ( Frontend ) : <EOL> """<STR_LIT>""" <EOL> gui = '<STR_LIT>' <EOL> auto_connect = True <EOL> def setupUi ( self ) : <EOL> self . pw = pg . PlotWidget ( ) <EOL> self . curve = self . pw . plot ( pen = '<STR_LIT:y>' ) <EOL> layout = QtGui . QVBoxLayout ( ) <EOL> layout . addWidget ( self . pw ) <EOL> self . widget . plotParent . setLayout ( layout ) <EOL> self . loopUi = LoopUi ( ) <EOL> layout = QtGui . QHBoxLayout ( ) <EOL> layout . addWidget ( self . loopUi . widget ) <EOL> self . widget . loopParent . setLayout ( layout ) <EOL> def connect_backend ( self ) : <EOL> self . loopUi . backend = self . backend . loop <EOL> self . backend . new_data . connect ( self . plot ) <EOL> def plot ( self , y ) : <EOL> self . curve . setData ( y ) </s>
