/
zinskiy09
/
Align3.0
Обзор
Документация
Войти
/
zinskiy09
/
Align3.0
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
AlignGUI/views/plot_view.py
39 строк
1 KB
Sasha
add project files
17 сен 2025, 06:48
17 сен 2025, 06:48
323d13e
Код
Авторство
О чём код?
import numpy as np from PySide2.QtWidgets import QWidget, QVBoxLayout from pyqtgraph import PlotWidget from Align.AlignGUI.utils.colormap_utils import get_color class PlotView(QWidget): def __init__(self): super().__init__() layout = QVBoxLayout() self.plot_widget = PlotWidget(title="2D График") layout.addWidget(self.plot_widget) self.setLayout(layout) def update_plot(self, data): self.plot_widget.clear() if data is None: return channels = data[:4] data = data[4:] selected_channels = list(map(int, filter(lambda x: x != 0, channels))) count_chanels = len(selected_channels) num_points = int(len(data) / (count_chanels + 1)) coordination = data[(-num_points):] signals_split = [data[i * num_points:(i + 1) * num_points] for i in range(count_chanels)] # colors = ['r', 'g', 'b', 'orange'] for i, channel_number in enumerate(selected_channels): y_values = signals_split[i] color_hex = get_color(i) # Получаем HEX-цвет self.plot_widget.plot( x=coordination, y=y_values, pen=color_hex, # Передаём HEX-значение name=f"channel_{channel_number}" )