AcA_intensity_plots_MD/Totalplotter.py

61 lines
1.2 KiB
Python

# -*- 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')