Repository navigation
PP-1: Fov.image_type per position, partial-mask helper, pinned brick surface - #263
Merged
Merged
Conversation
- Fov.image_type: the unit's declared "rgb" or "channels" from the published description, through FovIdentity (one source for Fov and FovSelection); RunInputs.image_type() (run-wide, null on described runs) removed. - make_described_run(mask_images=...) and testing.described_images: masks for a declared subset of the images (Spec v09, 2 of 6). - read_checked reuses the parse of the same status-file bytes (measured: 1,000 mask_check_status calls on a 10,000-position run 6.6 s -> 0.85 s, identical). - tests/test_brick_api_surface.py pins the brick-facing names and types; new Spec module tests/test_spec_fov_image_type.py. - Contract 9.1/16 and CHANGELOG Unreleased (v0.5.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 2 plan row PP-1 (MorphoBricks-Spec ADR 0002 AR8; contract §9.1 and §16), on main
43e3a93(PP-C + PP-0). Part of v0.5.1. Do not merge before the independent review.What changes
Fov.image_type, per position."rgb"or"channels"(a unit with noimage_type, experiment-v1 §4.4b), from the published description only, never from a header, never None on aFovfromfovs(). One source:FovIdentity.image_type(fov_identity.declared_image_type), whichFovand the resolver'sFovSelectionboth carry.resolve_requestnow readsfov.image_typeinstead of looking the unit up a second time.FovIdentity.image_type/FovSelection.image_typebecomestr. They are"channels"where PP-0 gaveNone.RESOLVER_VERSIONstays 1 because the resolver is not released before v0.5.1 and nothing consumes it yet. New constants:run_inputs_request.CHANNELSandIMAGE_TYPES.RunInputs.image_type()(breaking). It returned the manifest's run-level type from the command-line review, null on every described run, so it hid per-unit types. The manifest field stays as a record.make_described_run(..., masks=IDS, mask_images=PATHS)andwrite_described_tree(..., mask_images=)write masks only for the named images.testing.described_images(description)lists the tree's paths before anything is written. It is explicit only: no random subsets. These raiseValueErrorbefore any write:description_consume._parsed). The cost was inread_checked, which decoded the wholemask_representation.jsonon everymask_check_statuscall. It now reads the bytes each call and reuses the parse for identical bytes (lru_cache). The result is identical, a rewritten file is parsed again, andRunInputsholds no memo and pickles as before.v09run withNucleimasks: 1,000mask_check_statuscalls took 6.6 s before and 0.85 s after, with the same answers and the sameresolve_requestresult.resolve_requeststill takes about 3 s there, andmask_check_statusover all 10,000 positions about 12 s. Both come from linear scans per file (file_status,_mask_entry), not from the description.tests/test_brick_api_surface.pycovers theRunInputspublic methods and their signatures, the fields and types ofFov,RunInputs, the resolver records andCleanRun,RESOLVER_VERSION,make_described_run,make_clean_runanddescribed_images.Tests
tests/test_spec_fov_image_type.py, added tospec_gate.EXPECTED_MODULES:v28isrgbon all 32 FOVs;v13andv01arechannels.v29's RGB unit and channels unit keep their own types through the identity. The runtime refuses that mixed layout (R_HETEROGENEOUS_LAYOUT_NOT_ENABLED), so theFovs are checked on one run of each type.v09built by the helper with masks on 2 of 6 givesA_SCOPE_INCOMPLETE"present in 2 of 6" andrep1partial throughresolve_request, and gives a result equal to PP-0's hand-built tree.tests/test_checked_status_memo.py: the parse is reused only for the same bytes; a mask step run afteropenis seen; the pickle is unchanged.v09test now uses the helper; itsimage_type is Noneassertions now expect"channels".Gate
python tools/check.py: ruff check and format clean, code rules exit 0 (baseline not grown), 5069 passed, 4 skipped (filesystem and permission skips only). The Spec modules have 0 skips:tests/test_spec_*.pygives 1722 passed.Downstream
CellPatcher
main(347c61d) callsinputs.image_type()inrun_open.py:365,normalization.py:188andnotebook_session.py:160. Its v0.5.1 pin (CP-4) moves toFov.image_type. No other brick on main reads it: MorphoFeature, MorphoRelate, MorphoObjects, MorphoEmbed, fiberfeatures, MorphoCoverage and normalization were checked.Generated by Claude Code