forked from M-Labs/artiq
1
0
Fork 0

waveform: remove empty waveform error msg

This commit is contained in:
Simon Renblad 2024-02-19 10:35:07 +08:00 committed by Sébastien Bourdeauducq
parent de539a4d33
commit 652bcc22c6
1 changed files with 7 additions and 5 deletions

View File

@ -200,8 +200,9 @@ class _BaseWaveform(pg.PlotWidget):
def setData(self, data): def setData(self, data):
if len(data) == 0: if len(data) == 0:
raise ValueError("no timeseries data to display for this channel") self.x_data, self.y_data = [], []
self.x_data, self.y_data = zip(*data) else:
self.x_data, self.y_data = zip(*data)
def onDataChange(self, data): def onDataChange(self, data):
raise NotImplementedError raise NotImplementedError
@ -293,9 +294,10 @@ class AnalogWaveform(_BaseWaveform):
try: try:
self.setData(data) self.setData(data)
self.plot_data_item.setData(x=self.x_data, y=self.y_data) self.plot_data_item.setData(x=self.x_data, y=self.y_data)
max_y = max(self.y_data) if len(data) > 0:
min_y = min(self.y_data) max_y = max(self.y_data)
self.plot_item.setRange(yRange=(min_y, max_y), padding=0.1) min_y = min(self.y_data)
self.plot_item.setRange(yRange=(min_y, max_y), padding=0.1)
except: except:
logger.error("Error when displaying waveform: %s", self.name, exc_info=True) logger.error("Error when displaying waveform: %s", self.name, exc_info=True)
self.plot_data_item.setData(x=[], y=[]) self.plot_data_item.setData(x=[], y=[])