nemocrys/multilog

Race condition in updating measurement data

Opened this issue · 0 comments

There is a race condition for updating of measurement data (but the output is still valid). I think the problem was that the time-list may have a different length than the sampling-list when the view is updated.

Log-file snippet:
2022-09-15 12:49:57,408 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 1.092403 seconds for samplint timestep 2022-09-15 12:49:56.315+02:00 - 2653.875
2022-09-15 12:50:09,401 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 1.085731 seconds for samplint timestep 2022-09-15 12:50:08.315+02:00 - 2665.875
2022-09-15 12:50:20,377 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 2.062282 seconds for samplint timestep 2022-09-15 12:50:18.314+02:00 - 2675.874
2022-09-15 12:50:20,382 ERROR multilog.main - Error in updating view of IFM-flowmeter
Traceback (most recent call last):
  File "/home/nemocrys/Documents/experiments/meas-multilog/multilog/main.py", line 175, in update_view
    self.tabs[device].set_measurement_data(self.rel_time, device_sampling[device])
  File "/home/nemocrys/Documents/experiments/meas-multilog/multilog/view.py", line 506, in set_measurement_data
    self.temperature_widget.set_data(sensor, rel_time, meas_data["Temperature"][sensor])
  File "/home/nemocrys/Documents/experiments/meas-multilog/multilog/view.py", line 388, in set_data
    self.lines[sensor].setData(x, y, connect=np.logical_and(con, np.roll(con, -1)))
  File "/usr/local/lib/python3.8/dist-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 595, in setData
    self.updateItems( styleUpdate = self.property('styleWasChanged') )
  File "/usr/local/lib/python3.8/dist-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 644, in updateItems
    self.curve.setData(x=x, y=y, **curveArgs)
  File "/usr/local/lib/python3.8/dist-packages/pyqtgraph/graphicsItems/PlotCurveItem.py", line 365, in setData
    self.updateData(*args, **kargs)
  File "/usr/local/lib/python3.8/dist-packages/pyqtgraph/graphicsItems/PlotCurveItem.py", line 419, in updateData
    raise Exception("X and Y arrays must be the same shape--got %s and %s." % (self.xData.shape, self.yData.shape))
Exception: X and Y arrays must be the same shape--got (1340,) and (1339,).
2022-09-15 12:50:21,453 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 1.138052 seconds for samplint timestep 2022-09-15 12:50:20.315+02:00 - 2677.875
2022-09-15 12:50:23,385 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 1.069698 seconds for samplint timestep 2022-09-15 12:50:22.315+02:00 - 2679.875
2022-09-15 12:50:27,376 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 1.061414 seconds for samplint timestep 2022-09-15 12:50:26.314+02:00 - 2683.874
2022-09-15 12:50:35,380 WARNING multilog.devices - IFM-flowmeter save_measurement: time difference between event and saving of 1.065411 seconds for samplint timestep 2022-09-15 12:50:34.315+02:00 - 2691.874

Sampling time was 2s.