Skip to content

Commit

Permalink
update scales tests, tabs->spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cyschneck committed Feb 23, 2024
1 parent 8171353 commit ce6b0d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pywt/_cwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1):
# reshape to (n_batch, data.shape[-1])
data_shape_pre = data.shape
data = data.reshape((-1, data.shape[-1]))
if 0 in scales:
raise ValueError("scales range cannot include zero")

if 0 in scales:
raise ValueError("scales range cannot include zero")

for i, scale in enumerate(scales):
step = x[1] - x[0]
Expand Down
7 changes: 7 additions & 0 deletions pywt/tests/test_cwt_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,13 @@ def test_cwt_small_scales():
# extremely short scale factors raise a ValueError
assert_raises(ValueError, pywt.cwt, data, scales=0.01, wavelet='mexh')

def test_cwt_zero_scale():
data = np.zeros(32)
scales = np.arange(0, 4)

# scale that includes 0 throws ValueError to prevent IndexError
assert_raises(ValueError, pywt.cwt, data, scales=scales, wavelet='morl')


def test_cwt_method_fft():
rstate = np.random.RandomState(1)
Expand Down

0 comments on commit ce6b0d1

Please sign in to comment.