Skip to content

Generalise identify & refine - #74

Closed
holsam wants to merge 52 commits into
mainfrom
generalise-identify-refine
Closed

holsam wants to merge 52 commits into
mainfrom
generalise-identify-refine

Conversation

@holsam

@holsam holsam commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Changelog

  • Updates identify and refine to:
    • Replace the discrete-orientation fit & azimuthal smearing previously used by identify with a scoring system that uses rigid registrations over the search space open from classify's prior (read from sidecar or defaulting to normal).
    • Write each particle's class pose to the RELION particle file as Euler angles and an origin, using RELION 5's rotation matrix convention.

holsam added 30 commits November 2, 2026 14:17
- Added picking/importers.py to read candidate particle positions from CSV, STAR or JSON files.
- Added tests/unit/test_importers.py to define unit tests for the pick file readers.
- Modified picking/importers.py to match tomogram ids from pick files to ids in manifest.
- Modified tests/unit/test_importers.py to add tests for exact matching, suffix handling and unknown ids.
- Modified picking/importers.py to infer pick orientations from the nearest point on segmentation surface.
- Modified tests/unit/test_importers.py to cover orientation inference against a planted membrane.
- Modified commands/pick.py to import picks from external tools instead of running a built-in picker.
- Modified cli/pick.py to update arguments to accept pick files.
- Modified tests/integration/test_pick_command.py to update tests for importing picks, mapping tomogram ids and resuming command.
- Modified schemas/config.py to replace picker names with pick files.
- Modified config/template.py to show pick files setting in the generated config template.
- Modified run/orchestrate.py to pass pick files and surface distance limit to the pick stage.
- Modified commands/pick.py to forward new pick stage options in the cluster command.
- Modified run/cluster_orchestrate.py to stop requesting a GPU for pick stage.
- Modified tests/conftest.py to generate pick file for test dataset.
- Modified tests/unit/test_run.py to use pick files setting in sample run config.
- Modified src/stamp/decoy/generate.py to remove rejected-surface decoy method and scoring/caching.
- Modified src/stamp/commands/decoy.py to remove rejected-surface method.
- Modified src/stamp/cli/decoy.py to remove rejected-surface method from method options and remove options exclusive to rejected-surface.
- Modified src/stamp/schemas/config.py to remove rejected-surface method.
- Modified src/stamp/config/template.py to update the decoy method choices.
- Modified tests/conftest.py to remove test fixture that only rejected-surface method needed.
- Modified tests/unit/test_decoy.py to remove rejected-surface tests and build particle set directly.
- Modified tests/integration/test_decoy_command.py to remove rejected-surface tests.
- Modified decoy/generate.py to replace configuration source from picker settings to a decoy geometry class.
- Modified commands/decoy.py to build decoys from new geometry class.
- Modified cli/decoy.py to remove `--picker-parameters` option.
- Modified run/orchestrate.py to remove picker parameters being passed to decoy.
- Modified tests/conftest.py to reduce box size used during classify so run tests can pass.
- Modified tests/unit/test_decoy.py to use new geometry class and add test that it rejects bad values.
- Deleted tools/diagram/native.py to remove command for native picker.
- Deleted tools/diagram/utils/native.py to remove helpers used only by native picker diagram.
- Modified tools/diagram/diagram.py to remove command for native picker.
- Modified tools/diagram/utils/config.py to remove native picker settings from the diagram config.
- Modified tools/diagram/pick.py to reword labels that named rejected-surface decoy method.
- Modified tools/diagram/utils/walkthrough.py to reword comment mentioning rejected-surface decoy method.
- Modified tools/diagram/utils/pick.py to reword comment mentioning native picker.
- Modified tools/diagram/utils/geometry.py to update docstring to remove native picker mention.
- Deleted picking/native.py to remove built-in picker.
- Deleted adapters/native.py to remove adapter to run removed built-in picker.
- Modified adapters/mock.py to remove mock entry for built-in picker.
- Modified tests/unit/test_adapters.py to update adapter tests.
- Modified tests/unit/test_picking.py to remove tests for built-in picker.
- Modified src/stamp/picking/geometry.py to remove unused scoring and sampling helpers.
- Modified tests/unit/test_picking.py to remove tests for deleted helpers.
- Modified docs/cli.md to update pick command arguments/options, and add information about supported pick file formats and orientation inference.
- Modified docs/configuration.md to update pick command configuration settings and decoy methods.
- Modified README.md to update quick start and stage summary sections to mention importing picks.
- Modified docs/workflow.md to update picking description and replace native picker section with orientation inference.
- Modified docs/architecture.md to remove native picker section and add pick importer to module/data descriptions.
- Modified tests/TESTS.md to update test descriptions for picking and add import tests.
Merge pull request #71 from holsam/remove-stamp-native-picker
- Modified schemas/config.py to add orientation priors, tilt range and tilt axis to run settings.
- Modified schemas/particles.py to add orientation prior and a prior on particle sets that defaults to normal.
- Modified tests/unit/test_schemas.py to define tests for the prior on particle sets and for new run settings.
- Added classify/frames.py to define frame and rotation conventions used in classification.
- Added tests/unit/test_frames.py to define unit tests for frame and rotation conventions.
- Added classify/wedge.py to build each particle's box-frame missing wedge from its orientation, tilt range and tilt axis.
- Added tests/unit/test_wedge.py to add tests for comparing missing wedge, global mask and a brute-force construction.
- Added classify/search.py to define alignment search space for each orientation prior and build rotated reference banks.
- Added tests/synthetic.py to generate asymmetric and rod-shaped test objects and particles of known pose, shift, wedge and noise.
- Added tests/unit/test_search.py to test search space for each prior.
- Added classify/match.py to align particles to a reference over a search space using a shared rotated bank, per-particle missing wedge norms and FFT shift search.
- Added test/unit/test_match.py to add tests for equivalence with per-particle masked bank and pose recovery for priors.
- Deleted tests/unit/test_frames.py and tests/unit/test_wedge.py and moved tests to tests/unit/test_classify.py.
- Added src/stamp/classify/prepare.py to normalise, soft-mask and Fourier-bin subvolumes to an odd working box.
- Modified tests/unit/test_classify.py to add tests for subvolume preparation.
- Modified classify/average.py to add coverage-corrected weighted averaging of aligned particles, built from batches.
- Modified tests/unit/test_classify.py to add test for weighted average beating plain mean for each prior.
- Added utils/phase.py to add a Hermitian phase randomisation that can keep a flagged set of voxels.
- Modified refine/fsc.py to use shared phase randomisation.
- Modified tests/unit/test_utils.py to test amplitude preservation and keep mask.
- Added classify/references.py to score particles against references, assign them and rebuild references from members.
- Added classify/store.py to serve prepared particles with their orientations and rebuilt wedges in batches.
- Modified schemas/subvolumes.py so volumes of different box sizes can be written.
- Modified tests/synthetic.py to add a synthetic particle store with known classes, poses and shifts.
- Modified tests/unit/test_classify.py to add tests for particle store and reference scoring, and to reorder test classes.
- Added classify/merge.py to add pairwise reference similarity, merge groups and half-split ceilings.
- Added classify/null.py to add phase-randomised null threshold and agreement bar.
- Modified tests/unit/test_classify.py to add tests for half-split ceilings, merging and phase-randomised null.
- Added classify/polish.py to add polish step with seed references, polish rounds, merging, null rejection and checkpoints.
- Modified tests/unit/test_classify.py to add tests for polish step, and to reorder private functions.
- Modified classify/align.py to remove per-cluster in-plane alignment and keep roll about membrane normal.
- Modified classify/average.py to remove plain per-cluster average.
- Modified classify/cluster.py to remove shared-basis clustering and centroid matching of native strict mode.
- Modified classify/polish.py to add class averages built at polish's poses.
- Modified cli/classify.py to add options for tilt and bin factor, remove in-plane alignment options and define no-strict-halfset-independence flag.
- Modified commands/classify.py to classify with polish step and pooled halves and write per-half class averages at full resolution.
- Modified config/template.py to remove in-plane alignment settings.
- Modified run/orchestrate.py to stop passing in-plane alignment settings to classify.
- Modified schemas/config.py to remove in-plane alignment settings from classify stage.
- Modified tests/conftest.py to pool halves in shared test config.
- Modified tests/integration/test_classify_command.py to test classify end to end, resuming and vesicle ids, and remove native tests.
- Modified tests/unit/test_classify.py to remove tests for deleted functions.
- Modified classify/cluster.py to add leiden clustering on a kNN graph of whitened PCA embedding.
- Modified cli/classify.py to offer leiden as a clustering method and make it the default used.
- Modified config/template.py to show leiden as the default clustering method.
- Modified schemas/config.py to offer leiden as a clustering method in the classify stage and make it the default.
- Modified tests/unit/test_classify.py to add tests for leiden clustering.
- Modified classify/features.py to add axial-invariant features that keep only magnitude spectrum along z.
- Modified tests/unit/test_classify.py to add tests for rod grouping regardless of azimuth and axial position.
- Added classify/shfeatures.py to add rotation-invariant spherical-harmonic features fitted to each particle's measured directions.
- Added classify/spherical.py to add spherical harmonics, a sphere quadrature grid and a masked ridge fit.
- Modified tests/unit/test_classify.py to add tests for spherical-harmonic basis, masked fit, invariance and class separation under a wedge.
- Modified classify/extract.py to extract particles axis-aligned, and keep those without an orientation, for the none prior.
- Modified commands/classify.py to choose features from the particle set's prior, recorded in the fingerprint and sidecar.
- Modified tests/unit/test_classify.py to add tests for none prior extraction.
- Modified tests/unit/test_classify.py to test seed purity from per-prior features and default Leiden clustering.
- Modified commands/classify.py to write polish's pose for each assignment.
- Modified schemas/particles.py to add full pose, correlation, margin and polarity to class assignments.
- Modified tests/integration/test_classify_command.py to add test for assignments carrying poses.
- Modified tests/unit/test_schemas.py to add tests for new assignment fields and that older rows still load.
- Modified classify/polish.py to return a half-set ceiling for each final reference.
- Added classify/halves.py to run polish on each half-set independently and match half-B clusters to half-A by reference.
- Modified tests/unit/test_classify.py to add tests for half-set independence, matching and shared frame.
- Modified cli/classify.py to add rotation count, shift range, rounds, null, rejection and merge options.
- Modified commands/classify.py to run polish step per half-set in strict mode, saving polish settings to fingerprint and sidecar.
- Modified tests/conftest.py to use strict half-set mode in shared test config again.
- Modified tests/integration/test_classify_command.py to add tests for strict half-set mode.
- Modified commands/classify.py to pass tilt and polish settings in cluster command.
- Modified config/template.py to show new run and classify settings in config template.
- Modified run/orchestrate.py to pass tilt and polish settings to classify.
- Modified schemas/config.py to add polish settings to classify stage.
- Modified tests/integration/test_classify.py to add test for classify command building.
- Modified tests/integration/test_classify_command.py to add test for axis and none priors.
Merge pull request #72 from holsam/update-classification
- Modified picking/importers.py to skip orientation inference for tomograms without a segmentation.
- Modified schemas/manifest.py to make providing segmentations optional.
- Modified utils/io.py to build manifests from raw tomograms alone when no segmentation directory is given.
- Modified tests/unit/test_utils.py to test manifests without segmentations.
- Modified picking/importers.py to check picks against orientation prior, requiring orientations for axis and dropping them for none.
- Modified tests/unit/test_importers.py to add tests for checking priors.
- Modified cli/pick.py to add --orientation-prior and make --seg-dir optional.
- Modified commands/classify.py to leave the segmentation option out of the classify command when there is none.
- Modified commands/pick.py to pick with an orientation prior, writing it to particle set and sidecar and skipping membrane where relevant.
- Modified config/template.py to describe optional segmentation directory.
- Modified picking/consensus.py to carry prior into consensus particle set.
- Modified run/orchestrate.py to pass prior to pick.
- Modified schemas/config.py to make segmentation directory optional.
- Modified tests/integration/test_pick_command.py to add tests for each prior.
- Modified tests/unit/test_run.py to test prior rules from run config.
- Modified cli/decoy.py to add random-volume method and border option.
- Modified commands/decoy.py to run random-volume method and refuse membrane-based methods for other priors.
- Modified config/template.py to show random-volume method and border setting.
- Modified decoy/generate.py to add random-volume method and give decoy sets the real set's prior.
- Modified decoy/validate.py to reject a decoy set whose prior differs from real set's.
- Modified run/orchestrate.py to pass border setting to decoy.
- Modified schemas/config.py to add random-volume method and require it for other priors.
- Modified tests/unit/test_decoy.py to add tests for placement, determinism, membrane-prior refusal and comparability.
- Modified tests/unit/test_run.py to test decoy rule of run config.
- Modified classify/polish.py to return an all-rejected result when no reference beats the null.
- Modified classify/halves.py to match no clusters when a half has none.
- Modified commands/classify.py to always create class averages directory.
- Modified commands/identify.py to accept a decoy with no classes and skip its histogram.
- Modified identify/decoy_check.py to pass decoy control when the decoy produced no classes.
- Modified run/orchestrate.py to stop after classify when configured.
- Modified tests/conftest.py to use a minimum cluster size that fits small test dataset.
- Modified tests/integration/test_run_command.py to add a test for running stamp run with none and axis priors.
- Modified tests/unit/test_classify.py to add test for pure-noise result.
- Modified tests/unit/test_identify.py to add test for decoy control with no decoy classes.
- Modified tests/integration/test_classify_command.py to fix missing imports.
Merge pull request #73 from holsam/generic-picking
- Added identify/register.py to register a simulated map to an aligned class average over search space of a given prior.
- Modified tests/unit/test_identify.py to add tests for registration recovery after rotation, inverted contrast and limits of normal search.
- Modified commands/identify.py to score class averages by registration and read orientation prior from classify sidecar.
- Modified identify/simulate.py to make azimuthal smearing optional.
- Modified tests/unit/test_identify.py to add tests for aligned scoring and optional smearing.
- Modified adapters/relion.py to write class poses as Euler angles and origins in exported RELION particle file.
- Modified commands/refine.py to pass full poses from class assignments to RELION adapter.
- Modified tests/unit/test_adapters.py to add tests for Euler angles, pose composition and STAR contents.
- Modified tests/unit/test_refine.py to add test for pose lookup.
- Modified commands/identify.py to remove azimuthal smear option.
- Modified identify/fit.py to remove discrete-orientation fit.
- Modified identify/simulate.py to remove azimuthal smear and its option.
- Modified tests/unit/test_identify.py to remove tests for removed functions.
- Modified adapters/relion.py to use RELION 5's matrix convention for euler angles.
- Modified tests/unit/test_adapters.py to update tests for RELION 5 matrices.
@holsam holsam self-assigned this Nov 14, 2026
@holsam holsam added the enhancement New feature or request label Nov 14, 2026
@holsam

holsam commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Raised against incorrect branch.

@holsam holsam closed this Nov 14, 2026
@holsam
holsam deleted the generalise-identify-refine branch November 14, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant