-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMAIN.py
More file actions
39 lines (29 loc) · 762 Bytes
/
MAIN.py
File metadata and controls
39 lines (29 loc) · 762 Bytes
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
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy import fftpack
def hilbert(x):
t = np.linspace(1e-10, 2*np.pi, len(x))
y = np.convolve(x,1/(np.pi*t))
return y[0:len(x)]/1e9
##测试从路径打开文件
def testFileKeep():
NowPath = os.getcwd()
L = os.listdir(NowPath+"\\TrainingData")
##列出该文件夹下的文件的名字
print L
os.chdir(NowPath+"\\TrainingData")
f = open(L[0])
a = f.readlines()
print(a)
if __name__ == "__main__":
#testFileKeep()
SamplingRate = 100.0
t = np.linspace(1e-10, 2*np.pi, SamplingRate)
x = np.cos(t)
hy = hilbert(x)
hhy = fftpack.hilbert(x)
print(len(t), len(x))
plt.plot(t,x)
plt.plot(t,hhy)
plt.show()