sol-9.dat
: ODEs from Daniel
sol-9-check.dat
: ODEs from model.c
In [1]:
import pandas as pd
pd.set_option('display.max_rows', None)
import numpy as np
In [2]:
species_list = ['time','T', 'ADIO', 'ADIOM2', 'ALD3', 'C10H2', 'C10H2M2', 'C10H2M4', 'C2H6', 'C3H4O', 'C3H4O2', 'C3H6', 'C3H6O2', 'C3H8O2',
'CH2CO', 'CH3CHO', 'CH3OH', 'CH4', 'CHAR', 'CO', 'CO2', 'COUMARYL', 'ETOH', 'H2', 'H2O', 'KET', 'KETD', 'KETDM2', 'KETM2',
'LIG', 'LIGC', 'LIGH', 'LIGM2', 'LIGO', 'MGUAI', 'OH', 'PADIO', 'PADIOM2', 'PC2H2', 'PCH2OH', 'PCH2P', 'PCH3', 'PCHO',
'PCHOHP', 'PCHP2', 'PCOH', 'PCOHP2', 'PCOS', 'PFET3', 'PFET3M2', 'PH2', 'PHENOL', 'PKETM2', 'PLIG', 'PLIGC', 'PLIGH',
'PLIGM2', 'PLIGO', 'PRADIO', 'PRADIOM2', 'PRFET3', 'PRFET3M2', 'PRKETM2', 'PRLIGH', 'PRLIGH2', 'PRLIGM2A', 'RADIO',
'RADIOM2', 'RC3H3O', 'RC3H5O2', 'RC3H7O2', 'RCH3', 'RCH3O', 'RKET', 'RKETM2', 'RLIGA', 'RLIGB', 'RLIGH', 'RLIGM2A',
'RLIGM2B', 'RMGUAI', 'RPHENOL', 'RPHENOX', 'RPHENOXM2', 'SYNAPYL', 'VADIO', 'VADIOM2', 'VCOUMARYL', 'VKET', 'VKETD',
'VKETDM2', 'VKETM2', 'VMGUAI', 'VPHENOL', 'VSYNAPYL']
In [3]:
daniel_file = pd.read_csv('sol-9.dat',delim_whitespace = True, header = None)
daniel_results = list(daniel_file.iloc[-2])
modelc_file = pd.read_csv('sol-9-check.dat',delim_whitespace = True, header = None)
modelc_results = list(modelc_file.iloc[-2])
In [4]:
results = pd.DataFrame({'species':species_list,'daniel':daniel_results,'modelc':modelc_results}).drop([0,1]).sort_values('species').reset_index(drop=True)
In [5]:
results.daniel[abs(results.daniel) < 1e-11] = 1e-11
results.modelc[abs(results.modelc) < 1e-11] = 1e-11
In [11]:
#error%
results['compare'] = results['daniel'] - results['modelc']
error = (results['daniel'].values - results['modelc'].values.astype(np.float))/results['modelc'].values.astype(float)
errlist = []
for i in error:
percent = "{0:.2f}%".format(i * 100)
errlist.append(percent)
results['error(%)'] = errlist
In [ ]:
results_comparison = pd.DataFrame()
results_comparison['species'] = results['species']
results_comparison['ddasac'] = ddasac_resort['ddasac']
#LSODA results and error%
results_comparison['LSODA'] = results['LSODA']
LSODA_error = (results_comparison['LSODA'].values - results_comparison['ddasac'].values.astype(np.float))/results_comparison['ddasac'].values.astype(float)
LSODA_errlist = []
for i in LSODA_error:
percent = "{0:.2f}%".format(i * 100)
LSODA_errlist.append(percent)
results_comparison['LSODA_error(%)'] = LSODA_errlist
#VODE results and error%
results_comparison['VODE'] = results['VODE']
VODE_error = (results_comparison['VODE'].values - results_comparison['ddasac'].values.astype(np.float))/results_comparison['ddasac'].values.astype(float)
VODE_errlist = []
for i in VODE_error:
percent = "{0:.2f}%".format(i * 100)
VODE_errlist.append(percent)
results_comparison['VODE_error(%)'] = VODE_errlist
#LSODA and VODE error compare%
compare_error = LSODA_error - VODE_error
compare_errlist = []
for i in compare_error:
percent = "{0:.8f}%".format(i * 100)
compare_errlist.append(percent)
results_comparison['LSODA-VODE(%)'] = compare_errlist
#results_comparison.to_csv('results_comparison.csv',index = False)
In [12]:
results
Out[12]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: