Skip to content

Reject empty bands and report the band's resolution - #70

Merged
joeljose merged 1 commit into
mainfrom
fix/67-empty-band
Sep 28, 2026
Merged

joeljose merged 1 commit into
mainfrom
fix/67-empty-band

Conversation

@joeljose

Copy link
Copy Markdown
Owner

Closes #67

  • Up-front checks in main(), before the Parameters output and any processing:
    • Nyquist error (moved here from the middle of the Parameters block).
    • Error if the band keeps 0 frequency bins.
    • Warning if the band is narrower than the clip's resolution, fps / frames.
  • Band line now shows the bins kept and the resolution, e.g. Band: 0.9–0.95 Hz (ideal band-pass; 2 bins, resolution 0.0997 Hz).
  • Library callers: bandpass_1d and the GPU band filter raise ValueError on an empty band. New band_bins() helper.
  • Why not copy the Eulerian repo's "< 3 bins" rule: our FFT runs on the clip padded to ~3x its length, so padded bins are ~3x finer than the real resolution. The warning is based on fps / frames instead.
  • README and CHANGELOG updated.

Checked on face.mp4 (301 frames): --freq-low 0.9 --freq-high 0.9001 now exits 1 with Error: the band 0.9–0.9001 Hz contains no frequency bins for 301 frames at 30 fps (resolution 0.0997 Hz) ... (previously: unmagnified output, exit 0). 0.9–0.95 Hz runs with the resolution warning.

Tests: empty band raises (CPU and GPU filter), CLI rejects before processing, Nyquist before Parameters, narrow-band warning. CPU image 108 passed, 3 skipped; GPU image on an RTX 4050 132 passed, 1 skipped.

A band that contains no FFT bins (e.g. 0.9-0.9001 Hz on a 301-frame
clip) made bandpass_1d return zeros, so the output silently equalled the
input after the whole forward DTCWT had run. main() now rejects such a
band before processing, warns when the band is narrower than the clip's
frequency resolution (fps / frames), and prints the bins kept and the
resolution. bandpass_1d and the GPU band filter raise ValueError for
library callers. The Nyquist check moved before the Parameters output.

Closes #67
@joeljose
joeljose merged commit 0de2e96 into main Sep 28, 2026
2 checks passed
@joeljose
joeljose deleted the fix/67-empty-band branch September 28, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Band mode: a band with no frequency bins silently leaves the video unmagnified

1 participant