Compare commits

...

2 commits

View file

@ -27,15 +27,18 @@ file_Tbgo = args.Tbgo
# extracting the data from files and saving them in a list of 3 dataframes. Note the order of p, T, Tbgo!
def extract(*files):
columns = [['date', 'time', 'p1', 'p2'], ['time', 'I', 'T1', 'T2', 'T3', 'T4'], ['time', 'Tbgo']]
columns = [['time', 'p1', '0', 'p2', '5', '00' ], ['time', 'I', 'T1', 'T2', 'T3', 'T4'], ['time', 'Tbgo']]
data = []
# unsure if its ok to skip faulty rows and if header 0 takes out the first line of values
for i in range(len(files)):
data.append(pd.read_csv(files[i], sep=' ', header = 0, names=columns[i], on_bad_lines='skip'))
data.append(pd.read_csv(files[0], sep=',', header = 0, names = columns[0], on_bad_lines='skip'))
data[0].loc[:, 'time'] = data[0].loc[:, 'time'].split(' ')[1]
print(data[0])
# unsure if its ok to skip faulty rows and if header 0 takes out the first line of values
for i in [1, 2]:
data.append(pd.read_csv(files[i], sep=' ', header = 0, names=columns[i], on_bad_lines='skip'))
print(data)
return data
@ -54,7 +57,7 @@ def shortest(*lists):
def duration(data):
x = []
for i in range(len(data)):
x[i] = data[i].loc('time')
x.append([data[i].loc[:, 'time']])
min_list = shortest(x)
start = min_list[0]
@ -62,7 +65,7 @@ def duration(data):
for k in range(len(data)):
d = data[k]
data = d.loc[start:end]
data = d.loc[start:end, :]
return [data, min_list]
@ -84,13 +87,13 @@ data = duration(extract(file_p, file_T, file_Tbgo))[0]
t = secs(data[1])
p1 = data[0].loc('p1')
p2 = data[0].loc('p2')
T1 = data[1].loc('T1')
T2 = data[1].loc('T2')
T3 = data[1].loc('T3')
T4 = data[1].loc('T4')
Tbgo = data[2].loc('Tbgo')
p1 = data[0].loc['p1']
p2 = data[0].loc['p2']
T1 = data[1].loc['T1']
T2 = data[1].loc['T2']
T3 = data[1].loc['T3']
T4 = data[1].loc['T4']
Tbgo = data[2].loc['Tbgo']
# making the figure with 2 axes
fig = plt.figure
@ -126,4 +129,3 @@ ax2.plot(t, p2)
#
plt.grid(1)
plt.show()