Compare commits
2 commits
a4d8c0f391
...
0abc446058
| Author | SHA1 | Date | |
|---|---|---|---|
| 0abc446058 | |||
| 1155a4fb85 |
1 changed files with 17 additions and 15 deletions
34
plot_tp.py
34
plot_tp.py
|
|
@ -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!
|
# extracting the data from files and saving them in a list of 3 dataframes. Note the order of p, T, Tbgo!
|
||||||
def extract(*files):
|
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 = []
|
data = []
|
||||||
|
|
||||||
|
data.append(pd.read_csv(files[0], sep=',', header = 0, names = columns[0], on_bad_lines='skip'))
|
||||||
# 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[0].loc[:, 'time'] = data[0].loc[:, 'time'].split(' ')[1]
|
||||||
data.append(pd.read_csv(files[i], sep=' ', header = 0, names=columns[i], on_bad_lines='skip'))
|
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
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -54,7 +57,7 @@ def shortest(*lists):
|
||||||
def duration(data):
|
def duration(data):
|
||||||
x = []
|
x = []
|
||||||
for i in range(len(data)):
|
for i in range(len(data)):
|
||||||
x[i] = data[i].loc('time')
|
x.append([data[i].loc[:, 'time']])
|
||||||
|
|
||||||
min_list = shortest(x)
|
min_list = shortest(x)
|
||||||
start = min_list[0]
|
start = min_list[0]
|
||||||
|
|
@ -62,7 +65,7 @@ def duration(data):
|
||||||
|
|
||||||
for k in range(len(data)):
|
for k in range(len(data)):
|
||||||
d = data[k]
|
d = data[k]
|
||||||
data = d.loc[start:end]
|
data = d.loc[start:end, :]
|
||||||
return [data, min_list]
|
return [data, min_list]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -84,13 +87,13 @@ data = duration(extract(file_p, file_T, file_Tbgo))[0]
|
||||||
|
|
||||||
t = secs(data[1])
|
t = secs(data[1])
|
||||||
|
|
||||||
p1 = data[0].loc('p1')
|
p1 = data[0].loc['p1']
|
||||||
p2 = data[0].loc('p2')
|
p2 = data[0].loc['p2']
|
||||||
T1 = data[1].loc('T1')
|
T1 = data[1].loc['T1']
|
||||||
T2 = data[1].loc('T2')
|
T2 = data[1].loc['T2']
|
||||||
T3 = data[1].loc('T3')
|
T3 = data[1].loc['T3']
|
||||||
T4 = data[1].loc('T4')
|
T4 = data[1].loc['T4']
|
||||||
Tbgo = data[2].loc('Tbgo')
|
Tbgo = data[2].loc['Tbgo']
|
||||||
|
|
||||||
# making the figure with 2 axes
|
# making the figure with 2 axes
|
||||||
fig = plt.figure
|
fig = plt.figure
|
||||||
|
|
@ -126,4 +129,3 @@ ax2.plot(t, p2)
|
||||||
#
|
#
|
||||||
plt.grid(1)
|
plt.grid(1)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue