From 5e636e082c7ee15227b85ac193d3572934d8dc6a Mon Sep 17 00:00:00 2001 From: diaco Date: Wed, 23 Sep 2026 11:01:42 +0330 Subject: [PATCH] =?UTF-8?q?Leave=20reference=20sample=20=CE=94E=20blank=20?= =?UTF-8?q?in=20CSV=20and=20HTML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- average-results.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/average-results.py b/average-results.py index 8f33434..82b3314 100755 --- a/average-results.py +++ b/average-results.py @@ -117,10 +117,11 @@ def de2000(lab1, lab2) -> float: def add_delta_e(rows: list[dict], references: dict[str, str]) -> bool: """Add a CIEDE2000 column to each averaged row vs that sample's reference. - Samples absent from `references` are references themselves (dE00 = 0). - Returns True if the column was written (only when at least one sample - names a reference). Never raises so the scan pipeline can continue even - when a named reference is missing. + Samples absent from `references` are references themselves (dE00 left + empty — they have no external comparison). Returns True if the column + was written (only when at least one sample names a reference). Never + raises so the scan pipeline can continue even when a named reference + is missing. """ if not rows or not references: return False @@ -131,7 +132,7 @@ def add_delta_e(rows: list[dict], references: dict[str, str]) -> bool: sid = row["sample_id"] ref_id = references.get(sid) if ref_id is None: - row[DE_COL] = 0.0 + row[DE_COL] = "" wrote = True continue ref_row = by_id.get(ref_id) @@ -221,10 +222,10 @@ def write_html( if has_de: raw = r.get(DE_COL, "") if raw == "" or raw is None: - cells.append('—') + cells.append("—") else: d = float(raw) - de_cls = "de win" if is_ref else ("de bad" if d >= 3.5 else "de") + de_cls = "de bad" if d >= 3.5 else "de" cells.append( f'{d:.2f}' ) @@ -252,7 +253,7 @@ def write_html( Averaged color measurements