Removing unnecessary libraries

This commit is contained in:
Aloma Blanch 2020-07-17 06:48:51 -05:00
parent ca94398ec8
commit 6dcd1a4641
2 changed files with 19 additions and 23 deletions

View File

@ -8,13 +8,9 @@ Created on Thu Jul 16 15:08:27 2020
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from tkinter import Tk
from tkinter.filedialog import askopenfilename, asksaveasfile, askdirectory
import pandas as pd import pandas as pd
import tkinter as tk
from statistics import mean from statistics import mean
from scipy.signal import find_peaks # from scipy.signal import find_peaks
import matplotlib.transforms as mtransforms import matplotlib.transforms as mtransforms
@ -44,7 +40,7 @@ def error_plot(folder,t_step,r_criteria,save_path):
title='Last nonlinear residual error for each time step') title='Last nonlinear residual error for each time step')
ax.spines['right'].set_visible(False) ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False) ax.spines['top'].set_visible(False)
plt.show() # plt.show()
plt.savefig(save_path + '/Last_nonlin_res_error.pdf') plt.savefig(save_path + '/Last_nonlin_res_error.pdf')
# Semilog scale # Semilog scale
fig, ax = plt.subplots() fig, ax = plt.subplots()
@ -54,7 +50,7 @@ def error_plot(folder,t_step,r_criteria,save_path):
title='Log - Last nonlinear residual error for each time step') title='Log - Last nonlinear residual error for each time step')
ax.spines['right'].set_visible(False) ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False) ax.spines['top'].set_visible(False)
plt.show() # plt.show()
plt.savefig(save_path + '/Log_Last_nonlin_res_error.pdf') plt.savefig(save_path + '/Log_Last_nonlin_res_error.pdf')
fig.savefig(save_path + '/Log_Last_nonlin_res_error.jpg',dpi=150) fig.savefig(save_path + '/Log_Last_nonlin_res_error.jpg',dpi=150)
@ -80,7 +76,7 @@ def periodicity(project,folder,dt,T_cyc,n_cyc,save_path):
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()
plt.savefig(save_path + '/periodicity.pdf') plt.savefig(save_path + '/periodicity.pdf')
fig.savefig(save_path + '/periodicity.jpg',dpi=150) fig.savefig(save_path + '/periodicity.jpg',dpi=150)
@ -109,7 +105,7 @@ def pressure(folder,N_ts,T_cyc,dt,n_cyc,save_path):
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()
plt.savefig(save_path + '/pressure.pdf') plt.savefig(save_path + '/pressure.pdf')
fig.savefig(save_path + '/pressure.jpg',dpi=150) fig.savefig(save_path + '/pressure.jpg',dpi=150)
return (DBP,MBP,SBP,PP) return (DBP,MBP,SBP,PP)
@ -130,7 +126,7 @@ def flow(folder,N_ts,T_cyc,dt,n_cyc,save_path):
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()
plt.savefig(save_path + '/flow.pdf') plt.savefig(save_path + '/flow.pdf')
fig.savefig(save_path + '/flow.jpg',dpi=150) fig.savefig(save_path + '/flow.jpg',dpi=150)
return Q return Q
@ -168,7 +164,7 @@ def inlet_flow_waveform(project_folder,t_btw_rst,N_ts,dt,T_cyc,n_cyc,save_path):
for x, y, t in zip(t_pts[(-n_cyc-1):], Q_pts[(-n_cyc-1):], time): for x, y, t in zip(t_pts[(-n_cyc-1):], Q_pts[(-n_cyc-1):], time):
plt.text(x, y, t, transform=trans_offset, fontsize=12) plt.text(x, y, t, transform=trans_offset, fontsize=12)
ax.legend(loc=0) ax.legend(loc=0)
plt.show() # plt.show()
plt.savefig(save_path + '/inlet_waveform.pdf') plt.savefig(save_path + '/inlet_waveform.pdf')
fig.savefig(save_path + '/inlet_waveform.jpg',dpi=150) fig.savefig(save_path + '/inlet_waveform.jpg',dpi=150)
print('{0} time steps saved, available to visualize in ParaView.'.format(np.unique(np.round(t_pts,3)).shape[0])) print('{0} time steps saved, available to visualize in ParaView.'.format(np.unique(np.round(t_pts,3)).shape[0]))

22
main.py
View File

@ -5,18 +5,19 @@ Created on Thu Jul 16 15:08:27 2020
@author: Aloma Blanch @author: Aloma Blanch
""" """
import numpy as np # import numpy as np
import matplotlib.pyplot as plt # import matplotlib.pyplot as plt
import matplotlib.ticker as mtick # import matplotlib.ticker as mtick
from tkinter import Tk from tkinter import Tk
from tkinter.filedialog import askopenfilename, asksaveasfile, askdirectory # from tkinter.filedialog import askopenfilename, asksaveasfile, askdirectory
import pandas as pd from tkinter.filedialog import askdirectory
import tkinter as tk # import pandas as pd
# import tkinter as tk
import os.path import os.path
from scipy.signal import find_peaks_cwt # from scipy.signal import find_peaks_cwt
from scipy import signal # from scipy import signal
import statistics # import statistics
from fpdf import FPDF # from fpdf import FPDF
from functions import error_plot, periodicity, pressure, flow, inlet_flow_waveform from functions import error_plot, periodicity, pressure, flow, inlet_flow_waveform
@ -65,6 +66,5 @@ txt1 = periodicity(project,folder,dt,T_cyc,n_cyc,save_path)
# Inlet Flow Rate + and t saved # Inlet Flow Rate + and t saved
txt2 = inlet_flow_waveform(project_folder,t_btw_rst,N_ts,dt,T_cyc,n_cyc,save_path) txt2 = inlet_flow_waveform(project_folder,t_btw_rst,N_ts,dt,T_cyc,n_cyc,save_path)
# Create PDF report # Create PDF report
generatePDF(save_path,project,DBP,MBP,SBP,PP,Q_avg,txt1,txt2) generatePDF(save_path,project,DBP,MBP,SBP,PP,Q_avg,txt1,txt2)