Stop discarding precomputed FFT data on view switches
The display path hardcoded row_avg_n=0 when checking a file's stored FFT cache, since the main window has no row-averaging control (only the batch-only RowAverageFftOptionsDialog). Once a file was batch-computed with row-averaging, every view switch saw a phantom provenance mismatch and silently launched a full raw recompute, discarding the precomputed data. The display now asks for the stored image at the settings it was actually computed under (bg-sub/pad/row-averaging), rather than the window's live controls, so a stored or already-computed image is always shown once present. Those controls now only affect a first-time compute for an uncached angle or an explicit batch recompute -- never what's already on screen. DC threshold is unaffected: it stays live, since re-masking a cached image is free. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+14
-5
@@ -222,16 +222,25 @@ def test_threshold_change_recomputes(ctx):
|
||||
|
||||
|
||||
def test_bg_sub_toggle(ctx):
|
||||
"""bg-sub no longer gates the display: it only affects a future live
|
||||
compute for an angle with nothing cached yet, or an explicit batch
|
||||
recompute. Toggling it on an angle that already has an FFT image must
|
||||
leave that image on screen, untouched."""
|
||||
win = ctx.win
|
||||
n_before = len(win._fft_cache)
|
||||
img_before = win._current_image
|
||||
win.chk_bg_sub.setChecked(False)
|
||||
assert wait_until(
|
||||
lambda: not win._job_running("compute") and len(win._fft_cache) > n_before), \
|
||||
"recomputed without bg-sub"
|
||||
win.chk_bg_sub.setChecked(True)
|
||||
pump(200)
|
||||
assert not win._job_running("compute"), \
|
||||
"returning to bg-sub was a cache hit (no recompute)"
|
||||
"toggling bg-sub alone must not dispatch a recompute"
|
||||
assert len(win._fft_cache) == n_before, "no new cache entry from the toggle"
|
||||
assert np.array_equal(win._current_image, img_before), \
|
||||
"displayed image unchanged by the bg-sub toggle"
|
||||
win.chk_bg_sub.setChecked(True)
|
||||
pump(200)
|
||||
assert not win._job_running("compute")
|
||||
assert len(win._fft_cache) == n_before
|
||||
assert np.array_equal(win._current_image, img_before)
|
||||
|
||||
|
||||
def test_roi_and_csv_export(ctx):
|
||||
|
||||
Reference in New Issue
Block a user