From c3c570764bd15cee2219b3173deda8351583526a Mon Sep 17 00:00:00 2001 From: Aloma Blanch Date: Fri, 24 Jul 2020 08:22:33 -0500 Subject: [PATCH] Changed aimed.csv imput file for aimed.txt --- functions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions.py b/functions.py index 592eb2d..4ab5c6a 100644 --- a/functions.py +++ b/functions.py @@ -42,7 +42,7 @@ def cycle(folder,dt,save_path): ax.plot(time,pressure[:,-1]/1333.22,'b') ax.plot(t_pk_loc, P_peaks/1333.22, "or",label='peak location') ax.set(xlabel='time [s]', ylabel='Pressure [mmHg]', - title='Pressure at last outlet') + title='Pressure at last outlet') ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) ax.legend(loc=0) @@ -221,9 +221,11 @@ def rcr(project_folder): return Rc_C_Rd def barPlot(project_folder,DBP,MBP,SBP,PP,Q_avg,save_path): - import csv - with open(project_folder+'/aimed.csv', 'r') as f: - aimed_all = list(csv.reader(f, delimiter=';')) + aimed_all = [1] #No li agrada fer append en una llista buida, no recordo perquè i segur que es pot fer millor + f = open(project_folder+'/aimed.txt', 'r') #obrir el fitxer + for line in f: + aimed_all = line.split() #fas una llista amb cada valor de la línia carregan-te els espais buits + del aimed_all[0] #esborrar el primer valor que has posat perquè no estigues buida la llista def plot_bar(CFD,aimed,name,save_path,unit): labels = [] @@ -292,6 +294,4 @@ def barPlot(project_folder,DBP,MBP,SBP,PP,Q_avg,save_path): # DBP CFD = [round(float(i),1) for i in Q_avg] aimed = [round(float(i),1) for i in aimed_all[4]] - plot_bar(CFD,aimed,'Q_avg',save_path,' [mL/s]') - - \ No newline at end of file + plot_bar(CFD,aimed,'Q_avg',save_path,' [mL/s]') \ No newline at end of file