Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6137b12
#395: a channel keeps one mutual swap partner
claude Nov 24, 2026
240a50a
#428: key cached preview planes by the confirmed roles
claude Nov 24, 2026
7b639e6
#433: refuse a view of fewer than one channel before any read
claude Nov 24, 2026
35a01b2
#469: show a plane that cannot be read as the H&E card's and CLI's re…
claude Nov 24, 2026
464490f
#481: refuse converting a declared mask the run recorded no file of
claude Nov 24, 2026
2c01604
#514: an empty row fold drops the rows of its last fold
claude Nov 24, 2026
282ba0a
#521: rebuild the quick-scan role row when the image's shape changes
claude Nov 24, 2026
74eadf1
#523: keep only the log lines the technical-details panel shows
claude Nov 24, 2026
f68e4c2
#524: a run that writes its table forgets the earlier statistics and …
claude Nov 24, 2026
0daa4f1
#527: hide the earlier statistics when the percentiles are refused
claude Nov 24, 2026
475c06e
Changelog: quick fixes B (#395, #428, #433, #469, #481, #514, #521, #…
claude Nov 24, 2026
22dfebe
#395: choose mutual channel swaps by strength, never by name
claude Nov 24, 2026
da0aa32
#433: accept NumPy whole numbers of channels, refuse bool
claude Nov 24, 2026
e660cbf
#395: pin the swap tolerance with near-tie tests, say what it measures
claude Nov 24, 2026
84b96a5
Record the channel-swap pair tolerance in the manifest (owner decision)
claude Nov 24, 2026
b236e16
Merge main into claude/quick-fixes-b (CHANGELOG: keep both sides)
claude Nov 25, 2026
2d29b5d
Merge main into claude/quick-fixes-b (CHANGELOG: keep both sides)
claude Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ src/morphobricks_preprocessing/
the notebook's plots, intensity_text for the CLI
channel_identity.py channel-identity check (contract §14.1): per unit and channel a
scale-free log signature from the same summaries, within-condition robust
reference, channel_unlike_others / possible_channel_swap (warnings, never
blocking); channel_identity_model.py ChannelIdentitySettings (manifest key
reference, channel_unlike_others / possible_channel_swap /
ambiguous_channel_swap (warnings, never blocking; mutual pairs chosen by
strength, never by name, #395); channel_identity_model.py ChannelIdentitySettings (manifest key
channel_identity) and the results; channel_identity_text.py their words;
notebook_channel_identity.py its notebook view and plot
validation.py ValidationIssue (severity, code, message, paths, action), error()/warning() builders
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ v0.5.1: no run before v0.5.1 is read.)

## Unreleased

- **Quick fixes B (24 November 2026): channel QC, previews, notebook cards and state, results lifecycle.**
- **Mutual channel swaps are chosen by strength, never by channel name (#395).** A third channel swapped with one of a mutual pair overwrote its partner, so one channel was in two "look swapped" warnings. Candidate mutual pairs are now ranked by strength, the larger of the pair's two cross distances (smaller is stronger), and taken greedily from the strongest, each channel in one pair at most; a channel not in a chosen pair keeps its plain "does not look like X but like Y" warning. When pairs sharing a channel are within `pair_tolerance` (0.5 by default, a recorded limit since the entry below) of each other, none is named: a new warning `ambiguous_channel_swap` names every channel of the group, each with its distances, and says to check them all (`ChannelFinding.alternatives`; notebook row "Swap, pair unclear", its plot label lists every alternative). Channel names and image order no longer decide (with A at 1000/125/5000, B at 4000/500/20000 and C at 800/100/4000, a unit whose B shows C's reference and whose A and C show B's now gives "B and C look swapped", not "A and B"). Warning-only, as before. Contract §14.1, user guide. `tests/test_channel_identity_pairs.py`, `tests/test_notebook_channel_identity.py`.
- **Ambiguous-swap wording (#395 re-review).** The warning now says that the pairs are within `PAIR_TOLERANCE` robust deviations of each other in the larger of their two cross distances, and, for a channel with several alternatives, that those alternatives look alike in the other units, which is why no pair can be chosen. A three-cycle (A shows B, B shows C, C shows A) stays three plain look-alikes (documented, tested). `PAIR_TOLERANCE` and its computation are unchanged. Tests only otherwise.
- **The swap tolerance is a recorded limit (owner decision of 24 November 2026).** The constant `PAIR_TOLERANCE` that decides between a clean `possible_channel_swap` and an `ambiguous_channel_swap` is now `ChannelIdentitySettings.pair_tolerance` (default 0.5, `PAIR_TOLERANCE` is that default): a finite number of at least 0 (a negative, NaN, infinite, boolean or non-number value is refused; at 0 only exact ties are ambiguous), written to the run manifest's `channel_identity` with the seven other limits and read back from it, so a verdict can be reproduced from the manifest. The ambiguous warning and the printed limits name the tolerance used. Limits recorded without `pair_tolerance` (written by this branch before this change) are read with 0.5, explicitly: earlier code used 0.5 as a constant, and no released version recorded these limits or gave `ambiguous_channel_swap` (the check is not in v0.8.0, whose manifests have no `channel_identity` and still read as None), so an absent key only means that no ambiguity rule was recorded. Every other key stays required. Like the other channel-check limits it has no command-line option or notebook field (the settings API only). The manifest version does not change. Contract §9 and §14.1, user guide. `tests/test_channel_identity.py`, `tests/test_channel_identity_pairs.py` (the near-tie cases with tolerances 0.3, 0.5 and 0.8), `tests/test_channel_identity_run.py`.
- **Cached preview planes are keyed by the confirmed roles (#428).** `PreviewCache` keys held the path, fingerprint and coordinates but not the roles, so one file read as `ZCYX` and then `CZYX` showed the first reading's pixels. The key now holds the mapping's axes, roles and singleton roles (also for the discard after a rewrite). `tests/test_preview.py`.
- **A view of fewer than one channel is refused before any read (#433).** `ViewRequest(shown=...)` and `header_channels(..., shown)` raise a `ValueError` naming the value when it is not a whole number of at least 1, instead of an `IndexError`, `AttributeError` or `ZeroDivisionError` after reading. Any whole number (`numbers.Integral`, so NumPy integers too) is accepted and kept as an `int`; `bool` is refused (`header_preview.checked_shown`). `tests/test_image_viewer.py`.
- **A plane that cannot be read is the H&E tissue-mask card's and command's refusal (#469).** The preview and the write of the card, and `tissue-mask`, now catch `PlaneReadError` (`PlaneMemoryError`, `CompressionNotBoundedError`) and `OSError`: the card replaces "Computing the preview…" with the message and hides an earlier preview; the command prints the image's refusal and exits 1, without a traceback. `tests/test_notebook_tissue_mask.py`, `tests/test_cli_tissue_mask.py`.
- **Converting a declared mask the run recorded no file of is refused (#481).** The *Convert a mask* card said "The mask is converted." with nothing written; it now shows a red card naming the mask ID and its source type, and writes nothing. The run's manifest is read at the click (the card refreshes on the description only), so no stale state disables the button. `tests/test_notebook_mask_conversion.py`.
- **An empty row fold drops its earlier rows (#514).** `RowFold.arrange` kept the last fold's rows (and their images and callbacks) in its hidden box when nothing folded; it now empties the box and its line. `tests/test_notebook_row_fold.py`.
- **The quick-scan role row follows the image's shape (#521).** An image with the same axis letters but other lengths kept the earlier image's lengths in the labels; the row is now rebuilt for another shape, and the roles chosen for those letters are kept. `tests/test_notebook_scan_axes.py`.
- **The technical-details log keeps only the lines it shows (#523).** `_LogCapture.lines` is a `deque` of the latest 500 lines instead of every record of the session. `tests/test_notebook_log_capture.py`.
- **A run that writes its table forgets the earlier statistics and answer, even at the same path (#524).** The statistics, tiles, plot, table checks and the partial-presence answer were cleared only when the table's path changed; a rerun to the same path kept them for a new table. `_forget_comparison()` now clears them on a path change and after every run that wrote its table. `tests/test_notebook_extra_stain.py`.
- **Refused percentiles hide the earlier statistics (#527).** Percentiles out of 0 to 100 (or NaN, inf) left the previous table, tiles and plot on screen; they are now hidden with the refusal (also for a missing table). The table's checks and the partial-presence answer stay: the table did not change. `tests/test_notebook_statistics_refused.py`.
- **The strict description reader is linear in the repeats (#505).** Phase 5's `E_REPEAT_ID_SHADOWS_SOURCE` check (`description_semantics._repeat_membership`) compared every repeat ID with every member's source repeat and normalised both (NFC, case fold) for each pair: 36 million normalisations at 3,000 repeats. Each key is now computed once and the members are grouped by key in their listed order, so the issues (codes, paths, values, order) are the same; nothing accepted or refused changes. Median read (benchmark of #544, one 4-CPU Xeon 2.10 GHz container, same inputs and output digests before and after): 26/594/6,132/64,437 ms before, 18/194/621/2,444 ms after, for 100/1,000/3,000/10,000 repeats; growth exponent 1.95 before, 1.14 after from 3,000 to 10,000 (what remains is mostly the TOML decoding). `tests/test_description_semantics_shadows.py` checks the whole reader against the pair-by-pair scan on every vendored Spec fixture, and case, NFC and case-fold collisions.
- **A calibration target of only slashes is refused, never the whole experiment (#390, owner decision of 24 November 2026).** `calibration_entry` trimmed trailing separators before it checked for an absolute path, so `/`, `//`, `\` (and `.\`, `./.`, `.//`, `././`) became `.`: a line `/,X,0.5,um` in `calibration.csv`, `calibrate --size / XY 0.5 um` or the notebook's calibration card silently stated the size for every image. Such a target is now refused with `CalibrationTargetRootError` (a `ValueError`, reason `calibration_target_root`), naming the target and saying to give `.` for the whole experiment: `calibrate` and the notebook change nothing. Only `.` and `./` are the whole experiment: **`.\` and `./.`, accepted before as the whole experiment, are no longer accepted**, and **a hand-edited `calibration.csv` line whose target is `/` (or another of these), read before as the whole experiment, now stops the run with `calibration_unreadable`** naming the line, the file kept (`calibrate` and the notebook always write `.`, so only a hand edit has such a line). Other targets are unchanged. User guide §5 and §8. `tests/test_calibration_root_target.py`.
- **A failed Check folder clears the earlier check and says what to do (#101).** `check_folder` restored the button but had no `except`: a storage error during a recheck (an `OSError` from a Google Drive that stopped answering) ended in a raw traceback, and the earlier check, its labels, roles and confirmations stayed shown as valid. It now clears them (as a changed folder does; nothing can be run), shows a red message with the error, the folder and what to do (check that Google Drive is mounted, then check again), puts the traceback in Technical details, and the button works again. The clearing also covers what the shipped `steps()` notebook shows of a check (a clearing hook, `_clear_check_views`, that the stepper overrides): the Images page's axes and image-type lines and copies note, the Axes page's *Confirm these axes* offer (hidden and disabled), its axis status, the projection and OME-Zarr cards and the viewers over the checked images; and the recommended bin count (`Recommended: … bins`) of the earlier pixel type. It covers an error while the new check is shown (the results, the settings, the axis and run steps), a storage error while a changed folder's output hint and earlier run are read, and an interrupt (`KeyboardInterrupt`: cleared, then raised); the changed-folder path clears through the same hook. Storage errors (`OSError`) and the package's coded refusals are reported. *Decided (24 November 2026, review of #528):* any other exception, `RuntimeError` included, is a programming error and is raised after the state is cleared (the red message names it), rather than shown as a readable card as the issue first asked: a card would hide a defect to report. `tests/test_check_folder_errors.py`, `tests/test_check_folder_errors_steps.py`.
Expand Down
Loading
Loading