Refactor cache validation and optimize alignment wizard incremental updates
- Extract cache mismatch logic into reusable cache_mismatch_reasons() function for cleaner validation and consistent miss reporting - Expose memory_budget_bytes() for external callers (aligned exporter) - Optimize rebuild_stack() with incremental layer updates when only one angle parameters change, avoiding full reprojection overhead - Remove unused seed_per_angle parameter from alignment wizard - Simplify cached_rf_image() DC masking with cleaner early exit logic - Clean up internal state tracking with explicit origin caching Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+7
-13
@@ -361,21 +361,17 @@ class CrossCorrelateWorker(_PooledWorker):
|
||||
angle_done = pyqtSignal(int, float, float, float, float, str)
|
||||
|
||||
def __init__(self, sras: SrasFile, ref_angle_idx: int, angle_indices: list[int],
|
||||
dc4_mv: dict[int, np.ndarray], *,
|
||||
sources: tuple[str, ...], dc_threshold_mv: float,
|
||||
search_deg: float, reg_kwargs: dict | None = None):
|
||||
"""*reg_kwargs* is splatted into register_angle_to_reference on top of
|
||||
the named arguments — the wizard's rotation-search controls (seed,
|
||||
signs, refine, grid sizes) go through here, so exposing another knob
|
||||
needs no change to this class."""
|
||||
dc4_mv: dict[int, np.ndarray], *, reg_kwargs: dict | None = None):
|
||||
"""*reg_kwargs* is splatted into register_angle_to_reference — every
|
||||
registration setting the wizard exposes (sources, threshold, search
|
||||
width, seed, signs, refine, grid sizes) travels in it, so this class
|
||||
holds no opinion about which knobs exist and exposing another needs no
|
||||
change here."""
|
||||
super().__init__()
|
||||
self._sras = sras
|
||||
self._ref = ref_angle_idx
|
||||
self._angles = angle_indices
|
||||
self._dc4_mv = dc4_mv
|
||||
self._sources = sources
|
||||
self._threshold = dc_threshold_mv
|
||||
self._search_deg = search_deg
|
||||
self._reg_kwargs = dict(reg_kwargs or {})
|
||||
|
||||
def _plan(self) -> int:
|
||||
@@ -386,9 +382,7 @@ class CrossCorrelateWorker(_PooledWorker):
|
||||
|
||||
def _one(self, a: int) -> tuple[int, compute.RigidFit]:
|
||||
return a, compute.register_angle_to_reference(
|
||||
self._sras, a, self._ref, self._dc4_mv,
|
||||
dc_threshold_mv=self._threshold, sources=self._sources,
|
||||
search_deg=self._search_deg, **self._reg_kwargs)
|
||||
self._sras, a, self._ref, self._dc4_mv, **self._reg_kwargs)
|
||||
|
||||
def _emit(self, result):
|
||||
a, fit = result
|
||||
|
||||
Reference in New Issue
Block a user