From 4d0b777f7cfdd36bec2f8b33ee30fa62483cfc85 Mon Sep 17 00:00:00 2001 From: andrei Date: Fri, 15 Nov 2024 12:06:49 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BF=D0=B0=D0=B4=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B2=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5=20=D0=BE=D1=82?= =?UTF-8?q?=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2=D0=B8=D1=8F=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D0=BE=D0=BA=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=86=D0=B0=20=D1=8D=D1=82=D0=B0?= =?UTF-8?q?=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui/widgets/plot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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