In [2]:
import re
import matplotlib.pyplot as plt
In [3]:
# dataFile = 'C:\\Time Series\\a.txt'
dataFile = 'C:\\Time Series\\4032910B.AS5'
In [4]:
f = open(dataFile,'r')
read = f.readline() # direcroty
Ex = []
Ey = []
Hx = []
Hy = []
Hz = []
while True:
read = f.readline()
if read == '':
break
if read[0:2] == '> ':
SR = int((re.split(r'[ :]', read))[13])
read = f.readline().split()
for i in range(0,SR):
read = f.readline().split()
Ex.append(read[1])
Ey.append(read[2])
Hx.append(read[3])
Hy.append(read[4])
Hz.append(read[5])
In [5]:
# plt.figure(1, figsize=(20, 10))
# plt.subplot(5,1,1)
# plt.plot(Ex)
# plt.subplot(5,1,2)
# plt.plot(Ey)
# plt.subplot(5,1,3)
# plt.plot(Hx)
# plt.subplot(5,1,4)
# plt.plot(Hy)
# plt.subplot(5,1,5)
# plt.plot(Hz)
# plt.show()
f, (ax1, ax2, ax3, ax4, ax5) = plt.subplots(5, sharex=True, sharey=False)
ax1.plot(Ex)
ax2.plot(Ey)
ax3.plot(Hx)
ax4.plot(Hy)
ax5.plot(Hz)
f.subplots_adjust(hspace=0)
f.set_size_inches(20,10)
plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
plt.show()
In [ ]: