-
Notifications
You must be signed in to change notification settings - Fork 0
/
fault_plot_all4.py
71 lines (59 loc) · 1.72 KB
/
fault_plot_all4.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
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
#!python
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import tables
from celluloid import Camera
file1 = tables.open_file('data1.mat')
file2 = tables.open_file('data2.mat')
file3 = tables.open_file('data3.mat')
getdata1 = file1.root.data1[:]
getdata2 = file2.root.data2[:]
getdata3 = file3.root.data3[:]
data_1 = np.array(getdata1)
data_2 = np.array(getdata2)
data_3 = np.array(getdata3)
datasize = int(data_1.size)
datashape = data_1.shape
print (datashape[0])
print (datashape[1])
data_fix1 = data_1.reshape(1,datasize)
data_fix2 = data_2.reshape(1,datasize)
data_fix3 = data_3.reshape(1,datasize)
# get all data from array and store into list
time = []
phase11 = []
phase12 = []
phase13 = []
phase21 = []
phase22 = []
phase23 = []
phase31 = []
phase32 = []
phase33 = []
for i in range (0,datasize,datashape[1]):
time.append (data_fix1[0,i])
phase11.append (data_fix1[0,i+1])
phase12.append (data_fix1[0,i+2])
phase13.append (data_fix1[0,i+3])
phase21.append (data_fix2[0,i+1])
phase22.append (data_fix2[0,i+2])
phase23.append (data_fix2[0,i+3])
phase31.append (data_fix3[0,i+1])
phase32.append (data_fix3[0,i+2])
phase33.append (data_fix3[0,i+3])
fig, ax = plt.subplots(3)
camera = Camera(fig)
for j in range (datashape[0]):
ax[0].plot(time[j],phase11[j],'g-')
ax[0].plot(time[j],phase12[j],'g-')
ax[0].plot(time[j],phase13[j],'g-')
ax[1].plot(time[j],phase21[j],'g-')
ax[1].plot(time[j],phase22[j],'g-')
ax[1].plot(time[j],phase23[j],'g-')
ax[2].plot(time[j],phase31[j],'g-')
ax[2].plot(time[j],phase32[j],'g-')
ax[2].plot(time[j],phase33[j],'g-')
camera.snap()
animation = camera.animate()