Skip to content

Choose and apply the best reindexing by correlation - #353

Draft
tjlane wants to merge 1 commit into
codex/phase-alignment-02-reindex-corefrom
codex/phase-alignment-03-reindex-api
Draft

Choose and apply the best reindexing by correlation#353
tjlane wants to merge 1 commit into
codex/phase-alignment-02-reindex-corefrom
codex/phase-alignment-03-reindex-api

Conversation

@tjlane

@tjlane tjlane commented Aug 22, 2026

Copy link
Copy Markdown
Member

! This PR was vibe-coded.

Stack

Part 3 of 11 for #31. Depends on #352. Merge bottom-up.

Next branch: codex/phase-alignment-04-reindex-hardening.

What this implements

Adds ReindexingCandidate, ReindexingResult, and reindex_by_correlation(). The public function gates on the ambiguity predicate, evaluates identity plus Gemmi twin-law representatives, applies the highest-scoring operation to a copy, and reports ranked candidates, runner-up correlation, and the score gap.

Amplitudes are squared, normalized by resolution, and scored with signed Pearson correlation. Proper reindexing laws only are considered; hand remains separate.

Tests

End-to-end tests cover nonmutation, correct and identity selections, operation direction, common-HKL matching, amplitude and intensity inputs, and rejection when the unit-cell metric has no alternative indexing.

Reviewer focus

  • The convention that the returned operation is applied to the moving dataset to match the reference.
  • Candidate enumeration as identity plus Gemmi indexing-coset representatives.
  • The returned diagnostics and normalized-correlation statistic.

Related: #31 and #174.

@tjlane tjlane changed the title Add correlation-based reindexing API Choose and apply the best reindexing by correlation Aug 24, 2026
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.

1 participant