DictionaryMatcher#
- class blochsim.estimators.DictionaryMatcher[source]#
Bases:
EstimatorMatch signals to dictionary atoms by normalized complex inner product.
- Parameters:
acquisition (Simulator, default=None) – The sequence being inverted, with every property that is neither unknown nor measured separately already fixed. Omit to give
dictionaryor signals tofit().dictionary (torch.Tensor, default=None) – Atoms
(n_atoms, n_contrasts), real or complex.parameters (torch.Tensor, default=None) – Parameter values
(n_atoms, n_parameters)of the atoms. Without them a call returns atom indices.query_chunk_size (int, default=4096) – Measured signals compared at once.
dictionary_chunk_size (int, default=16384) – Atoms compared at once.
top_k (int, default=1) – Candidates kept by
match(); the first is the estimate.groups (int, default=None) – Cluster the dictionary into this many groups and score group representatives first, discarding groups before scoring their atoms [1]. See
grouping.prune (float, default=5e-3) – Fraction below its best group score within which a voxel still considers a group. Larger keeps more groups. The default was tuned on 280 groups of 700 atoms; raise it for smaller dictionaries.
coarse (int, default=None) – For a dictionary simulated on a lattice of parameter values (a product of one list per parameter, some combinations possibly left out), score every
coarse-th value along each parameter first, then the2 coarse + 1values around the winner along each. Needsparameters; not withgroups. Seelattice.refine (bool, default=True) – With
coarse, search around the coarse winner;Falsereturns the coarse lattice’s best atoms alone, which an iterative reconstruction can match against until its last iteration. An attribute that may be set between calls.
Notes
The coarse-to-fine search assumes the signal changes smoothly along the lattice, so the best atom lies within
coarsesteps of the coarse winner; on a 3 % logarithmic (T1, T2) grid of 37 000 atoms a stride of 3 scores about 4 200 + 49 atoms per voxel.A
rankgiven tofit()compresses the dictionary to(atoms, rank)before grouping. The estimator also returns anM0map, computed from the match score and atom norms without touching atoms. Volumes are streamed asmap(execution=...)says.References
Methods
fitFit the estimator over a sampling of the tissue it will meet.
from_coefficientsMap coefficients already in this estimator's basis.
mapEstimate the tissue parameters of a measured volume.
Find the best-matching atoms of each measured signal.
training_setSimulate a training set from the properties given to
fit().uncertainty_ofUncertainty of each map, as a standard deviation in the map's units.
- property fitted#
Whether the matcher holds a dictionary.
- property grouping#
Clustering of the dictionary, or
Nonewithoutgroups.Its
conditionis the condition number of the representatives andcompressionthe factor by which in-group inner products shorten.
- property lattice#
Where each atom sits on its parameters’ lattice, or
Nonewithoutcoarse.
- match()[source]#
Find the best-matching atoms of each measured signal.
- Parameters:
signals (torch.Tensor) – Measurements
(..., contrasts).- Returns:
Fields shaped
(..., top_k).- Return type:
MatchResult
- Raises:
RuntimeError – If there is no dictionary.
ValueError – If the contrast count differs from the dictionary’s.