@@ -117,6 +117,29 @@ def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1, *, pr
117117 >>> plt.imshow(cwtmatr, extent=[-1, 1, 1, 31], cmap='PRGn', aspect='auto',
118118 ... vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max())
119119 >>> plt.show()
120+
121+ >>> import pywt
122+ >>> import numpy as np
123+ >>> import matplotlib.pyplot as plt
124+ >>> t = np.linspace(-1, 1, 200, endpoint=False)
125+ >>> 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)))
126+ >>> widths = np.logspace(np.log10(1), np.log10(30), 30)
127+ >>> cwtmatr, freqs = pywt.cwt(sig, widths, 'mexh')
128+ >>> hop_size = 16
129+ >>> cwtmatr_h, freqs_h = pywt.cwt(sig, widths, 'mexh', hop_size=hop_size)
130+ >>> fig, axes = plt.subplots(1, 2, figsize=(12, 5), sharey=True)
131+ >>> im0 = axes[0].imshow(
132+ cwtmatr, extent=[t[0], t[-1], widths[-1], widths[0]],
133+ cmap='PRGn', aspect='auto',
134+ vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max()
135+ )
136+ >>> axes[0].set_title("Original scalogram")
137+ >>> im1 = axes[1].imshow(
138+ cwtmatr_h, extent=[t[0], t[-1], widths[-1], widths[0]],
139+ cmap='PRGn', aspect='auto',
140+ vmax=abs(cwtmatr_h).max(), vmin=-abs(cwtmatr_h).max()
141+ )
142+ >>> axes[1].set_title("Scalogram with hop size")
120143 """
121144
122145 # accept array_like input; make a copy to ensure a contiguous array
0 commit comments