From 3213a8b36c8bf9f05d59f3db78526daa4dab5bb0 Mon Sep 17 00:00:00 2001 From: StarCells Date: Sat, 14 Nov 2026 15:27:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B3=B0=E5=BD=A2=E5=9B=BE=EF=BC=9A=E5=88=86?= =?UTF-8?q?=E5=88=AB=E6=A0=87=E5=87=BA=E5=90=84=E9=80=9A=E9=81=93=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E6=8B=9F=E5=90=88=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - draw_zoom 给 R/G/B 各画一条同色虚线中心,标题显示通道间分歧与加权所用通道 - 合并后的单条中心不再掩盖通道之间对不上的事实 --- peak_finder.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/peak_finder.py b/peak_finder.py index ce7ff70..e7dff69 100644 --- a/peak_finder.py +++ b/peak_finder.py @@ -722,7 +722,18 @@ def draw_zoom(ax, spectrum: SpectrumData, line: dict, calibration, args, ax.plot([peak["center_px"] - 0.5 * peak["fwhm_px"], peak["center_px"] + 0.5 * peak["fwhm_px"]], [half, half], color=hq.CHANNEL_COLORS[channel], lw=0.8, marker="|", ms=6) + # Mark every channel's own centre: the merged line centre can hide the fact + # that the channels disagree (a shoulder in one channel drags the average). + if np.isfinite(peak["center_px"]): + ax.axvline(peak["center_px"], color=hq.CHANNEL_COLORS[channel], + lw=0.8, ls="--", alpha=0.8) ax.axvline(line["sensor_x_px"], color="#34495e", lw=0.9, ls=":") + spread = line.get("center_spread_px", float("nan")) + if np.isfinite(spread) and spread > 0: + used = "+".join(line.get("used_channels") or []) + ax.set_title(f"{line['id']} sensor x {line['sensor_x_px']:.2f} px " + f"channels disagree by {spread:.2f} px" + + (f" (centre from {used})" if used else ""), fontsize=9) ax.set_xlim(low, high) ax.set_xlabel("Sensor column / px") ax.set_ylabel("Net ADU (baseline removed)")