-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgraphical.py
43 lines (37 loc) · 1.39 KB
/
graphical.py
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
import numpy as np
from matplotlib import pyplot as plt
import scipy as sp
matrix_data = np.loadtxt('Thank_You.txt', delimiter = ',')
mask_mark = 0
sentence = 'Thank You'
matrix_data = matrix_data.reshape(-1, 13, 2)
matrix_data_x_fft = sp.fft.fftshift(sp.fft.fft(matrix_data[:,mask_mark,0]))
matrix_data_y_fft = sp.fft.fftshift(sp.fft.fft(matrix_data[:,mask_mark,1]))
t = np.linspace(0, 1, 25)
w = np.linspace(-np.pi, np.pi, len(matrix_data_x_fft))
for mask_mark in range(13):
matrix_data_x_fft = sp.fft.fftshift(sp.fft.fft(matrix_data[:,mask_mark,0]))
matrix_data_y_fft = sp.fft.fftshift(sp.fft.fft(matrix_data[:,mask_mark,1]))
plt.subplot(2,1,1)
plt.plot(t, matrix_data[:,mask_mark,0], 'g')
plt.title('Lip coordinates of position ' + str(mask_mark+1) + ' - ' + '\"' + sentence + '\"')
plt.grid(True)
plt.ylabel('position - x')
plt.subplot(2,1,2)
plt.plot(t, matrix_data[:,mask_mark,1], 'b')
plt.grid(True)
plt.xlabel('time')
plt.ylabel('position - y')
plt.show()
#print(np.abs(matrix_data_x_fft), np.abs(matrix_data_y_fft))
# plt.subplot(2,1,1)
# plt.plot(w, np.abs(matrix_data_x_fft), 'g')
# plt.title('Fourier Transform Lip coordinates of position ' + str(mask_mark) + ' - ' + sentence)
# plt.grid(True)
# plt.ylabel('ft - position - x')
# plt.subplot(2,1,2)
# plt.plot(w, np.abs(matrix_data_y_fft), 'g')
# plt.grid(True)
# plt.xlabel('freq')
# plt.ylabel('ft - position - y')
# plt.show()