优化日志显示
This commit is contained in:
@@ -287,7 +287,7 @@ def plot_accuracy(self, accuracy_data, test_type):
|
||||
grade_color = "orange"
|
||||
else:
|
||||
grade = "需要校准"
|
||||
grade_icon = "✗"
|
||||
grade_icon = "[Error]"
|
||||
grade_color = "red"
|
||||
|
||||
self.accuracy_ax.text(
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""EOTF 曲线绘制(HDR)。
|
||||
"""EOTF 曲线绘制(HDR)。
|
||||
|
||||
Step 2 重构:从 pqAutomationApp.PQAutomationApp.plot_eotf 原样搬迁。
|
||||
"""
|
||||
@@ -145,4 +145,4 @@ def plot_eotf(self, L_bar, results_with_eotf_list, test_type):
|
||||
except:
|
||||
pass
|
||||
|
||||
self.log_gui.log("EOTF 曲线 + 数据表格绘制完成")
|
||||
self.log_gui.log("EOTF 曲线 + 数据表格绘制完成", level="success")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Gamma 曲线绘制。
|
||||
"""Gamma 曲线绘制。
|
||||
|
||||
Step 2 重构:从 pqAutomationApp.PQAutomationApp.plot_gamma 原样搬迁。
|
||||
"""
|
||||
@@ -139,4 +139,4 @@ def plot_gamma(self, L_bar, results_with_gamma_list, target_gamma, test_type):
|
||||
self.gamma_canvas.draw()
|
||||
self.chart_notebook.select(self.gamma_chart_frame)
|
||||
|
||||
self.log_gui.log("Gamma曲线 + 数据表格绘制完成")
|
||||
self.log_gui.log("Gamma曲线 + 数据表格绘制完成", level="success")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""色域图(Gamut)绘制。
|
||||
"""色域图(Gamut)绘制。
|
||||
|
||||
Step 2 重构:从 pqAutomationApp.PQAutomationApp.plot_gamut 整体搬迁,
|
||||
实现与原方法完全一致;原方法仅保留为一行转发。
|
||||
@@ -30,7 +30,7 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
UV_PIXELS_PER_U = 615.7260
|
||||
UV_PIXELS_PER_V = 599.8432
|
||||
|
||||
# ========== ✅ 读取用户选择的参考标准 ==========
|
||||
# ========== 读取用户选择的参考标准 ==========
|
||||
if test_type == "screen_module":
|
||||
current_ref = self.screen_gamut_ref_var.get()
|
||||
elif test_type == "sdr_movie":
|
||||
@@ -40,7 +40,7 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
else:
|
||||
current_ref = "DCI-P3"
|
||||
|
||||
# ========== ✅✅✅ 根据参考标准重新计算覆盖率(XY 空间)==========
|
||||
# ========== ✅✅根据参考标准重新计算覆盖率(XY 空间)==========
|
||||
xy_coverage = coverage # 默认使用传入的值
|
||||
uv_coverage = 0.0
|
||||
|
||||
@@ -67,18 +67,18 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
xy_points
|
||||
)
|
||||
else:
|
||||
self.log_gui.log(f"⚠️ 未知参考标准 '{current_ref}',使用 DCI-P3")
|
||||
self.log_gui.log(f"未知参考标准 '{current_ref}',使用 DCI-P3", level="error")
|
||||
_, xy_coverage = pq_algorithm.calculate_gamut_coverage_DCIP3(
|
||||
xy_points
|
||||
)
|
||||
current_ref = "DCI-P3"
|
||||
|
||||
self.log_gui.log(
|
||||
f"✓ XY 空间覆盖率({current_ref}): {xy_coverage:.1f}%"
|
||||
)
|
||||
f"XY 空间覆盖率({current_ref}): {xy_coverage:.1f}%"
|
||||
, level="success")
|
||||
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"⚠️ 重新计算 XY 覆盖率失败: {str(e)}")
|
||||
self.log_gui.log(f"重新计算 XY 覆盖率失败: {str(e)}", level="error")
|
||||
xy_coverage = coverage # 回退到传入值
|
||||
# =================================================
|
||||
|
||||
@@ -87,7 +87,7 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
img_xy = mpimg.imread(get_resource_path("assets/cie.png"))
|
||||
h_xy, w_xy = img_xy.shape[:2]
|
||||
|
||||
self.log_gui.log(f"加载 XY 色域图: {w_xy}x{h_xy}")
|
||||
self.log_gui.log(f"加载 XY 色域图: {w_xy}x{h_xy}", level="info")
|
||||
|
||||
self.gamut_ax_xy.imshow(img_xy, extent=[0, w_xy, h_xy, 0], aspect="equal")
|
||||
self.gamut_ax_xy.set_xlim(0, w_xy)
|
||||
@@ -109,7 +109,7 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
self.log_gui.log(
|
||||
f"测量色域: R({red_x:.4f},{red_y:.4f}) "
|
||||
f"G({green_x:.4f},{green_y:.4f}) B({blue_x:.4f},{blue_y:.4f})"
|
||||
)
|
||||
, level="info")
|
||||
|
||||
# ========== 绘制测量三角形 ==========
|
||||
points = [
|
||||
@@ -257,7 +257,7 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
zorder=3,
|
||||
)
|
||||
|
||||
# ========== ✅ XY 覆盖率标注(使用重新计算的值)==========
|
||||
# ========== XY 覆盖率标注(使用重新计算的值)==========
|
||||
self.gamut_ax_xy.text(
|
||||
w_xy * 0.85,
|
||||
h_xy * 0.92,
|
||||
@@ -287,17 +287,17 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"XY 图绘制失败: {str(e)}")
|
||||
self.log_gui.log(f"XY 图绘制失败: {str(e)}", level="error")
|
||||
import traceback
|
||||
|
||||
self.log_gui.log(traceback.format_exc())
|
||||
self.log_gui.log(traceback.format_exc(), level="error")
|
||||
|
||||
# ========== 右图:CIE 1976 u'v' ==========
|
||||
try:
|
||||
img_uv = mpimg.imread(get_resource_path("assets/cie_uv.png"))
|
||||
h_uv, w_uv = img_uv.shape[:2]
|
||||
|
||||
self.log_gui.log(f"加载 UV 色域图: {w_uv}x{h_uv}")
|
||||
self.log_gui.log(f"加载 UV 色域图: {w_uv}x{h_uv}", level="info")
|
||||
|
||||
self.gamut_ax_uv.imshow(img_uv, extent=[0, w_uv, h_uv, 0], aspect="equal")
|
||||
self.gamut_ax_uv.set_xlim(0, w_uv)
|
||||
@@ -329,18 +329,18 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
[u, v] for u, v in [xy_to_uv(r[0], r[1]) for r in rgb_results]
|
||||
]
|
||||
|
||||
self.log_gui.log(f"UV 坐标: {uv_coords}")
|
||||
self.log_gui.log(f"UV 坐标: {uv_coords}", level="info")
|
||||
|
||||
# ========== ✅✅✅ 计算 u'v' 覆盖率(使用参考标准)==========
|
||||
# ========== ✅✅计算 u'v' 覆盖率(使用参考标准)==========
|
||||
try:
|
||||
uv_coverage = pq_algorithm.calculate_uv_gamut_coverage(
|
||||
uv_coords, reference=current_ref
|
||||
)
|
||||
self.log_gui.log(
|
||||
f"✓ UV 空间覆盖率({current_ref}): {uv_coverage:.1f}%"
|
||||
)
|
||||
f"UV 空间覆盖率({current_ref}): {uv_coverage:.1f}%"
|
||||
, level="success")
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"⚠️ 计算 UV 覆盖率失败: {str(e)}")
|
||||
self.log_gui.log(f"计算 UV 覆盖率失败: {str(e)}", level="error")
|
||||
uv_coverage = 0.0
|
||||
# =================================================
|
||||
|
||||
@@ -491,7 +491,7 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
zorder=3,
|
||||
)
|
||||
|
||||
# ========== ✅ UV 覆盖率标注(使用动态计算的值)==========
|
||||
# ========== UV 覆盖率标注(使用动态计算的值)==========
|
||||
self.gamut_ax_uv.text(
|
||||
w_uv * 0.85,
|
||||
h_uv * 0.92,
|
||||
@@ -521,10 +521,10 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"UV 图绘制失败: {str(e)}")
|
||||
self.log_gui.log(f"UV 图绘制失败: {str(e)}", level="error")
|
||||
import traceback
|
||||
|
||||
self.log_gui.log(traceback.format_exc())
|
||||
self.log_gui.log(traceback.format_exc(), level="error")
|
||||
|
||||
# ========== 总标题 ==========
|
||||
test_type_name = self.get_test_type_name(test_type)
|
||||
@@ -535,4 +535,4 @@ def plot_gamut(self, results, coverage, test_type):
|
||||
self.gamut_canvas.draw()
|
||||
self.chart_notebook.select(self.gamut_chart_frame)
|
||||
|
||||
self.log_gui.log("色域图绘制完成")
|
||||
self.log_gui.log("色域图绘制完成", level="success")
|
||||
|
||||
Reference in New Issue
Block a user