Hii all,
I have taken some data from a instrument. These data contain the temperature with time. A part of the data looks like,
00:00:08
section A 76.21
section B 76.54
section C 76.66
section D 77.87
00:15:30
section A 76.23
section B 76.89
section C 77.98
section D 78.60
…
and the file continues till end.
00:00:08 means 00 hour , 00 minutes and 08 seconds.
Now I need to read this data and make a plot of the temperature with the time.
My code till now is following,
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.dates import DateFormatter
from datetime import datetime
import re
def main():
file = r"C:\Users\sarad\ss1.dat.log"
index =
month =
day =
year =
hour =
minute =
second =
s1 =
s2 =
s3 =
s4 =
s5 =
s6 =
s7 =
s8 =
with open(file) as line:
while True:
result=re.findall(r"(\d+(?:.\d+){0,1})",line.read())
if not result:
break
hour.append(int((result[0])))
minute.append(int((result[1])))
second.append(int((result[2])))
s1.append(float(result[3]))
s2.append(float(result[4]))
s3.append(float(result[5]))
s4.append(float(result[6]))
s5.append(float(result[7]))
s6.append(float(result[8]))
s7.append(float(result[9]))
s8.append(float(result[10]))
I have to use loop somehow and read all the datas . I can not understand how to take the time also.
Could you give some idea ?
Thank you.