fix: исправил падение приложения в случае отсутствия меток начала и конца этапа
This commit is contained in:
parent
34b8b49624
commit
4d0b777f7c
@ -17,9 +17,10 @@ class PlotWidget(BasePlotWidget):
|
|||||||
stage_diff = np.diff(dataframe[stage])
|
stage_diff = np.diff(dataframe[stage])
|
||||||
start_index = np.where(stage_diff == 1)[0]
|
start_index = np.where(stage_diff == 1)[0]
|
||||||
finish_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]]
|
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 = pg.LinearRegionItem([start_timestamp, finish_timestamp], movable=False)
|
||||||
region.setBrush(pg.mkBrush(self._stage_colors[stage]))
|
region.setBrush(pg.mkBrush(self._stage_colors[stage]))
|
||||||
return region
|
return region
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user