Skip to content

uipsf M2 pairs: z_direction.py, the stage's direction from the metadata against the images - #169

Open
jries wants to merge 8 commits into
mainfrom
claude/vigilant-johnson-ns061k
Open

jries wants to merge 8 commits into
mainfrom
claude/vigilant-johnson-ns061k

Conversation

@jries

@jries jries commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Why

Every M2 in situ run's twin test prefers the mirrored pupil, by 800–1500 nats. A stage z running opposite to the code's convention would give exactly that:

  • The convention: every path takes a larger ZPositionUm as the objective raised.
    • Bead stacks order their planes by it (calibrate.input.read_bead_stacks).
    • Sweeps take z = −(stage z − focus) (molecule_stack).
    • In situ's focus is the objective's rise above the coverslip.
  • Why only the cell can tell: beads and molecules on the glass see no depth, so they would learn the twin without noticing. The cell's molecules sit behind the index mismatch.

What it checks

benchmarks/uipsf/real/m2_pairs/z_direction.py, model-free:

  1. The metadata: the bead stacks' and sweeps' z tags (which key ZPositionUm comes from, and any PI or focus device beside it), their first and last values and direction.
  2. The stacks' spots: their elongation, log₂(σx/σy) from SMAPpy's elliptical Gaussian, at the smallest and largest stage z.
  3. The movie's glass molecules: their elongation, read as the excess of the first ~2200 frames over later ones. These molecules are below the focus.

If the convention holds, the glass molecules are elongated the opposite way to the stack spots at the smallest stage z. The same way means the stage z runs opposite to the convention for these files, and every M2 bead and sweep model is the twin.

A paragraph in the M2 section of docs/uipsf/architecture.md points to it.

Checked

  • On simulated files: an OME-TIFF sweep with PositionZ per plane gives the right direction and elongation, and a simulated movie's early glass excess is read on the right side.
  • ruff check benchmarks/uipsf/real/m2_pairs is clean.
  • It has not been run on M2's data, which are not in git.

Tests

--slow was not run: the PR adds only a benchmark script and documentation.


Generated by Claude Code

…eplaces it

The plugin (Localize/Bead calibration), its window (calibrate/qt_gui.py), its
assistant actions and its pages are removed.  The bead average is the PSF
calibration window's, which already had every page, the bead table and the
assistant's actions; its method's explanation moves to a widgetless help page,
Panels/Bead average.  smappy-calibrate opens the PSF calibration window
(headless --out unchanged).  The tests of the use_calibration hand-over and of
the bead settings' forms are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JegwAEzHHExiXkwvXgA2j
…est tested on the minimal pupil

From round 2, once the coverslip edge has set the focus, a unit localised more than
3 errors below the coverslip (its CRLB times the edge's scatter factor, with the
edge's own error) is not chosen (`insitu_rounds.below_coverslip`,
`RoundSettings.below_coverslip_sd`): the z bins below 0 had filled with molecules
the model placed badly.  The twin test already mirrored held modes; a test now pins
it for the minimal pupil, in situ's default.  The roadmap's in situ line and the
architecture's known flaws brought up to date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JegwAEzHHExiXkwvXgA2j
…U-only PyTorch beside an NVIDIA card

The line Detect writes now ends with where learning runs (uipsf.device.describe: the
graphics card by name, Apple's GPU or the CPU).  A torch built for the CPU only on a
machine with an NVIDIA card (torch_install.cpu_build_on_nvidia, from its version's local
label: a plain pip install on Windows brings it) learnt on the CPU without a word; the
window now says so and offers Install PyTorch, whose command then reinstalls the card's
build from the CUDA index (command(replace=True)), and asks for a restart where the old
build is already loaded.  Neither blocks a run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JegwAEzHHExiXkwvXgA2j
…er height, from the molecules' heights

heights.py localises every molecule of the nucleus movie once per model and saves height, CRLB,
½ Σ deviance, chip position and frame; tilt_from_edge.py fits the coverslip's edge per tile and a
plane through it (a real 1.6° tilt is ~28 nm per µm), edge_vs_time.py the edge per block of frames,
score_by_height.py two models' scores per height bin on the unseen molecules.  Smoke-tested here on
synthetic files (a planted 1.6° tilt read as 1.63°, a planted drift and a height-dependent score
recovered) and heights.py on a small simulated movie; not yet run on M2's data, which are not in git.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JegwAEzHHExiXkwvXgA2j
…ta against the images

Every M2 in situ run's twin test prefers the mirrored pupil, which a ZPositionUm running opposite
to the code's convention would give (beads and sweeps on the glass cannot tell the twin).  The script
prints the files' z tags and direction, the sweeps' and bead stacks' spot elongation at the smallest
and largest stage z, and the elongation of the movie's glass molecules, below the focus in its first
frames: opposite to the smallest stage z's if the convention holds.  Smoke-tested on simulated files;
not run on M2's data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JegwAEzHHExiXkwvXgA2j
# Conflicts:
#	benchmarks/uipsf/real/m2_pairs/tilt_from_edge.py
#	docs/uipsf/architecture.md

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants