Skip to content

Fix SFDR at masked spectrum boundaries - #101

Merged
Arcadia-1 merged 1 commit into
mainfrom
fix/issue-100-sfdr
Oct 30, 2026
Merged

Arcadia-1 merged 1 commit into
mainfrom
fix/issue-100-sfdr

Conversation

@Arcadia-1

Copy link
Copy Markdown
Owner

Summary

compute_spectrum / plotspec
  find the strongest visible spur peak
  if the full spur lobe is visible
    integrate it directly
  if signal/DC/band-edge masking hides part of the lobe
    restore the missing power from the measured fundamental lobe/peak ratio

plotspec sideBin='auto'
  detected width = max(noise-floor crossing, window coherent-main-lobe width)

This keeps the integrated-lobe SFDR convention established by #64/#65/#67, removes the 0.79–1.76 dB optimistic boundary bias, and prevents a noise-free Hann record from collapsing to sideBin=0.

Fixes #100.

Evidence

  • Before: issue SFDR: spur power truncated by masked bins (optimistic up to ~1.8 dB) and definition differs from MATLAB plotspec #100's six-case Python repro reported 80.79 dBc at one masked neighbor and 81.76 dBc when both neighbors were unavailable.
    After: all six cases report 80.00 dBc, including public defaults with automatic side_bin.
  • Added Python regressions for signal-mask, DC, Nyquist, double-edge, full-lobe control, and assumed_sig_pwr_dbfs behavior.
  • Added matching MATLAB regression coverage for boundary compensation and noise-free Hann auto-sideBin behavior.
  • Python validation: 901 passed, 11 deselected, 1 xfailed; integration validation: 34 passed.
  • MATLAB/Octave is not installed on the development host, so the MATLAB regression is committed but was not executed locally.

Merge Danger

Door: Two-way

The change is isolated and can be reverted without data migration or API rollback.

Blast Radius: Spectrum metrics

Only SFDR cases whose spur lobe touches the signal/DC/analysis boundary change; MATLAB automatic side-bin selection also changes for noise-free windowed tones.

Compensate integrated spur lobes when signal/DC masks or the analysis boundary hide side bins, and keep MATLAB auto sideBin from collapsing below the selected window's coherent main-lobe width.\n\nFixes #100
@Arcadia-1
Arcadia-1 merged commit cd72061 into main Oct 30, 2026
4 checks passed
@Arcadia-1
Arcadia-1 deleted the fix/issue-100-sfdr branch October 30, 2026 11:44
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.

SFDR: spur power truncated by masked bins (optimistic up to ~1.8 dB) and definition differs from MATLAB plotspec

1 participant