# Load pandas for data processing
# Load single summary.dat
# Summary.dat is a bit funky, so read using regex with min 2 spaces as separator.
summary = pd.read_csv(data1, header=None, index_col=None, skiprows=1, sep='\s{2,}',names=['Parameter','Value'],engine='python')
#na_psd.columns = ['Derivative distribution function','d (Å)']
# Get original xyz source from summary.dat
source_xyz = f.readline()
# Strip newline character
source_xyz = source_xyz.strip()
summary.rename(columns = {'Value':source_xyz}, inplace = True)
# Generate list for renaming of indeces
parameters = ['Volume (Å)',
'Pore-limiting diameter (Å)',
'Largest cavity diameter (Å)',
'Dimensionality','Total properties',
'Total accessible surface area (Å2)',
'Total accessible surface area (m2/cm3)',
'Total accessible surface area (m2/g)',
'Total helium pore volume (Å3)',
'Total helium pore volume (cm3/g)',
'Total geometric pore volume (Å3)',
'Total geometric pore volume (cm3/g)',
'Total probe-occupiable pore volume (Å3)',
'Total probe-occupiable pore volume (cm3/g)',
'Total volume fraction (%)',
'Network accessible surface area (Å2)',
'Network accessible surface area (m2/cm3)',
'Network accessible surface area (m2/g)',
'Network accessible helium pore volume (Å3)',
'Network accessible helium pore volume (cm3/g)',
'Network accessible geometric pore volume (Å3)',
'Network accessible geometric pore volume (cm3/g)',
'Network accessible probe-occupiable pore volume (Å3)',
'Network accessible probe-occupiable pore volume (cm3/g)',
'Network accessible volume fraction (%)']
# Update parameter list with slightly more userfriendly text
for index, row in summary.iterrows():
summary.loc[int, ['Parameter']] = [parameters[int]]
# Drop rows with NaN values
summary = summary.dropna()
summary.to_excel('220927-Multi_Summary.xlsx', index=False)