-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.py
More file actions
81 lines (67 loc) · 1.18 KB
/
test.py
File metadata and controls
81 lines (67 loc) · 1.18 KB
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
import math
import sys
import numpy as np
from numpy import arange
import numpy.fft as fft
import matplotlib.pyplot as plt
if __name__ == '__main__':
from dugulib import sort
else:
from .dugulib import sort
def testAll():
'''
Test required packet
'''
testNumpy()
testMatplot()
testSympy()
def testNumpy():
'''
Test numpy package arange
Args:
=
None
Return:
=
None
Example:
>>> test.testNumpy()
'''
print('numpy.arange:', arange(1, 10, 0.8))
def testMatplot():
'''
Test matplotlib package fft show plot
Args:
===
None
Return:
===
None
Example:
===
```python
>>> test.testMatplot()
```
'''
## totol test nm.array plot fft
X = np.array([1, 2, 3, 4])
Q = np.array([1, 2, 3, 4])
T = np.arange(1, 100, 0.1)
S = np.sin(T)
plt.plot(T, S)
plt.show()
plt.figure()
freq = fft.fftfreq(T.shape[-1])
plt.plot(freq, fft.fft(S))
plt.show()
def testSympy():
'''
test sympy
'''
pass
if __name__ == '__main__':
print(math.log2(3))
print(math.log2(7))
sort.test()
# python src/test.py
# python3 src/test.py