Skip to content

Commit 05ba1eb

Browse files
committed
packet example updat.e
1 parent cc2ff58 commit 05ba1eb

File tree

10 files changed

+6
-5
lines changed

10 files changed

+6
-5
lines changed
7.48 MB
Binary file not shown.
1.57 MB
Binary file not shown.
9.77 KB
Binary file not shown.
4.44 KB
Binary file not shown.
44.9 MB
Binary file not shown.
9.45 MB
Binary file not shown.
58.6 KB
Binary file not shown.
28.2 KB
Binary file not shown.
56 KB
Loading

examples/wavelet_packet_chirp_analysis/chirp_analysis.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
# use from src.ptwt.packets if you cloned the repo instead of using pip.
88
from ptwt import WaveletPacket
99

10-
t = np.linspace(0, 10, 1500)
11-
w = scipy.signal.chirp(t, f0=1, f1=50, t1=10, method="linear")
10+
fs = 1000
11+
t = np.linspace(0, 2, int(2//(1/fs)))
12+
w = np.sin(256*np.pi*t**2)
1213

13-
wavelet = pywt.Wavelet("db3")
14+
wavelet = pywt.Wavelet("sym6")
1415
wp = WaveletPacket(
15-
data=torch.from_numpy(w.astype(np.float32)), wavelet=wavelet, mode="reflect"
16+
data=torch.from_numpy(w.astype(np.float32)), wavelet=wavelet, mode="boundary"
1617
)
1718
nodes = wp.get_level(5)
1819
np_lst = []
@@ -22,7 +23,7 @@
2223

2324
fig, axs = plt.subplots(2)
2425
axs[0].plot(t, w)
25-
axs[0].set_title("Linear Chirp, f(0)=1, f(10)=50")
26+
axs[0].set_title("Analyzed signal")
2627
axs[0].set_xlabel("t [s]")
2728

2829
axs[1].set_title("Wavelet analysis")

0 commit comments

Comments
 (0)