Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

wavelet.py 1.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. # # 小波变换
  4. # - [PyWavelets](https://github.com/PyWavelets/pywt)
  5. # In[1]:
  6. get_ipython().run_line_magic('reload_ext', 'autoreload')
  7. get_ipython().run_line_magic('autoreload', '2')
  8. get_ipython().run_line_magic('matplotlib', 'inline')
  9. # In[2]:
  10. import pandas as pd
  11. import numpy as np
  12. import pywt
  13. import pywt.data
  14. import matplotlib.pyplot as plt
  15. # In[3]:
  16. original = pywt.data.camera()
  17. # In[4]:
  18. # Wavelet transform of image, and plot approximation and details
  19. titles = ['Approximation', ' Horizontal detail',
  20. 'Vertical detail', 'Diagonal detail']
  21. coeffs2 = pywt.dwt2(original, 'bior1.3')
  22. LL, (LH, HL, HH) = coeffs2
  23. fig = plt.figure(figsize=(12, 3))
  24. for i, a in enumerate([LL, LH, HL, HH]):
  25. ax = fig.add_subplot(1, 4, i + 1)
  26. ax.imshow(a, interpolation="nearest", cmap=plt.cm.gray)
  27. ax.set_title(titles[i], fontsize=10)
  28. ax.set_xticks([])
  29. ax.set_yticks([])
  30. fig.tight_layout()
  31. plt.show()
  32. # In[5]:
  33. pywt.families()
  34. # In[6]:
  35. pywt.families(short=False)
  36. # In[7]:
  37. pywt.wavelist(family='coif',kind='discrete')
  38. # In[8]:
  39. pywt.wavelist(family='haar',kind='continuous')
  40. # In[9]:
  41. wavelet = pywt.Wavelet('db1')
  42. # In[10]:
  43. print(wavelet)
  44. # In[ ]:
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...