Skip to content

[Sad Catapella N3][Data integrity] Parameter channel indices silently truncate fractions and booleans #38

Closed

Description

@guijacquemet

Baseline and classification

Batch 3, f784c95e3049483f87466150ffc5764375fa631d. Confirmed input coercion; runtime integration not executed. Distinct from numerical normalization parameter validation.

Evidence

  • Parameters.__post_init__ lines 112–119 applies int(c) to every supplied channel index without checking that each is an integral, non-boolean value.
  • Parameters.select lines 144–153 also converts the requested channel identifiers via int(c) before membership validation, allowing 1.9 to be interpreted as channel 1 and True as channel 1.
  • Tests cover valid integer selection and unknown integer channels, but not fractional inputs, booleans or numeric strings.

Consequence / example

Parameters('z-score','image',None,True,(0.0,10.0),(1.0,1.0), channels=(0.0,1.9)) becomes channels (0,1) without warning. parameters.select([0.9]) silently selects channel 0 instead of rejecting an invalid channel identifier. This can associate normalization parameters with the wrong fluorescence marker.

Fix and tests

Require actual index-like integers (operator.index or explicit numbers.Integral policy) and reject bools. Validate no negatives and strictly increasing unique indices; preserve meaningful error messages. Test float fractions, float whole numbers, bool, text digits, NumPy integer scalar types, valid noncontiguous subsets, and mapping preservation. Do not silently round/truncate. No Numba role.

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