diff --git a/src/gui/widgets/plot.py b/src/gui/widgets/plot.py index 5668de9..3a52377 100644 --- a/src/gui/widgets/plot.py +++ b/src/gui/widgets/plot.py @@ -17,9 +17,10 @@ class PlotWidget(BasePlotWidget): stage_diff = np.diff(dataframe[stage]) start_index = np.where(stage_diff == 1)[0] finish_index = np.where(stage_diff == -1)[0] - if start_index: + + if start_index.size: start_timestamp = times[start_index[0]] - finish_timestamp = times[finish_index[0]] if finish_index else times[len(times) - 1] + finish_timestamp = times[finish_index[0]] if finish_index.size else times[len(times) - 1] region = pg.LinearRegionItem([start_timestamp, finish_timestamp], movable=False) region.setBrush(pg.mkBrush(self._stage_colors[stage])) return region