Skip to content

Use SciPy cumulative trapezoid for equal-energy waves - #667

Merged
cmccomb merged 1 commit into
masterfrom
codex/irregular-wave-cumulative-632
Oct 24, 2026
Merged

cmccomb merged 1 commit into
masterfrom
codex/irregular-wave-cumulative-632

Conversation

@cmccomb

@cmccomb cmccomb commented Oct 24, 2026

Copy link
Copy Markdown
Member

Change

Use SciPy cumulative_trapezoid(spectrum_hz, frequency, initial=0) for PM and JONSWAP equal-energy bin integration. The MATLAB-compatible nearest-sample and boundary-selection code is unchanged. This removes the duplicate quadrature implementation while leaving published-case statuses and gates unchanged.

Verification

  • Before/after arrays were exactly equal for 500-bin OSWEC PM, WaveStar JONSWAP (gamma=1), and OSWEC JONSWAP (gamma=3.3): selected frequencies, widths, and spectral amplitudes.
  • Against committed MATLAB component fixtures, maximum PM errors were 8.9e-15 rad/s in frequency, 5.6e-16 in amplitude, and 6.5e-15 rad/s in width. JONSWAP maxima were 4.8e-14, 5.3e-18, and 5.2e-15, respectively.
  • Focused wave/API tests: 28 passed. Published WaveStar JONSWAP and fixed Morison PM parity tests: 2 passed.

Closes #632.

@cmccomb
cmccomb merged commit 402887a into master Oct 24, 2026
12 checks passed
@cmccomb
cmccomb deleted the codex/irregular-wave-cumulative-632 branch October 24, 2026 22:23
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.

Use SciPy cumulative trapezoid for equal-energy spectrum integration

1 participant