forked from M-Labs/artiq
waveform: add AnalogWaveform
This commit is contained in:
parent
09462442f7
commit
f2d5e6a5d8
@ -186,6 +186,23 @@ class _BaseWaveform(pg.PlotWidget):
|
|||||||
super().wheelEvent(e)
|
super().wheelEvent(e)
|
||||||
|
|
||||||
|
|
||||||
|
class AnalogWaveform(_BaseWaveform):
|
||||||
|
def __init__(self, name, width, parent=None):
|
||||||
|
_BaseWaveform.__init__(self, name, width, parent)
|
||||||
|
|
||||||
|
def onDataChange(self, data):
|
||||||
|
try:
|
||||||
|
x_data, y_data = zip(*data)
|
||||||
|
self.plot_data_item.setData(x=x_data, y=y_data)
|
||||||
|
max_y = max(y_data)
|
||||||
|
min_y = min(y_data)
|
||||||
|
self.plot_item.setRange(yRange=(min_y, max_y), padding=0.1)
|
||||||
|
except:
|
||||||
|
logger.error(
|
||||||
|
'Error when displaying waveform: {}'.format(self.name), exc_info=True)
|
||||||
|
self.plot_data_item.setData(x=[], y=[])
|
||||||
|
|
||||||
|
|
||||||
class _WaveformView(QtWidgets.QWidget):
|
class _WaveformView(QtWidgets.QWidget):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QtWidgets.QWidget.__init__(self, parent=parent)
|
QtWidgets.QWidget.__init__(self, parent=parent)
|
||||||
|
Loading…
Reference in New Issue
Block a user