You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Sad Catapella N6][Performance/Validation] RGB fit computes full image histograms before rejecting invalid channel count or pixel dtype #52
Normalization Batch 6 at f784c95e3049483f87466150ffc5764375fa631d. Confirmed avoidable workload and late input rejection, runtime cost not measured.
Evidence
fit() lines 357–379 calls _pixel_histograms(statistics, channel_axis) unconditionally for pixel-array inputs and only afterward calls check_rgb(channel_count, _dtypes(items)).
_pixel_histograms() lines 436–442 constructs a complete histogram for each supplied channel, using np.take copies. For a four-channel uint16 FOV the calculation may include large per-channel arrays and multiple passes before a simple channel-count check rejects the RGB input. For invalid float32 RGB data, float histogram/range-check processing is similarly wasted.
RGB tests assert the errors but never assert they happen before histogram extraction. Prior performance issue #40 concerns unnecessary copies for valid pixel-array fits; this issue concerns needless full-image computation on invalid RGB input.
Fix / acceptance
When settings.image_type == 'rgb' and statistics is a raw array, check validated channel-axis cardinality and raw dtype before_pixel_histograms. For record inputs, validate first record/channel_count and group dtype consistency before constructing pooled histograms. Ensure invalid channel_axis errors remain actionable, empty planes still report NoValidPixelsError as before, and the preflight policy agrees with #23's resolved RGB dtype support. Use monkeypatched histogram function to assert zero histogram calls for invalid RGB shape/dtype, and test both positive and negative axis indexing, 3-channel uint8/16 success, noncontiguous view, and mixed records. Benchmark rejected large FOV latency and peak memory but no fabricated speedup claims. Numba is not required.
Activity
Move the RGB input checks into rgb.py, within the code-rule limits (#51…