Skip to content

cwt: log scales in docstring example #802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pywt/_cwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1):
>>> import pywt
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> x = np.arange(512)
>>> y = np.sin(2*np.pi*x/32)
>>> coef, freqs=pywt.cwt(y,np.arange(1,129),'gaus1')
>>> x = np.exp(np.linspace(0, 2, 512))
>>> y = np.cos(2*np.pi*x) # exponential chirp
>>> scales = np.logspace(np.log10(1), np.log10(128), 128)
>>> coef, freqs=pywt.cwt(y,scales,'gaus1')
>>> plt.matshow(coef)
>>> plt.show()

Expand All @@ -92,7 +93,7 @@ def cwt(data, scales, wavelet, sampling_period=1., method='conv', axis=-1):
>>> import matplotlib.pyplot as plt
>>> t = np.linspace(-1, 1, 200, endpoint=False)
>>> 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)))
>>> widths = np.arange(1, 31)
>>> widths = np.logspace(np.log10(1), np.log10(30), 30)
>>> cwtmatr, freqs = pywt.cwt(sig, widths, 'mexh')
>>> plt.imshow(cwtmatr, extent=[-1, 1, 1, 31], cmap='PRGn', aspect='auto',
... vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max())
Expand Down