根据新版本调整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

@@ -4,6 +4,7 @@ Step 2 重构:从 pqAutomationApp.PQAutomationApp.plot_gamma 原样搬迁。
"""
import numpy as np
from app.solid_color_scale import solid_color_to_pct
from app.views.modern_styles import get_theme_palette
from typing import TYPE_CHECKING
@@ -25,7 +26,14 @@ def _is_dark_palette(palette: dict[str, str]) -> bool:
def plot_gamma(self: "PQAutomationApp", L_bar, results_with_gamma_list, target_gamma, test_type):
def plot_gamma(
self: "PQAutomationApp",
L_bar,
results_with_gamma_list,
target_gamma,
test_type,
pattern_params=None,
):
"""绘制Gamma曲线 + 数据表格(包含实测亮度)"""
palette = get_theme_palette()
dark_mode = _is_dark_palette(palette)
@@ -51,13 +59,19 @@ def plot_gamma(self: "PQAutomationApp", L_bar, results_with_gamma_list, target_g
for spine in self.gamma_ax.spines.values():
spine.set_color(palette["border"])
# 生成横坐标(灰阶百分比)
x_values = np.linspace(0, 100, len(L_bar))
# 横坐标:优先用 pattern 码值换算的灰阶百分比,否则等分
if pattern_params and len(pattern_params) == len(L_bar):
x_values = np.array([
solid_color_to_pct(row[0]) for row in pattern_params
])
else:
x_values = np.linspace(0, 100, len(L_bar))
# 反转 L_bar确保从左到右是 0% → 100%
if len(L_bar) > 1 and L_bar[0] > L_bar[-1]:
L_bar = L_bar[::-1]
results_with_gamma_list = results_with_gamma_list[::-1]
x_values = x_values[::-1]
# 计算平均Gamma
gamma_values = []