Replace zoom FFT peak search with a budget-bounded PyFFTW direct transform
Drop the coarse+fine zoom refinement, the SciPy FFT backend, and the exact= audit path in favor of a single always-on full-transform peak search (_peak_bins). Block size is now derived from a per-thread memory budget (_fft_block_for/SRAS_FFT_PLAN_BUDGET_MB) instead of a fixed constant, so the existing block-parallel PyFFTW pool stays memory-safe at high pad factors without the zoom algorithm's bookkeeping. Also removes the now-unused threadpoolctl dependency and the FFT backend selector from the UI. Also includes a pre-existing min_freq_mhz peak-search floor (excludes bins below a caller-supplied frequency from the argmax) that was already implemented and tested in the working tree. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,46 @@ def test_threshold_change_recomputes(ctx):
|
||||
f"masking zeroed some pixels ({n_zero} of {win._current_image.size})"
|
||||
|
||||
|
||||
def test_highlight_masked_pixels(ctx):
|
||||
"""Masked (below-threshold) pixels are drawn as NaN - filled with a
|
||||
highlight color, separate from the normal colormap - so they can't be
|
||||
mistaken for a real, possibly-low-frequency pixel; unchecking restores
|
||||
the old behavior where both blend into the same plain 0."""
|
||||
win = ctx.win
|
||||
assert win.chk_highlight_masked.isChecked(), "on by default"
|
||||
dc4 = win._dc_cache[(0, CH4_IDX)]
|
||||
expect_masked = dc4 < win.spin_threshold_mv.value()
|
||||
assert expect_masked.any() and not expect_masked.all(), \
|
||||
"fixture threshold should mask some but not all pixels"
|
||||
|
||||
calls = []
|
||||
orig = win.image_canvas.show_image
|
||||
|
||||
def spy(img, *a, **kw):
|
||||
calls.append((np.array(img, copy=True), kw.get("bad_color")))
|
||||
return orig(img, *a, **kw)
|
||||
|
||||
with patch.object(win.image_canvas, "show_image", side_effect=spy):
|
||||
win._redraw_image(win._current_image)
|
||||
shown, bad_color = calls[-1]
|
||||
assert bad_color is not None, "highlight color set while checkbox is on"
|
||||
assert np.array_equal(np.isnan(shown), expect_masked), \
|
||||
"NaN exactly where DC4 is below threshold, nowhere else"
|
||||
|
||||
win.chk_highlight_masked.setChecked(False)
|
||||
calls.clear()
|
||||
with patch.object(win.image_canvas, "show_image", side_effect=spy):
|
||||
win._redraw_image(win._current_image)
|
||||
shown2, bad_color2 = calls[-1]
|
||||
assert bad_color2 is None, "no highlight color once unchecked"
|
||||
assert not np.isnan(shown2).any(), "unchecked: no pixel pulled out to NaN"
|
||||
assert np.array_equal(shown2, win._current_image), \
|
||||
"unchecked: displayed array is the raw, unmodified image"
|
||||
|
||||
win.chk_highlight_masked.setChecked(True)
|
||||
pump(60)
|
||||
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user