fix: теперь при отсутствии настройки графика в словаре, описывающем структуру, она принимается равной False

This commit is contained in:
Andrew 2025-02-05 19:17:59 +03:00
parent 7b759a86d2
commit df365d14ec

View File

@ -175,7 +175,7 @@ class CustomPlotLayout(pg.GraphicsLayoutWidget):
else: else:
plot_item.setXLink(main_plot) plot_item.setXLink(main_plot)
if description["Settings"]["performance"]: if description["Settings"].get("performance", False):
self.setProperty("performance", plot_timings) self.setProperty("performance", plot_timings)
self.addItem(plot_item, widget_num, 0) self.addItem(plot_item, widget_num, 0)
@ -221,13 +221,12 @@ class PlotItemGenerator:
dataframe, dataframe_headers, useful_data, points_pocket, widget_steps, point_steps = self._datapack dataframe, dataframe_headers, useful_data, points_pocket, widget_steps, point_steps = self._datapack
plot_item, legend = self._init_plot_item(title=channel) plot_item, legend = self._init_plot_item(title=channel)
settings = description["Settings"] settings:dict = description["Settings"]
timings = ChannelTimings() timings = ChannelTimings()
timings.client_time = useful_data.client_time timings.client_time = useful_data.client_time
# TODO: рассчитать корректный параметр range # TODO: рассчитать корректный параметр range
if settings["mirror ME"] and not self._ideal_mode: if settings.get("mirror ME", False) and not self._ideal_mode:
dataframe = self._shift_data( dataframe = self._shift_data(
"ME", "ME",
description["Real_signals"], description["Real_signals"],
@ -245,31 +244,31 @@ class PlotItemGenerator:
if self._ideal_mode: if self._ideal_mode:
timings, point_data.events, point_data.timeframe = self._generate_synthetic_events(timings, ideal_data) timings, point_data.events, point_data.timeframe = self._generate_synthetic_events(timings, ideal_data)
else: else:
if settings["force compensation FE"]: if settings.get("force compensation FE", False):
force = point_data.useful_data["force"] force = point_data.useful_data["force"]
k_hardness = useful_data.k_hardness k_hardness = useful_data.k_hardness
signals = description["Real_signals"] signals = description["Real_signals"]
dataframe = self._apply_force_compensation(force, k_hardness, dataframe, point_data.timeframe, signals) dataframe = self._apply_force_compensation(force, k_hardness, dataframe, point_data.timeframe, signals)
if settings["stages"]: if settings.get("stages", False):
self._add_stage_regions(plot_item, point_data.events, dataframe_headers, pyqt_container.regions, 75) self._add_stage_regions(plot_item, point_data.events, dataframe_headers, pyqt_container.regions, 75)
if settings["force accuracy"]: if settings.get("force accuracy", False):
force = point_data.useful_data["force"] force = point_data.useful_data["force"]
self._add_force_accuracy_region(point_data.events["Welding"], force, plot_item) self._add_force_accuracy_region(point_data.events["Welding"], force, plot_item)
if settings["ideals"] and settings["mirror ME"]: if settings.get("ideals", False) and settings.get("mirror ME", False):
for stage in point_data.events.keys(): for stage in point_data.events.keys():
ideal_data[stage] = self._shift_data("ME", description["Ideal_signals"], ideal_data[stage], lambda x: useful_data.range_ME-x) ideal_data[stage] = self._shift_data("ME", description["Ideal_signals"], ideal_data[stage], lambda x: useful_data.range_ME-x)
if settings["workpiece"]: if settings.get("workpiece", False):
self._add_workpiece(point_data, plot_item) self._add_workpiece(point_data, plot_item)
if settings["ideals"]: if settings.get("ideals", False):
self._add_ideal_stage_regions(plot_item, ideal_data, point_data.events, pyqt_container.regions, 100) self._add_ideal_stage_regions(plot_item, ideal_data, point_data.events, pyqt_container.regions, 100)
self._add_ideal_signals(plot_item, legend, ideal_data, point_data.events, description["Ideal_signals"], pyqt_container.curves, is_last) self._add_ideal_signals(plot_item, legend, ideal_data, point_data.events, description["Ideal_signals"], pyqt_container.curves, is_last)
if settings["performance"]: if settings.get("performance", False):
timings = self._calc_performance(timings, point_data, ideal_data, is_first, is_last) timings = self._calc_performance(timings, point_data, ideal_data, is_first, is_last)
self._parent._update_status(widget_steps, point_steps, widget_num, cur_point) self._parent._update_status(widget_steps, point_steps, widget_num, cur_point)