sol.dat
: vode solver,
sol_check.dat
: LSODA(odenit),
ddasac_results_1.out
: DDASAC,
model.c
: species order(result order) which is different from ours is included in this file.
Please make a dataframe, species as rows, solvers as columns, and %error comparing to ddasac’s result.
In [1]:
import pandas as pd
pd.set_option('display.max_rows', None)
import numpy as np
In [2]:
#for VODE and LSODA
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]:
vode_file = pd.read_csv('sol.dat',delim_whitespace = True, header = None)
vode_results = list(vode_file.iloc[-2])
LSODA_file = pd.read_csv('sol_check.dat',delim_whitespace = True, header = None)
LSODA_results = list(LSODA_file.iloc[175])
In [4]:
results = pd.DataFrame({'species':species_list,'VODE':vode_results,'LSODA':LSODA_results}).drop([0,1]).sort_values('species').reset_index(drop=True)
In [5]:
results.LSODA[abs(results.LSODA) < 1e-11] = 1e-11
results.VODE[abs(results.VODE) < 1e-11] = 1e-11
In [6]:
#for ddasac
species_ddasac = ['PLIGC', 'PLIGH', 'PLIGO', 'PRLIGH', 'LIGH', 'C3H6', 'OH', 'RLIGM2A', 'LIGM2',
'RPHENOXM2', 'RADIOM2', 'PLIGM2', 'PRADIOM2', 'LIG', 'RPHENOX', 'RADIO', 'PLIG', 'PRADIO',
'PADIOM2', 'PADIO', 'PKETM2', 'PRKETM2', 'KETDM2', 'CO', 'C10H2M4', 'H2', 'C10H2', 'RLIGH',
'ALD3', 'PRLIGH2', 'PRLIGM2A', 'RMGUAI', 'C3H6O2', 'KETM2', 'RLIGM2B', 'PFET3M2',
'PRFET3M2', 'C3H4O2', 'RPHENOL',' RLIGA', 'KET', 'RLIGB', 'PFET3', 'PRFET3', 'SYNAPYL',
'RKETM2', 'COUMARYL', 'RKET', 'KETD', 'RC3H7O2', 'RCH3O', 'CH3CHO', 'C10H2M2', 'CH2CO',
'CO2', 'ADIOM2', 'PH2', 'PCOH', 'RC3H5O2', 'RC3H3O', 'PCOS', 'ADIO', 'RCH3', 'PCH3', 'ETOH',
'H2O', 'PCH2OH', 'PCHP2', 'PCHOHP', 'CHAR', 'PCOHP2', 'PC2H2', 'PCHO', 'CH3OH', 'C2H6',
'PCH2P', 'VADIOM2', 'VKETM2', 'VKETDM2', 'VSYNAPYL', 'MGUAI', 'VMGUAI', 'VCOUMARYL',
'VADIO', 'VKET', 'VKETD', 'PHENOL', 'VPHENOL', 'LIGC', 'LIGO', 'C3H8O2', 'CH4', 'C3H4O']
In [7]:
ddasac_file = pd.read_csv('ddasac_results_1.out',delim_whitespace = True, header = None)
ddasac_df = list(ddasac_file.iloc[37])[2:95]
In [8]:
ddasac = pd.DataFrame({'name':species_ddasac,'ddasac':ddasac_df}).sort_values('name').reset_index(drop=True)
In [9]:
# modify the order of species
ddasac_1 = ddasac.iloc[0]
ddasac_2 = ddasac.iloc[1:74]
ddasac_3 = ddasac.iloc[74:]
ddasac_resort = ddasac_2.append(ddasac_1).append(ddasac_3).reset_index(drop=True)
#abtol=1e-11
ddasac_resort['ddasac'] = ddasac_resort['ddasac'].astype(float)
ddasac_resort.ddasac[abs(ddasac_resort.ddasac) < 1e-11] = 1e-11
In [10]:
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
In [11]:
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]:
#Full comparison results
results_comparison
Out[12]:
In [22]:
# Results of compositions whose comcentration is larger than 0.01
print("Length is " + str(len(results_comparison[results_comparison.ddasac > 0.01])))
results_comparison[results_comparison.ddasac > 0.01]
Out[22]:
In [23]:
#Results whose difference between LSODA and VODE is larger than 0.0001%
index_list = []
for index,per in enumerate(results_comparison['LSODA-VODE(%)']):
if float(per.split('%')[0]) > 0.0001:
index_list.append(index)
print("Length is " + str(len(results_comparison.loc[index_list])))
results_comparison.loc[index_list]
Out[23]:
In [ ]: