From d96c52db24667a87a6eba9a9e83218b19563f14c Mon Sep 17 00:00:00 2001 From: Dijkhof Date: Wed, 30 Jun 2021 15:17:29 +0200 Subject: [PATCH] 'Totalplotter.py' toevoegen --- Totalplotter.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Totalplotter.py diff --git a/Totalplotter.py b/Totalplotter.py new file mode 100644 index 0000000..2b02ad7 --- /dev/null +++ b/Totalplotter.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +""" +Created on Sat Jun 26 13:27:00 2021 + +@author: D_Mik +""" + +import os +import pandas as pd +import formules +import numpy as np +import matplotlib.pyplot as plt + +# provide directory for formula parameters +rootdir = 'D:\AcA Mike Dijkhof\cwa files\Pt304_csv\Pt304_week_formula' + +d = {} +X = list() + +# import function parameters from previous scripts + +for subdir, dirs, files in os.walk(rootdir): + for file in files: + print(file) + os.chdir(subdir) + + name = file.replace('Formula_','') + name = name.replace('.csv','') + + df = pd.DataFrame(pd.read_csv(file)) + df = df.set_index('Name') + + scale = df['ENMOmax'].max() + + key = name + + d[key] = df.loc['Mean'] + X.append(scale) + +# plot curves +plt.figure(dpi=720) + +for key in d: + + formula = d[key] + Xscale = np.arange(0, max(X), 5) + + Y = formules.func(Xscale, formula.loc['a'], formula.loc['b'], formula.loc['c'] ) + + + plt.ylim(0,1440) + plt.xlim(0,(max(X)+10)) + plt.plot(Xscale, Y, label=key) + +plt.legend() +plt.title('All 6 weeks plotter for 304') #Change to pt-number +plt.show() + +plt.savefig(fname='Total_weeks_304.png') + + \ No newline at end of file