优化日志显示
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""CCT / 色度一致性绘制。
|
||||
"""CCT / 色度一致性绘制。
|
||||
|
||||
Step 2 重构:从 pqAutomationApp.PQAutomationApp.plot_cct 原样搬迁。
|
||||
"""
|
||||
@@ -16,7 +16,7 @@ def plot_cct(self, test_type):
|
||||
gray_data = self.results.get_intermediate_data("cct", "gray")
|
||||
|
||||
if not gray_data or len(gray_data) < 2:
|
||||
self.log_gui.log("⚠️ 无 xy 数据可用")
|
||||
self.log_gui.log("无 xy 数据可用", level="error")
|
||||
ax = self.cct_fig.add_subplot(111)
|
||||
ax.text(
|
||||
0.5,
|
||||
@@ -46,9 +46,9 @@ def plot_cct(self, test_type):
|
||||
total_points = len(gray_data)
|
||||
grayscale = np.linspace(100 / total_points, 100, len(x_measured))
|
||||
|
||||
self.log_gui.log(f"✓ 已移除第一个数据点,当前数据点数: {len(x_measured)}")
|
||||
self.log_gui.log(f" x范围: {min(x_measured):.6f} - {max(x_measured):.6f}")
|
||||
self.log_gui.log(f" y范围: {min(y_measured):.6f} - {max(y_measured):.6f}")
|
||||
self.log_gui.log(f"已移除第一个数据点,当前数据点数: {len(x_measured)}", level="success")
|
||||
self.log_gui.log(f" x范围: {min(x_measured):.6f} - {max(x_measured):.6f}", level="info")
|
||||
self.log_gui.log(f" y范围: {min(y_measured):.6f} - {max(y_measured):.6f}", level="info")
|
||||
|
||||
# ========== 根据测试类型读取对应参数 ==========
|
||||
if test_type == "sdr_movie":
|
||||
@@ -57,50 +57,50 @@ def plot_cct(self, test_type):
|
||||
x_tolerance = float(self.sdr_cct_x_tolerance_var.get())
|
||||
y_ideal = float(self.sdr_cct_y_ideal_var.get())
|
||||
y_tolerance = float(self.sdr_cct_y_tolerance_var.get())
|
||||
self.log_gui.log("✓ 使用 SDR 色度参数")
|
||||
self.log_gui.log("使用 SDR 色度参数", level="success")
|
||||
except:
|
||||
x_ideal = 0.3127
|
||||
x_tolerance = 0.003
|
||||
y_ideal = 0.3290
|
||||
y_tolerance = 0.003
|
||||
self.log_gui.log("⚠️ SDR 参数读取失败,使用默认值")
|
||||
self.log_gui.log("SDR 参数读取失败,使用默认值", level="error")
|
||||
elif test_type == "hdr_movie":
|
||||
try:
|
||||
x_ideal = float(self.hdr_cct_x_ideal_var.get())
|
||||
x_tolerance = float(self.hdr_cct_x_tolerance_var.get())
|
||||
y_ideal = float(self.hdr_cct_y_ideal_var.get())
|
||||
y_tolerance = float(self.hdr_cct_y_tolerance_var.get())
|
||||
self.log_gui.log("✓ 使用 HDR 色度参数")
|
||||
self.log_gui.log("使用 HDR 色度参数", level="success")
|
||||
except:
|
||||
x_ideal = 0.3127
|
||||
x_tolerance = 0.003
|
||||
y_ideal = 0.3290
|
||||
y_tolerance = 0.003
|
||||
self.log_gui.log("⚠️ HDR 参数读取失败,使用默认值")
|
||||
self.log_gui.log("HDR 参数读取失败,使用默认值", level="error")
|
||||
else: # screen_module
|
||||
try:
|
||||
x_ideal = float(self.cct_x_ideal_var.get())
|
||||
x_tolerance = float(self.cct_x_tolerance_var.get())
|
||||
y_ideal = float(self.cct_y_ideal_var.get())
|
||||
y_tolerance = float(self.cct_y_tolerance_var.get())
|
||||
self.log_gui.log("✓ 使用屏模组色度参数")
|
||||
self.log_gui.log("使用屏模组色度参数", level="success")
|
||||
except:
|
||||
x_ideal = 0.306
|
||||
x_tolerance = 0.003
|
||||
y_ideal = 0.318
|
||||
y_tolerance = 0.003
|
||||
self.log_gui.log("⚠️ 屏模组参数读取失败,使用默认值")
|
||||
self.log_gui.log("屏模组参数读取失败,使用默认值", level="error")
|
||||
|
||||
x_low = x_ideal - x_tolerance
|
||||
x_high = x_ideal + x_tolerance
|
||||
y_low = y_ideal - y_tolerance
|
||||
y_high = y_ideal + y_tolerance
|
||||
|
||||
self.log_gui.log(f"✓ 用户设置参数:")
|
||||
self.log_gui.log(f" x-ideal={x_ideal:.4f}, tolerance={x_tolerance:.4f}")
|
||||
self.log_gui.log(f" x范围: [{x_low:.4f}, {x_high:.4f}]")
|
||||
self.log_gui.log(f" y-ideal={y_ideal:.4f}, tolerance={y_tolerance:.4f}")
|
||||
self.log_gui.log(f" y范围: [{y_low:.4f}, {y_high:.4f}]")
|
||||
self.log_gui.log(f"用户设置参数:", level="success")
|
||||
self.log_gui.log(f" x-ideal={x_ideal:.4f}, tolerance={x_tolerance:.4f}", level="info")
|
||||
self.log_gui.log(f" x范围: [{x_low:.4f}, {x_high:.4f}]", level="info")
|
||||
self.log_gui.log(f" y-ideal={y_ideal:.4f}, tolerance={y_tolerance:.4f}", level="info")
|
||||
self.log_gui.log(f" y范围: [{y_low:.4f}, {y_high:.4f}]", level="info")
|
||||
|
||||
# 为所有测试类型创建子图
|
||||
ax1 = self.cct_fig.add_subplot(211)
|
||||
@@ -180,7 +180,7 @@ def plot_cct(self, test_type):
|
||||
x_max_data = max(x_measured)
|
||||
data_range_x = x_max_data - x_min_data
|
||||
|
||||
self.log_gui.log(f" x数据波动: {data_range_x:.6f}")
|
||||
self.log_gui.log(f" x数据波动: {data_range_x:.6f}", level="info")
|
||||
|
||||
range_span = x_tolerance * 2
|
||||
margin_ratio = 0.20
|
||||
@@ -190,16 +190,16 @@ def plot_cct(self, test_type):
|
||||
final_y_max = max(x_max_data, x_high) + extra_margin
|
||||
|
||||
if x_min_data >= x_low and x_max_data <= x_high:
|
||||
self.log_gui.log(f" x数据在tolerance范围内,使用tolerance范围显示")
|
||||
self.log_gui.log(f" x数据在tolerance范围内,使用tolerance范围显示", level="info")
|
||||
final_y_min = x_low - extra_margin
|
||||
final_y_max = x_high + extra_margin
|
||||
else:
|
||||
self.log_gui.log(f" x数据超出tolerance范围,扩展显示范围")
|
||||
self.log_gui.log(f" x数据超出tolerance范围,扩展显示范围", level="info")
|
||||
|
||||
ax1.set_ylim(final_y_min, final_y_max)
|
||||
self.log_gui.log(
|
||||
f" x轴显示范围: {final_y_min:.6f} - {final_y_max:.6f} (跨度: {final_y_max - final_y_min:.6f})"
|
||||
)
|
||||
, level="info")
|
||||
|
||||
# ========== 下图:y coordinates ==========
|
||||
ax2.plot(
|
||||
@@ -273,7 +273,7 @@ def plot_cct(self, test_type):
|
||||
y_max_data = max(y_measured)
|
||||
data_range_y = y_max_data - y_min_data
|
||||
|
||||
self.log_gui.log(f" y数据波动: {data_range_y:.6f}")
|
||||
self.log_gui.log(f" y数据波动: {data_range_y:.6f}", level="info")
|
||||
|
||||
range_span = y_tolerance * 2
|
||||
extra_margin = range_span * margin_ratio
|
||||
@@ -282,16 +282,16 @@ def plot_cct(self, test_type):
|
||||
final_y_max = max(y_max_data, y_high) + extra_margin
|
||||
|
||||
if y_min_data >= y_low and y_max_data <= y_high:
|
||||
self.log_gui.log(f" y数据在tolerance范围内,使用tolerance范围显示")
|
||||
self.log_gui.log(f" y数据在tolerance范围内,使用tolerance范围显示", level="info")
|
||||
final_y_min = y_low - extra_margin
|
||||
final_y_max = y_high + extra_margin
|
||||
else:
|
||||
self.log_gui.log(f" y数据超出tolerance范围,扩展显示范围")
|
||||
self.log_gui.log(f" y数据超出tolerance范围,扩展显示范围", level="info")
|
||||
|
||||
ax2.set_ylim(final_y_min, final_y_max)
|
||||
self.log_gui.log(
|
||||
f" y轴显示范围: {final_y_min:.6f} - {final_y_max:.6f} (跨度: {final_y_max - final_y_min:.6f})"
|
||||
)
|
||||
, level="info")
|
||||
|
||||
# ========== 总标题 - 统一格式(去掉统计信息)==========
|
||||
test_type_name = self.get_test_type_name(test_type)
|
||||
@@ -321,4 +321,4 @@ def plot_cct(self, test_type):
|
||||
self.cct_canvas.draw()
|
||||
self.chart_notebook.select(self.cct_chart_frame)
|
||||
|
||||
self.log_gui.log("✓ xy 色度坐标图绘制完成")
|
||||
self.log_gui.log("xy 色度坐标图绘制完成", level="success")
|
||||
|
||||
Reference in New Issue
Block a user