From dbe86960ebd035aa7a86c4be4368701196ce5416 Mon Sep 17 00:00:00 2001 From: John Muradeli Date: Thu, 14 Nov 2024 08:14:18 +0400 Subject: [PATCH] Padding fix in `scale_to_freq` #113 --- ssqueezepy/experimental.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssqueezepy/experimental.py b/ssqueezepy/experimental.py index f42ad23..cbfb8e0 100644 --- a/ssqueezepy/experimental.py +++ b/ssqueezepy/experimental.py @@ -2,7 +2,7 @@ import warnings import numpy as np from .wavelets import Wavelet, center_frequency -from .utils import backend as S, cwt_scalebounds +from .utils import backend as S, cwt_scalebounds, p2up from .utils.common import EPS32, EPS64, p2up, trigdiff from .ssqueezing import ssqueeze from ._ssq_cwt import phase_cwt, phase_cwt_num @@ -114,7 +114,7 @@ def scale_to_freq(scales, wavelet, N, fs=1, padtype='reflect'): wavelet = Wavelet._init_if_not_isinstance(wavelet) # evaluate wavelet at `scales` - Npad = int(2**np.ceil(np.log2(N))) if padtype is not None else N + Npad = p2up(N)[0] if padtype is not None else N psis = wavelet(scale=scales, N=Npad) if hasattr(psis, 'cpu'): psis = psis.cpu().numpy()