import pandas as pd
import scipy as sp
from scipy import constants
import numpy as np
import matplotlib.pyplot as plt
d = ['Lactose.450g.2p', 'Lactose.229g.16p', 'Lactose.343g.16p',
'Lactose.375g.2p','Lactose.400g.16p', 'Lactose.419g.16p',
'Lactose.425g.2p', 'Lactose.500g.2p']
for i in d:
reference = []
list_reference = pd.read_excel('C:\\Kean\\MasterFileLactose071019.xlsx', sheet_name = [i])
reference.append(list_reference)
xaxis_samp = pd.read_excel('C:\\Kean\\MasterFileLactose071019.xlsx', sheet_name = [i], usecols = 'C' , skiprows = [0,1])
yaxis_samp = pd.read_excel('C:\\Kean\\MasterFileLactose071019.xlsx', sheet_name = [i], usecols = 'D' , skiprows = [0,1])
xaxis_ref = pd.read_excel('C:\\Kean\\MasterFileLactose071019.xlsx', sheet_name = [i], usecols = 'I', skiprows = [0,1])
yaxis_ref = pd.read_excel('C:\\Kean\\MasterFileLactose071019.xlsx', sheet_name = [i], usecols ='J', skiprows = [0,1])
for e1, e2, e3, e4, e5 in zip(xaxis_samp,yaxis_samp,xaxis_ref,yaxis_ref, [i]):
fig_ref, [ax1, ax2] = plt.subplots(nrows = 2, ncols = 1, figsize = (10,10))
ax1.plot(e3, e4)
ax1.set_title( 'Reference Spectrum Teflon Tablet')
ax1.grid(True)
ax1.set_xlim(0,3)
ax1.set(xlabel = 'TeraHertz (THz)', ylabel = 'Electric field (a.u.)')
ax2.plot(e1,e2)
ax2.set_title('Sample Spectrum ' + str(e5) + ' Tablet')
ax2.grid(True)
ax2.set_xlim(0,3)
ax2.set(xlabel = 'TeraHertz (THz)', ylabel = 'Electric field (a.u.)')