From b97c92e5689a22bd562304e000faea19827f7528 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 02:21:00 +0000 Subject: [PATCH 1/3] Release v0.7.1: NumPy int64 per-bin work (D6), stable optical-density helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pyproject 0.7.1. CHANGELOG 'Unreleased' becomes v0.7.1 (2026-11-17) with a summary line: a patch release (#104 speed-up with every output bitwise that of v0.7.0; #108 contract §3.6, docs and tests only). No API, file-format or message change; only the recorded library_version reads 0.7.1. README release line, feature list and install command; plan status; contract status table (rows 1.5, 3.5 and 3.6 named their release as "unreleased"). No code change. Checked: tools/check.py with PYTEST_ADDOPTS unset, scikit-image and csbdeep installed: 2742 passed, 0 skipped; Ruff format, code rules and Ruff check clean. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- CHANGELOG.md | 8 +++++++- README.md | 9 ++++++--- docs/contract.md | 6 +++--- docs/plan.md | 2 +- pyproject.toml | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96952ca..31ebaa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,13 @@ Release notes and migration notes of `morphobricks-normalization`. Numbers are p issues of [CellMigrationLab/morphobricks-normalization](https://github.com/CellMigrationLab/morphobricks-normalization). The decisions are in [docs/plan.md](docs/plan.md) §12. -## Unreleased +## v0.7.1 (2026-11-17) + +Patch release (#104, #108): the per-bin work of integer planes is 1.3–1.5× faster with every +output bitwise that of v0.7.0, and three existing optical-density helpers are documented as stable +API (contract §3.6). No API, file-format or message change; the package still imports with NumPy +only. Consumers on v0.7.0 can re-pin without code changes; only the recorded `library_version` +(settings, range-check and intensity-check provenance) reads `0.7.1`. Speed only (MorphoBricks preprocessing speed plan, step D6; measured in preprocessing draft PR #318, `experiments/histogram_numba_study/`): every output is bitwise that of v0.7.0. No new diff --git a/README.md b/README.md index 0ce898a..6b0ef9d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ out of scope for now. ## Status -Pre-alpha; the latest release is v0.7.0. The library offers: +Pre-alpha; the latest release is v0.7.1. The library offers: - supported pixel types, bin counts and per-plane histograms (`dtypes`, `histogram`), with a robust range and a range check; - plane records, `plane_histograms.csv` reading and writing and pooling of group statistics (`records`, `csv_io`, `pooling`): schema version 5 since v0.5.0, with channels named by canonical channel ID (ADR 0003; version 4 tables are refused, see the CHANGELOG migration notes); @@ -41,7 +41,10 @@ Pre-alpha; the latest release is v0.7.0. The library offers: - since v0.7.0, the one region checker of every MorphoBricks brick (`regions.check_region`, `RegionEstimate` for a white or stain vector over an empty region) and the shared resolver-version refusal (`contracts.refuse_resolver_version`), MorphoBricks-Spec ADR 0005 - (contract §3.5). + (contract §3.5); +- since v0.7.1, the optical-density helpers `optical_density.optical_density`, + `optical_density.check_white` and `scalar_inputs.rgb_yxc` are stable API (contract §3.6), and + the per-bin work of integer planes runs in NumPy int64 (same outputs, 1.3–1.5× faster). Release notes and migration notes are in [CHANGELOG.md](CHANGELOG.md). @@ -63,7 +66,7 @@ for key, rows in groups.items(): ## Installation ```bash -pip install "git+https://github.com/CellMigrationLab/morphobricks-normalization.git@v0.7.0" +pip install "git+https://github.com/CellMigrationLab/morphobricks-normalization.git@v0.7.1" ``` For development, from a clone: diff --git a/docs/contract.md b/docs/contract.md index 19e0ba0..4a54219 100644 --- a/docs/contract.md +++ b/docs/contract.md @@ -22,9 +22,9 @@ with modality profiles, purpose rules, colour statistics and references is withd | 1.3 and 6. Channels across columns (`plane_histograms.csv` schema version 3); per-channel columns of 7.1 and 8.1 | Milestone 2b (done; the columns of 7.1 in Milestone 4, done) | | 7. Intensity checks | Milestone 4 (done) | | 1.4 Robust histogram range and range check; `plane_histograms.csv` schema version 4 (6.2) | Milestone 5 (done) | -| 1.5 and 6. Channels by canonical channel ID (`plane_histograms.csv` schema version 5); per-channel columns of 7.1 and 8.1 by ID | Stage 3 S3.2 ([ADR 0003](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0003-plane-histograms-v5.md); draft, unreleased) | -| 3.5 Regions (`check_region`, `RegionEstimate`) and the resolver-version refusal | [ADR 0005](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0005-binary-masks.md) step 1 (plan N70; unreleased) | -| 3.6 Stable optical-density helpers (`check_white`, `optical_density`, `rgb_yxc`) | Documented as stable API for preprocessing's H&E tissue mask (P2; no code change; unreleased) | +| 1.5 and 6. Channels by canonical channel ID (`plane_histograms.csv` schema version 5); per-channel columns of 7.1 and 8.1 by ID | Stage 3 S3.2 ([ADR 0003](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0003-plane-histograms-v5.md); v0.5.0) | +| 3.5 Regions (`check_region`, `RegionEstimate`) and the resolver-version refusal | [ADR 0005](https://github.com/CellMigrationLab/MorphoBricks-Spec/blob/main/docs/adr/0005-binary-masks.md) step 1 (plan N70; v0.7.0) | +| 3.6 Stable optical-density helpers (`check_white`, `optical_density`, `rgb_yxc`) | Documented as stable API for preprocessing's H&E tissue mask (P2; no code change; v0.7.1) | | 9. Validation | With the milestone of each check | Notation: `x` is a pixel value in source units; `n` a pixel count; channels are numbered diff --git a/docs/plan.md b/docs/plan.md index 9d112e3..6eb04f9 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -2,7 +2,7 @@ > See also: [Preprocessing follow-up](archive/followup_preprocessing.md) (done) · [CellPatcher follow-up](archive/followup_cellpatcher.md) (done) -**Status:** implemented through v0.7.0 (Milestones 0 to 5 done; later changes in [CHANGELOG.md](../CHANGELOG.md)); design brief simplified on 26 October 2026 (decisions N29–N40, §12), with +**Status:** implemented through v0.7.1 (Milestones 0 to 5 done; later changes in [CHANGELOG.md](../CHANGELOG.md)); design brief simplified on 26 October 2026 (decisions N29–N40, §12), with channels moved into columns on 27 October 2026 (N41–N45). The earlier design with six modalities, two purposes, colour and stain methods and reference targets (N4–N28) is withdrawn where §12 says so. A robust histogram range was added on 28 October diff --git a/pyproject.toml b/pyproject.toml index 9e3af86..cd639f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "morphobricks-normalization" -version = "0.7.0" +version = "0.7.1" description = "MorphoBricks normalization brick: per-plane statistics, their file formats, and normalization methods for microscopy images." readme = "README.md" license = "MIT" From 99a3264e0517fb5e3aad19e111721d01b4e01e98 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 05:28:36 +0000 Subject: [PATCH 2/3] Release v0.7.1: add #105 to the release notes The v0.7.1 summary no longer says every output is bitwise that of v0.7.0: outputs equal v0.7.0's except that -0.0 is written as 0.0 (#105) and np.float64 limits of a caller-built PlaneHistogram are written as plain numbers (before np.float64(...), which no reader could read). schema_version unchanged. Moves a misplaced paragraph of the #105 entry back into its first bullet. README feature line mentions #105. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- CHANGELOG.md | 26 ++++++++++++++------------ README.md | 3 ++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2962908..8d50033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,14 @@ The decisions are in [docs/plan.md](docs/plan.md) §12. ## v0.7.1 (2026-11-17) -Patch release (#104, #108): the per-bin work of integer planes is 1.3–1.5× faster with every -output bitwise that of v0.7.0, and three existing optical-density helpers are documented as stable -API (contract §3.6). No API, file-format or message change; the package still imports with NumPy -only. Consumers on v0.7.0 can re-pin without code changes; only the recorded `library_version` -(settings, range-check and intensity-check provenance) reads `0.7.1`. +Patch release (#104, #105, #108): the per-bin work of integer planes is 1.3–1.5× faster, signed +zero is written as `0.0`, and three existing optical-density helpers are documented as stable API +(contract §3.6). Every output equals v0.7.0's, with two exceptions in written text only: a `-0.0` +is now written as `0.0` (#105), and `np.float64` histogram limits of a caller-built +`PlaneHistogram` are now written as plain numbers (`0.25`; before `np.float64(0.25)`, which no +reader could read). Every `schema_version` is unchanged, and no API or message changes; the +package still imports with NumPy only. Consumers on v0.7.0 can re-pin without code changes; the +recorded `library_version` (settings, range-check and intensity-check provenance) reads `0.7.1`. Signed zero is written as `0.0` (#105; owner decision 17 November 2026, plan N71). Behaviour change for written text only: no computed value, algorithm, API, schema version or message @@ -21,7 +24,11 @@ changes. (`Intensity_Min/MaxIntensity`, `Histogram_BinningMin/Max`, the underflow and overflow means and standard deviations), the `Normalization_Offset/Scale_` columns of `Parameters.to_columns()` and the percentiles of `percentile_name` (which already wrote - `-0.0` as `0`; now through the same helper). + `-0.0` as `0`; now through the same helper). A float plane holding both `-0.0` and `+0.0` + has a `pixel_min` or `pixel_max` of either zero depending on NumPy's `min`/`max`, the element + order and the platform; the same pixels now write the same bytes everywhere. `x + 0.0` + changes no float but `-0.0`; NaN and the infinities are written as before. The in-memory + `PlaneHistogram`, `Parameters` and `ImageSummary` values keep their sign. - **Values handed to a caller who writes them change only at zero** (`positive_zero`): in `ImageSummary.to_row()` and in the run-configuration dictionaries `NormalizationSettings.to_dict()` (`percentile`), `HistogramSettings.to_dict()` @@ -33,12 +40,7 @@ changes. numbers): a NumPy float zero of either sign is now written `0.0` too. Side fix: `np.float64` limits were written as `np.float64(0.25)`, which the reader refuses; they are now written as the Python float's `repr` (`0.25`) and read back. `np.float32` and integer limits are written - as before (`str`). A float - plane holding both `-0.0` and `+0.0` has a `pixel_min` or `pixel_max` of either zero - depending on NumPy's `min`/`max`, the element order and the platform; the same pixels now - write the same bytes everywhere. `x + 0.0` changes no float but `-0.0`; NaN and the - infinities are written as before. The in-memory `PlaneHistogram`, `Parameters` and - `ImageSummary` values keep their sign. + as before (`str`). - **Files that change**: only those that held `-0.0`, now `0.0` in the same cells (they read back as an equal float). No recorded golden or parity table of this repository holds a `-0.0`, and `tools/dump_outputs.py` (default and `--corpus`) gives the same digests as diff --git a/README.md b/README.md index 6b0ef9d..a30d02d 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ Pre-alpha; the latest release is v0.7.1. The library offers: (contract §3.5); - since v0.7.1, the optical-density helpers `optical_density.optical_density`, `optical_density.check_white` and `scalar_inputs.rgb_yxc` are stable API (contract §3.6), and - the per-bin work of integer planes runs in NumPy int64 (same outputs, 1.3–1.5× faster). + the per-bin work of integer planes runs in NumPy int64 (same outputs, 1.3–1.5× faster); + every written float writes `-0.0` as `0.0` (#105). Release notes and migration notes are in [CHANGELOG.md](CHANGELOG.md). From 390311fda7d3f4bbb35958f66506567dca6e36c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 05:28:36 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Contract=20=C2=A77.1:=20to=5Frow=20keeps=20?= =?UTF-8?q?caller=20values'=20types;=20rewrap=20(#110=20review=20nits)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only a float zero of either sign is replaced by 0.0; floats come from image_summaries and a caller-given value keeps its type. Rewraps the short line left by #110. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc --- docs/contract.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/contract.md b/docs/contract.md index 44ef9ba..052e0ac 100644 --- a/docs/contract.md +++ b/docs/contract.md @@ -1069,12 +1069,13 @@ histograms). Each summary holds the channels of its image by ID (`ImageSummary.c types (`IncompatibleSummariesError`, a `ValueError`). An `ImageSummary` whose per-channel tuples have different lengths is refused when made, and `intensity_checks` refuses summaries with different numbers of channels or different percentile definitions, with the same error. -`ImageSummary.to_row()` gives the columns below as a dictionary, in this order (numbers as -floats, `-0.0` as `0.0` (N71), a blank as `None`, `Histogram_Exact_` as a bool; a -channel the image does not have is not in the row and is blank in a table), and -`summary_columns(channel_ids)` the names -for the experiment's channel IDs, so the calling brick can show the rows as a table or write them; the -library writes no file (N50). The columns are the shared columns `source_relative_path`, +`ImageSummary.to_row()` gives the columns below as a dictionary, in this order (each number +as the summary holds it: floats from `image_summaries`, and a value a caller gave keeps its +type; only a float zero of either sign is replaced by `0.0`, N71; a blank as `None`, +`Histogram_Exact_` as a bool; a channel the image does not have is not in the row and is +blank in a table), and `summary_columns(channel_ids)` the names for the experiment's channel +IDs, so the calling brick can show the rows as a table or write them; the library writes no +file (N50). The columns are the shared columns `source_relative_path`, `condition`, `biological_repeat`, `technical_repeat`, `image_file`, and for each channel ID (§6.1):