Compare commits
No commits in common. "24711c0281ee6ccef8581884d323cc4583d81aa4" and "0a949ffd3d8ff37c9387ff236eeff67be6ae06a3" have entirely different histories.
24711c0281
...
0a949ffd3d
32
functions.py
32
functions.py
|
@ -7,7 +7,6 @@ from tkinter import Tk
|
||||||
from tkinter.filedialog import askopenfilename, asksaveasfile, askdirectory
|
from tkinter.filedialog import askopenfilename, asksaveasfile, askdirectory
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from statistics import mean
|
|
||||||
from scipy.signal import find_peaks
|
from scipy.signal import find_peaks
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,42 +81,15 @@ def pressure(folder,N_ts,T_cyc,dt,n_cyc):
|
||||||
Nc = round(T_cyc/dt)
|
Nc = round(T_cyc/dt)
|
||||||
time = np.linspace(0,T_cyc,Nc)
|
time = np.linspace(0,T_cyc,Nc)
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
SBP = np.empty(pressure.shape[1])
|
|
||||||
DBP = np.empty(pressure.shape[1])
|
|
||||||
MBP = np.empty(pressure.shape[1])
|
|
||||||
for i in range(0,pressure.shape[1]):
|
for i in range(0,pressure.shape[1]):
|
||||||
ax.plot(time,pressure[N_ts-Nc:N_ts,i]/1333.22,label='ROI-'+str(i+2))
|
ax.plot(time,pressure[N_ts-Nc:N_ts,-i]/1333.22,label='ROI-'+str(i+2))
|
||||||
SBP[i] = (np.amax(pressure[N_ts-Nc:N_ts,i]/1333.22))
|
|
||||||
DBP[i] = (np.amin(pressure[N_ts-Nc:N_ts,i]/1333.22))
|
|
||||||
MBP[i] = (mean(pressure[N_ts-Nc:N_ts,i]/1333.22))
|
|
||||||
PP = SBP-DBP
|
|
||||||
ax.set(xlabel='time [s]', ylabel='Pressure [mmHg]',
|
ax.set(xlabel='time [s]', ylabel='Pressure [mmHg]',
|
||||||
title='Pressure @ each outlet')
|
title='Pressure @ each outlet')
|
||||||
ax.spines['right'].set_visible(False)
|
ax.spines['right'].set_visible(False)
|
||||||
ax.spines['top'].set_visible(False)
|
ax.spines['top'].set_visible(False)
|
||||||
ax.legend(loc=0)
|
ax.legend(loc=0)
|
||||||
plt.show()
|
plt.show()
|
||||||
return (DBP,MBP,SBP,PP)
|
|
||||||
|
|
||||||
|
|
||||||
def flow(folder,N_ts,T_cyc,dt,n_cyc):
|
|
||||||
flow = np.loadtxt(folder+'/QHistRCR.dat',skiprows=2,)
|
|
||||||
Nc = round(T_cyc/dt)
|
|
||||||
time = np.linspace(0,T_cyc,Nc)
|
|
||||||
fig, ax = plt.subplots()
|
|
||||||
Q = np.empty(flow.shape[1])
|
|
||||||
for i in range(0,flow.shape[1]):
|
|
||||||
ax.plot(time,flow[N_ts-Nc:N_ts,i],label='ROI-'+str(i+2))
|
|
||||||
Q[i] = (mean(flow[N_ts-Nc:N_ts,i]))
|
|
||||||
|
|
||||||
ax.set(xlabel='time [s]', ylabel='Flow [mL/s]',
|
|
||||||
title='Flow @ each outlet')
|
|
||||||
ax.spines['right'].set_visible(False)
|
|
||||||
ax.spines['top'].set_visible(False)
|
|
||||||
ax.legend(loc=0)
|
|
||||||
plt.show()
|
|
||||||
return Q
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
main.py
6
main.py
|
@ -13,7 +13,7 @@ from scipy import signal
|
||||||
import statistics
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
from functions import error_plot, periodicity, pressure, flow
|
from functions import error_plot, periodicity, pressure
|
||||||
|
|
||||||
# Selct dir
|
# Selct dir
|
||||||
Tk().withdraw()
|
Tk().withdraw()
|
||||||
|
@ -49,7 +49,5 @@ error_plot(folder,dt,rc,False)
|
||||||
periodicity(project,folder,dt,T_cyc,n_cyc)
|
periodicity(project,folder,dt,T_cyc,n_cyc)
|
||||||
|
|
||||||
# Pressure
|
# Pressure
|
||||||
(DBP,MBP,SBP,PP) = pressure(folder,N_ts,T_cyc,dt,n_cyc)
|
pressure(folder,N_ts,T_cyc,dt,n_cyc)
|
||||||
|
|
||||||
# Flow Rate
|
|
||||||
(Q_avg) = flow(folder,N_ts,T_cyc,dt,n_cyc)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user