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)")