简表改用半高处的左右展宽(10% 处容易被邻近结构污染成 nan 或假比值)

This commit is contained in:
starcells committed 2026-11-14 16:23:36 +08:00
1 parent f053723791
commit d03b4b0979
1 file changed
+3 -3
+3 -3
View File
@@ -837,7 +837,7 @@ def _clean_output(directory: Path) -> None:
def ten_percent_widths(spectrum: "SpectrumData", line: dict,
fraction: float = 0.10,
fraction: float = 0.50,
limit_px: float = float("nan")) -> dict:
"""Left and right half-widths where the profile falls to ``fraction`` of the peak.
@@ -1516,7 +1516,7 @@ def run(args) -> int:
limit = 0.5 * min(gaps) if gaps else float("nan")
shapes.append(ten_percent_widths(spectrum, line, limit_px=limit))
write_csv(result["output"] / "peak_summary.csv",
["id", "x_px", "left_10pct_px", "right_10pct_px", "ratio_right_over_left"],
["id", "x_px", "left_half_px", "right_half_px", "ratio_right_over_left"],
([line["id"], _num(line["sensor_x_px"], 4), _num(shape["left_px"], 4),
_num(shape["right_px"], 4), _num(shape["ratio"], 4)]
for line, shape in zip(lines, shapes)))
@@ -1543,7 +1543,7 @@ def run(args) -> int:
tell(f"{len(lines)} line(s) from {total} channel peak(s); {len(selected)} selected.")
if lines:
tell("")
tell("10% height widths (asymmetry = right / left):")
tell("half-height widths (asymmetry = right / left):")
tell(f"{'id':6s}{'x_px':>11s}{'left':>9s}{'right':>9s}{'ratio':>8s}")
for line, shape in zip(lines, shapes):
def _shape(value):