Check bincount in data coming from backend

The backend may return fewer data points than expected. This can e.g. be
observed for the hackrf_sweep backend on high system load. Currently
this leads to an error when trying to insert the data into the
HistoryBuffer and causes the application to crash:

ValueError: cannot copy sequence with size 24750 to array axis with dimension 25000

As a workaround, just ignore data in this case.
This commit is contained in:
Michael Lass 2017-03-21 22:05:56 +01:00
parent 5d41c6c4a8
commit 9dc1433bdf

View File

@ -105,6 +105,10 @@ class DataStorage(QtCore.QObject):
def update(self, data):
"""Update data storage"""
if self.y is not None and len(data["y"]) != len(self.y):
print("{:d} bins coming from backend, expected {:d}".format(len(data["y"]), len(self.y)))
return
self.average_counter += 1
if self.x is None: