Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ src/morphobricks_preprocessing/
notebooks/MorphoBricks_Preprocessing.ipynb thin notebook: every code cell calls notebook_ui only
notebooks/notebook_latest_versions.yaml the notebook's latest version, for LabConstrictor's version check
tests/ pytest with simulated TIFFs (tests/tiff_tree.py, tests/simulation.py); the
schema-version-2 fixture (tests/v2_fixture.py, tests/data)
histogram science goldens (tests/histogram_goldens.py, tests/data)
experiments/binning_study/ the study behind the binning decisions (not part of the package)
```

Expand Down Expand Up @@ -534,9 +534,9 @@ functions the tests use.
- **Rows** are sorted by path, then z, t.
- **Earlier versions:** the reader refuses schema 1 and 2 (`CsvFormatError`); a run
recomputes them completely (manifest `schema_version` differs). Each channel's
histogram equals the version-2 row's, whole and in blocks
(`tests/test_schema_v2_equivalence.py` with the committed fixture in `tests/data`,
written by `tests/data/make_v2_fixture.py` with the pre-P3b code).
histogram equals the reference row's, whole and in blocks (science goldens:
`tests/test_histogram_goldens.py` with the committed reference in `tests/data`, written by
`tests/data/make_histogram_goldens.py` with an earlier, independent implementation).
- **Step 4** summarises each channel of a group on its own (issue #104): one
`GroupSummary` per group and channel (`channel`, `xyc_plane_count`,
`channel_histogram_count`), a `channel` column in the table and one plot panel per
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Write the schema-version-2 fixture of ``test_schema_v2_equivalence.py``.
"""Write the reference histograms (science goldens) of ``test_histogram_goldens.py``.

Run once, from the repository root, with the code of version 2: this repository at
commit ``55f1074`` (before follow-up P3b) and morphobricks-normalization v0.1.0,
Expand All @@ -7,13 +7,13 @@
git worktree add ../v2 55f1074
git clone -b v0.1.0 https://github.com/CellMigrationLab/morphobricks-normalization ../n1
pip install ../n1 tifffile zarr pytest
PYTHONPATH=../v2/src python tests/data/make_v2_fixture.py
PYTHONPATH=../v2/src python tests/data/make_histogram_goldens.py

It writes, next to this script:

- ``v2_pixels.npz``: the pixels of every image of the experiments in
``tests/v2_fixture.py``;
- ``v2_<dtype>.csv``: the ``plane_histograms.csv`` that version's
- ``golden_pixels.npz``: the pixels of every image of the experiments in
``tests/histogram_goldens.py``;
- ``golden_<dtype>.csv``: the ``plane_histograms.csv`` that version's
``run_experiment`` wrote for them (schema version 2, one row per plane and
channel).

Expand All @@ -35,8 +35,8 @@

from morphobricks_normalization.csv_io import SCHEMA_VERSION # noqa: E402

from histogram_goldens import EXPERIMENTS, PIXELS, make_pixels, write_experiment # noqa: E402
from morphobricks_preprocessing import prefill_mapping, run_experiment # noqa: E402
from v2_fixture import EXPERIMENTS, PIXELS, make_pixels, write_experiment # noqa: E402


def main() -> None:
Expand All @@ -52,7 +52,7 @@ def main() -> None:
result = run_experiment(root, prefill_mapping(axes), bin_count=bins)
if not result.written:
sys.exit(f"{dtype}: {[issue.message for issue in result.issues]}")
shutil.copyfile(result.csv_path, HERE / f"v2_{dtype}.csv")
shutil.copyfile(result.csv_path, HERE / f"golden_{dtype}.csv")
print(f"{dtype}: {result.plane_count} rows")


Expand Down
13 changes: 7 additions & 6 deletions tests/v2_fixture.py → tests/histogram_goldens.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""The experiments of the schema-version-2 fixture in ``tests/data`` (follow-up P3b).
"""The experiments of the reference histograms (science goldens) in ``tests/data``.

``tests/data/make_v2_fixture.py`` wrote their ``plane_histograms.csv`` with the
code of version 2 (one row per plane and channel); ``test_schema_v2_equivalence.py``
writes the same images again and compares the current table with it.
``tests/data/make_histogram_goldens.py`` wrote their ``plane_histograms.csv`` with an earlier,
independent implementation (one row per plane and channel, before follow-up P3b);
``test_histogram_goldens.py`` writes the same images again and compares the current table with
those values.
"""

from __future__ import annotations
Expand All @@ -14,7 +15,7 @@
from tiff_tree import write_data

DATA = Path(__file__).parent / "data"
PIXELS = DATA / "v2_pixels.npz"
PIXELS = DATA / "golden_pixels.npz"

# Per pixel type: the bin count, the experiment axis roles and its images as
# (relative path, axes, writer options). TIFF images share one arrangement of axes;
Expand Down Expand Up @@ -74,7 +75,7 @@ def make_pixels(seed: int = 0) -> dict[str, np.ndarray]:
MorphoBricks v1 analyses 2-D planes (owner decision of 5 November 2026): a Z-stack is
refused, so the tests write each uint16 image with its planes along T instead. The pixels
and every histogram are the reference's; only the reference's ``z`` is now ``t``.
``make_v2_fixture.py`` writes them as the reference was made (``as_made=True``).
``make_histogram_goldens.py`` writes them as the reference was made (``as_made=True``).
"""


Expand Down
158 changes: 0 additions & 158 deletions tests/parity_datasets.py

This file was deleted.

Loading
Loading