Skip to content

Commit 7f4f74a

Browse files
DOC: cwt: log scales in docstring example (#802)
1 parent e0dc00c commit 7f4f74a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pywt/_cwt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1):
8181
>>> import pywt
8282
>>> import numpy as np
8383
>>> import matplotlib.pyplot as plt
84-
>>> x = np.arange(512)
85-
>>> y = np.sin(2*np.pi*x/32)
86-
>>> coef, freqs=pywt.cwt(y,np.arange(1,129),'gaus1')
84+
>>> x = np.exp(np.linspace(0, 2, 512))
85+
>>> y = np.cos(2*np.pi*x) # exponential chirp
86+
>>> scales = np.logspace(np.log10(1), np.log10(128), 128)
87+
>>> coef, freqs = pywt.cwt(y, scales, 'gaus1')
8788
>>> plt.matshow(coef)
8889
>>> plt.show()
8990
@@ -92,7 +93,7 @@ def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1):
9293
>>> import matplotlib.pyplot as plt
9394
>>> t = np.linspace(-1, 1, 200, endpoint=False)
9495
>>> sig = np.cos(2 * np.pi * 7 * t) + np.real(np.exp(-7*(t-0.4)**2)*np.exp(1j*2*np.pi*2*(t-0.4)))
95-
>>> widths = np.arange(1, 31)
96+
>>> widths = np.logspace(np.log10(1), np.log10(30), 30)
9697
>>> cwtmatr, freqs = pywt.cwt(sig, widths, 'mexh')
9798
>>> plt.imshow(cwtmatr, extent=[-1, 1, 1, 31], cmap='PRGn', aspect='auto',
9899
... vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max())

0 commit comments

Comments
 (0)