Skip to content

[Sad Catapella N7][Scientific QC] Inconsistent ImageSummary channel dimensions can omit repeat checks or raise IndexError #56

Closed

Description

@guijacquemet

Baseline and classification

Normalization Batch 7, f784c95e3049483f87466150ffc5764375fa631d. Confirmed unchecked public input dimensions and control-flow inconsistency, distinct from #23 (RGB type contract) and #44 (plane coordinates). No tests executed.

Evidence

  • ImageSummary is a public dataclass with no __post_init__: the median, p_low, p_high, saturated_fraction, and exact tuples can have different lengths, and the declared dtype/fractions can be inappropriate.
  • intensity_checks() lines 153–180 performs no consistency validation on independently supplied summaries.
  • _repeat_shifts() lines 229–249 iterates range(summaries[0].channel_count) for all repeats and indexes s.median[channel]. If the first summary has one channel but later repeats have two, C1 repeat-shift QC is silently omitted. If the first has two and a later repeat has one, it may raise an unrelated IndexError.
  • _image_outliers() lines 188–198 similarly uses each group's first summary's count, and _no_spread() lines 301–305 zips p_low/p_high with strict=True; inconsistent dimensions fail late or omit measurements.
  • image_summaries() lines 165–171 validates channel counts for its own outputs, but that protection is bypassed for public direct ImageSummary inputs.

Fix and acceptance

At construction and/or the public QC entrypoint, require nonempty and consistent channel tuple lengths per summary, consistent channel cardinality among compared summaries (ideally across the supplied experiment), valid integer/float dtype and valid saturation fractions in [0,1] or None; ensure p_low <= p_high when both available, with explicit policy for absent values. Reject mismatches with source path, repeat and channel index rather than silently skipping or allowing IndexError. Test direct one-vs-two channel summaries in both orders, internally mismatched tuple lengths, empty/nonfinite channels, invalid fractions and ordinary image_summaries output. Numba offers no benefit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions