根据新版本调整set_pattern:0~65535

This commit is contained in:
xinzhu.yin
2026-07-07 18:59:44 +08:00
parent 9fa811a9eb
commit 32aaef1c0f
24 changed files with 3016 additions and 279 deletions

View File

@@ -51,12 +51,13 @@ def run_test(self: "PQAutomationApp", test_type, test_items):
, level="info")
# 根据测试类型执行不同的测试流程
ok = True
if test_type == "screen_module":
self.run_screen_module_test(test_items)
ok = self.run_screen_module_test(test_items)
elif test_type == "sdr_movie":
self.run_sdr_movie_test(test_items)
ok = self.run_sdr_movie_test(test_items)
elif test_type == "hdr_movie":
self.run_hdr_movie_test(test_items)
ok = self.run_hdr_movie_test(test_items)
elif test_type == "local_dimming":
self.log_gui.log(
"Local Dimming 为手动模式,请在 Local Dimming 面板发送图案并采集亮度",
@@ -65,7 +66,10 @@ def run_test(self: "PQAutomationApp", test_type, test_items):
# 测试完成后更新UI状态
if self.testing: # 如果没有被中途停止
self._dispatch_ui(self.on_test_completed)
if ok:
self._dispatch_ui(self.on_test_completed)
else:
self._dispatch_ui(self.on_test_error)
except Exception as e:
self.log_gui.log(f"测试过程中发生错误: {str(e)}", level="info")
import traceback
@@ -82,7 +86,7 @@ def run_screen_module_test(self: "PQAutomationApp", test_items):
self.new_pq_results("screen_module", "屏模组性能测试")
else:
self.log_gui.log("未选择任何测试项目", level="info")
return
return False
# 判断是否需要灰阶数据
needs_gray_data = any(
@@ -96,7 +100,7 @@ def run_screen_module_test(self: "PQAutomationApp", test_items):
for item in test_items:
if not self.testing: # 检查是否被停止
return
return False
current_item += 1
self.status_var.set(f"测试进行中... ({current_item}/{total_items})")
@@ -120,7 +124,7 @@ def run_screen_module_test(self: "PQAutomationApp", test_items):
if not shared_gray_data or len(shared_gray_data) < 2:
self.log_gui.log("灰阶数据采集失败或数据不足,跳过相关测试", level="error")
return
return False
self.log_gui.log(
f"灰阶数据采集完成,共 {len(shared_gray_data)} 个数据点"
@@ -148,6 +152,8 @@ def run_screen_module_test(self: "PQAutomationApp", test_items):
elif item == "contrast":
self.test_contrast("screen_module", shared_gray_data)
return True
def run_custom_sdr_test(self: "PQAutomationApp", test_items):
"""执行客户定制 SDR 测试 - 升级版"""
@@ -173,7 +179,7 @@ def run_sdr_movie_test(self: "PQAutomationApp", test_items):
self.new_pq_results("sdr_movie", "SDR Movie测试")
else:
self.log_gui.log("未选择任何测试项目", level="info")
return
return False
# 获取信号格式设置
color_space = self.sdr_color_space_var.get() # BT.709/BT.601/BT.2020
@@ -194,7 +200,7 @@ def run_sdr_movie_test(self: "PQAutomationApp", test_items):
for item in test_items:
if not self.testing:
return
return False
current_item += 1
self.status_var.set(f"测试进行中... ({current_item}/{total_items})")
@@ -212,7 +218,7 @@ def run_sdr_movie_test(self: "PQAutomationApp", test_items):
if not shared_gray_data or len(shared_gray_data) < 2:
self.log_gui.log("灰阶数据采集失败或数据不足", level="error")
return
return False
self.results.add_intermediate_data("shared", "gray", shared_gray_data)
@@ -235,6 +241,8 @@ def run_sdr_movie_test(self: "PQAutomationApp", test_items):
elif item == "accuracy":
self.test_color_accuracy("sdr_movie")
return True
def run_hdr_movie_test(self: "PQAutomationApp", test_items):
"""执行HDR Movie测试"""
@@ -244,7 +252,7 @@ def run_hdr_movie_test(self: "PQAutomationApp", test_items):
self.new_pq_results("hdr_movie", "HDR Movie测试")
else:
self.log_gui.log("未选择任何测试项目", level="info")
return
return False
# 获取信号格式设置
color_space = self.hdr_color_space_var.get()
@@ -269,7 +277,7 @@ def run_hdr_movie_test(self: "PQAutomationApp", test_items):
for item in test_items:
if not self.testing:
return
return False
current_item += 1
self.status_var.set(f"测试进行中... ({current_item}/{total_items})")
@@ -287,7 +295,7 @@ def run_hdr_movie_test(self: "PQAutomationApp", test_items):
if not shared_gray_data or len(shared_gray_data) < 2:
self.log_gui.log("灰阶数据采集失败或数据不足", level="error")
return
return False
self.results.add_intermediate_data("shared", "gray", shared_gray_data)
@@ -310,6 +318,8 @@ def run_hdr_movie_test(self: "PQAutomationApp", test_items):
elif item == "accuracy":
self.test_color_accuracy("hdr_movie")
return True
def send_fix_pattern(self: "PQAutomationApp", mode):
"""发送固定图案并采集数据 - 支持不同测试类型的信号格式"""
@@ -693,9 +703,9 @@ def test_gamma(self: "PQAutomationApp", test_type, gray_data=None):
# ========================================================
# 获取灰阶 pattern 参数用于22293 Gamma数据对齐
pattern_params = self.config.default_pattern_gray.get(
pattern_params = self.config.current_pattern.get(
"pattern_params", None
)
) or self.config.default_pattern_gray.get("pattern_params", None)
# 计算Gamma值使用修正后的 max_index_fix 和 8bit pattern参数
results_with_gamma_list, L_bar = self.calculate_gamma(
@@ -713,8 +723,12 @@ def test_gamma(self: "PQAutomationApp", test_type, gray_data=None):
target_gamma = 2.2
else:
target_gamma = 2.2
self.plot_gamma(L_bar, results_with_gamma_list, target_gamma, test_type)
self._save_chart_snapshot(test_type, "gamma", (L_bar, results_with_gamma_list, target_gamma, test_type))
self.plot_gamma(
L_bar, results_with_gamma_list, target_gamma, test_type, pattern_params
)
self._save_chart_snapshot(
test_type, "gamma", (L_bar, results_with_gamma_list, target_gamma, test_type)
)
self.log_gui.log("Gamma测试完成", level="success")
@@ -780,9 +794,9 @@ def test_eotf(self: "PQAutomationApp", test_type, gray_data=None):
self.log_gui.log(f"最终使用的 max_index_fix = {max_index_fix}", level="info")
# 获取灰阶 pattern 参数用于22293 Gamma数据对齐
pattern_params = self.config.default_pattern_gray.get(
pattern_params = self.config.current_pattern.get(
"pattern_params", None
)
) or self.config.default_pattern_gray.get("pattern_params", None)
# ========== 计算 EOTF复用 Gamma 计算逻辑使用8bit pattern参数==========
results_with_eotf_list, L_bar = self.calculate_gamma(