Repository navigation
DictionaryMatcher: coarse-to-fine lattice search (coarse=, refine=) - #50
Merged
Merged
Conversation
DictionaryMatcher(coarse=k) places the atoms on the lattice of their parameter values (a product of one list per parameter, combinations possibly left out), scores every k-th value along each axis, then the 2k + 1 values around the winner along each. refine=False stops after the coarse pass, which an iterative reconstruction can use until its last iteration. From mri2qmap-bartorch, which carries the same search as a private _Grid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MFB6QM5LeyLiZBruB754ux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Matteo · project thread
What changed
DictionaryMatcher(coarse=k)places the atoms on the lattice their parameters were simulated on. That is a product of one value list per parameter, and some combinations may be missing, such as T2 > T1. The search runs in two passes. First it scores every k-th value along each axis. Then it scores the2k+1values around the coarse winner along each axis.refine=Falsereturns the coarse pass alone, andrefinecan be set between calls. The newmatcher.latticeexposes the placement.coarseneedsparametersand does not combine withgroups.Why
mri2qmap-bartorch carries this search as a private
_GridbesideDictionaryMatcher. Inside the ADMM iterations it matches on the coarse lattice, and at the last iteration it does the full refine. Moving it into the matcher lets mri2qmap use the matcher's chunking, device replicas and least-squares scales instead of its own. On a 3 % log (T1, T2) grid of about 37 000 atoms,coarse=3scores about 4 200 + 49 atoms per voxel.Validation
tests/estimators/test_dictionary.py:top_k1 and 3.refine=Falsereturns coarse-lattice atoms only.refine=Trueafterwards restores exact self-matches..to().pytest tests/estimators tests/test_docstring_defaults.py: 263 passed, 28 skipped (CUDA). This ran againstsrc/with the 0.0.14 wheel's compiled kernels; the kernels are untouched.ruff format/ruff check: clean.Documentation impact
The
DictionaryMatcherdocstring documentscoarse,refine,latticeand the smoothness assumption. The CHANGELOG has an Unreleased/Added entry.Checklist
Generated by Claude Code