Skip to content

Commit

Permalink
[bugfix]: when signal is shorter than length of optimal nffts for ove…
Browse files Browse the repository at this point in the history
…rlap-add convolve there is a failure to apply rhs truncation of the convolution, we now test for this using the minimum of the optimal nffts and the signal length
  • Loading branch information
mscaudill committed Jan 9, 2024
1 parent 1cfa481 commit c13b570
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/openseize/core/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,19 @@ def oaconvolve(pro, window, axis, mode, nfft_factor=32):
nfft = optimal_nffts(window) * nfft_factor

# fallback to optimal nffts if nfft_factor makes nfft > data size.
#if nfft - len(window) + 1 > pro.shape[axis]:
# nfft = optimal_nffts(window)

# fallback to min of optimal nffts or data shape so FIFO starts full
# 01-09-2024
if nfft - len(window) + 1 > pro.shape[axis]:
nfft = optimal_nffts(window)
nfft = min(optimal_nffts(window), pro.shape[axis])

wlen = len(window)
H = np.fft.rfft(window, nfft)

# set the step size based on optimal nfft and wlen
step = nfft - wlen + 1

nsegments = int(np.ceil(pro.shape[axis] / step))

# create the wlen-1 samples overlap
Expand Down

0 comments on commit c13b570

Please sign in to comment.