In [1]:
import IPython.core.display as di
# This line will hide code by default when the notebook is exported as HTML
di.display_html('<script>jQuery(function() {if (jQuery("body.notebook_app").length == 0) { jQuery(".input_area").toggle(); jQuery(".prompt").toggle();}});</script>', raw=True)
# This line will add a button to toggle visibility of code blocks, for use with the HTML export version
di.display_html('''<button onclick="jQuery('.input_area').toggle(); jQuery('.prompt').toggle();">Show/Hide code</button>''', raw=True)
In [2]:
#Allow the created content to be interactivelly ploted inline
%matplotlib inline
#Establish width and height for all plots in the report
#pylab.rcParams['figure.figsize'] = (18, 6) #width, height
In [3]:
#Import needed libraries
import os
from os.path import join, getsize
import pandas as pd
from cycler import cycler
import matplotlib.pyplot as plt
from IPython.display import display
import numpy as np
import collections
import matplotlib as mpl
inline_rc = dict(mpl.rcParams)
#the next cell enables plotting tables without borders
In [4]:
%%html
<style>
table,td,tr,th {border:none!important}
</style>

Summary report of the CO2MPAS WLTP to NEDC CO$_2$ emission simulation model - Automatic vehicles (v.1.5.x)

In [5]:
#Specify the output folder and file containing the CO2MPAS summary output file.
folder = r'C:\Apps\co2mpas_AIO-v1.5.4\CO2MPAS\IPYTHON\Reports_STAMP'
file = '20170210_191114-summary_AT_stamp.xlsx'
infile = join(folder, file)
df=pd.read_excel(infile, 'summary', header=[0,1,2,3], index_col=[0], skiprows=[4])
In [6]:
#Gather and name the basic variables used in the report according to their name in the CO2MPAS output file
NEDCh = df['nedc_h']['prediction']['output']['value']
NEDCth = df['nedc_h']['prediction']['target']['value']
UDCh = df['nedc_h']['prediction']['output']['UDC']
UDCth = df['nedc_h']['prediction']['target']['UDC']
EUDCh = df['nedc_h']['prediction']['output']['EUDC']
EUDCth = df['nedc_h']['prediction']['target']['EUDC']

NEDCl = df['nedc_l']['prediction']['output']['value']
NEDCtl = df['nedc_l']['prediction']['target']['value']
UDCl = df['nedc_l']['prediction']['output']['UDC']
UDCtl = df['nedc_l']['prediction']['target']['UDC']
EUDCl = df['nedc_l']['prediction']['output']['EUDC']
EUDCtl = df['nedc_l']['prediction']['target']['EUDC']


#Obtain the case number and vehicle model from the input file
df['vehicle'] = df.index
cases = df['vehicle'].str.split('_').str[-1].astype('int')
model = df['vehicle'].str.split('_').str[0]
#Create a dataframe with this data
valuesDF = pd.DataFrame({'NEDCh': NEDCh,'NEDCth':NEDCth, 'dNEDCh': NEDCh-NEDCth,'UDCh': UDCh,'UDCth':UDCth, 'dUDCh':UDCh-UDCth,'EUDCh': EUDCh,'EUDCth':EUDCth, 'dEUDCh':EUDCh-EUDCth,'NEDCl': NEDCl,'NEDCtl':NEDCtl, 'dNEDCl':NEDCl-NEDCtl,'UDCl': UDCl,'UDCtl':UDCtl, 'dUDCl':UDCl-UDCtl,'EUDCl': EUDCl,'EUDCtl':EUDCtl, 'dEUDCl':EUDCl-EUDCtl,'Case':cases,'Model':model})   
#calculate percentages
valuesDF['NEDC-H error [%]'] = pd.Series((valuesDF.dNEDCh/valuesDF.NEDCth*100), index=valuesDF.index)
valuesDF['UDC-H error [%]'] = pd.Series((valuesDF.dUDCh/valuesDF.UDCth*100), index=valuesDF.index)
valuesDF['EUDC-H error [%]'] = pd.Series((valuesDF.dEUDCh/valuesDF.EUDCth*100), index=valuesDF.index)
valuesDF['NEDC-L error [%]'] = pd.Series((valuesDF.dNEDCl/valuesDF.NEDCtl*100), index=valuesDF.index)
valuesDF['UDC-L error [%]'] = pd.Series((valuesDF.dUDCl/valuesDF.UDCtl*100), index=valuesDF.index)
valuesDF['EUDC-L error [%]'] = pd.Series((valuesDF.dEUDCl/valuesDF.EUDCtl*100), index=valuesDF.index)

valuesDF = valuesDF.dropna()

Section 1. Performance of the model. All vehicles and test cases.

Error statistics for CO$_2$ emission per driving cycle

Error statistics for NEDC, UDC, and EUDC CO$_2$ emission

In [7]:
#Create a dataframe with the NECD, UDC, EUDC error statistics
errorsDF = pd.DataFrame(index=['Averages','StdError','Median','Mode','StdDev','Variance','Kurtosis','Skweness','Range','Minimum','Maximum','Sum','Count','Confidence level (95%)'], columns=['NEDC-H [gCO$_2$ km$^{-1}$]','UDC-H [gCO$_2$ km$^{-1}$]', 'EUDC-H [gCO$_2$ km$^{-1}$]','NEDC-L [gCO$_2$ km$^{-1}$]','UDC-L [gCO$_2$ km$^{-1}$]', 'EUDC-L [gCO$_2$ km$^{-1}$]'])
errorsDF.loc['Averages'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.mean(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.mean(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.mean(),2),
                                     'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.mean(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.mean(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.mean(),2)})
errorsDF.loc['StdError'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.sem(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.sem(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.sem(),2),
                                     'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.sem(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.sem(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.sem(),2)})
errorsDF.loc['Median'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.median(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.median(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.median(),2),
                                   'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.median(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.median(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.median(),2)})
errorsDF.loc['Mode'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.mode().iloc[0],2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.mode().iloc[0],2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.mode().iloc[0],2),
                                 'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.mode().iloc[0],2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.mode().iloc[0],2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.mode().iloc[0],2)})
errorsDF.loc['StdDev'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.std(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.std(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.std(),2),
                                   'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.std(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.std(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.std(),2)})
errorsDF.loc['Variance'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.var(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.var(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.var(),2),
                                     'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.var(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.var(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.var(),2)})
errorsDF.loc['Kurtosis'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.kurtosis(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.kurtosis(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.kurtosis(),2),
                                     'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.kurtosis(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.kurtosis(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.kurtosis(),2)})
errorsDF.loc['Skweness'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.skew(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.skew(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.skew(),2),
                                     'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.skew(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.skew(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.skew(),2)})
errorsDF.loc['Range'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round((valuesDF.dNEDCh.max()-valuesDF.dNEDCh.min()),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round((valuesDF.dUDCh.max()-valuesDF.dUDCh.min()),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round((valuesDF.dEUDCh.max()-valuesDF.dEUDCh.min()),2),
                                  'NEDC-L [gCO$_2$ km$^{-1}$]':round((valuesDF.dNEDCl.max()-valuesDF.dNEDCl.min()),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round((valuesDF.dUDCl.max()-valuesDF.dUDCl.min()),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round((valuesDF.dEUDCl.max()-valuesDF.dEUDCl.min()),2)})
errorsDF.loc['Minimum'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.min(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.min(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.min(),2),
                                    'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.min(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.min(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.min(),2)})
errorsDF.loc['Maximum'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.max(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.max(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.max(),2),
                                    'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.max(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.max(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.max(),2)})
errorsDF.loc['Sum'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.sum(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.sum(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.sum(),2),
                                'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.sum(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.sum(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.sum(),2)})
errorsDF.loc['Count'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCh.count(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCh.count(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCh.count(),2),
                                  'NEDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dNEDCl.count(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dUDCl.count(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':round(valuesDF.dEUDCl.count(),2)})
errorsDF.loc['Confidence level (95%)'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':2*round(valuesDF.dNEDCh.sem(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':2*round(valuesDF.dUDCh.sem(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':2*round(valuesDF.dEUDCh.sem(),2),
                                                   'NEDC-L [gCO$_2$ km$^{-1}$]':2*round(valuesDF.dNEDCl.sem(),2), 'UDC-L [gCO$_2$ km$^{-1}$]':2*round(valuesDF.dUDCl.sem(),2), 'EUDC-L [gCO$_2$ km$^{-1}$]':2*round(valuesDF.dEUDCl.sem(),2)})
errorsDF
Out[7]:
NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$] NEDC-L [gCO$_2$ km$^{-1}$] UDC-L [gCO$_2$ km$^{-1}$] EUDC-L [gCO$_2$ km$^{-1}$]
Averages -1.77 -5.4 0.33 -1.87 -5.45 0.2
StdError 0.11 0.22 0.08 0.1 0.21 0.08
Median -2.36 -5.96 -0.49 -2.19 -5.98 -0.52
Mode -6.82 -16.12 -1.44 -5.78 -14.64 -2.46
StdDev 4.24 8.31 2.88 4 7.98 2.95
Variance 17.96 69 8.3 16.02 63.72 8.69
Kurtosis -0.27 0.15 1.69 0.18 0.71 12.87
Skweness 0.31 0.19 1.13 0.55 0.44 2.8
Range 21.12 44.34 19.45 22.68 49.59 23.48
Minimum -11.93 -28.58 -5.04 -11.46 -28.48 -4.89
Maximum 9.2 15.76 14.41 11.22 21.12 18.6
Sum -2593.32 -7900.77 481.01 -2735.48 -7966.76 294.29
Count 1463 1463 1463 1463 1463 1463
Confidence level (95%) 0.22 0.44 0.16 0.2 0.42 0.16

Error statistics for NEDC, UDC, and EUDC CO$_2$ emission [%]

In [8]:
#Create a dataframe with the NECD, UDC, EUDC error statistics
errorsDF = pd.DataFrame(index=['Averages','StdDev','Minimum','Maximum','Cases in ±4%','Cases in ±2.5%','P75-P25'], columns=['NEDC-H [%]','UDC-H [%]', 'EUDC-H [%]','NEDC-L [%]','UDC-L [%]', 'EUDC-L [%]'])
errorsDF.loc['Averages'] = pd.Series({'NEDC-H [%]':round(valuesDF['NEDC-H error [%]'].mean(),2), 'UDC-H [%]':round(valuesDF['UDC-H error [%]'].mean(),2), 'EUDC-H [%]':round(valuesDF['EUDC-H error [%]'].mean(),2),
                                     'NEDC-L [%]':round(valuesDF['NEDC-L error [%]'].mean(),2), 'UDC-L [%]':round(valuesDF['UDC-L error [%]'].mean(),2), 'EUDC-L [%]':round(valuesDF['EUDC-L error [%]'].mean(),2)})
errorsDF.loc['StdDev'] = pd.Series({'NEDC-H [%]':round(valuesDF['NEDC-H error [%]'].std(),2), 'UDC-H [%]':round(valuesDF['UDC-H error [%]'].std(),2), 'EUDC-H [%]':round(valuesDF['EUDC-H error [%]'].std(),2),
                                   'NEDC-L [%]':round(valuesDF['NEDC-L error [%]'].std(),2), 'UDC-L [%]':round(valuesDF['UDC-L error [%]'].std(),2), 'EUDC-L [%]':round(valuesDF['EUDC-L error [%]'].std(),2)})
errorsDF.loc['Minimum'] = pd.Series({'NEDC-H [%]':round(valuesDF['NEDC-H error [%]'].min(),2), 'UDC-H [%]':round(valuesDF['UDC-H error [%]'].min(),2), 'EUDC-H [%]':round(valuesDF['EUDC-H error [%]'].min(),2),
                                    'NEDC-L [%]':round(valuesDF['NEDC-L error [%]'].min(),2), 'UDC-L [%]':round(valuesDF['UDC-L error [%]'].min(),2), 'EUDC-L [%]':round(valuesDF['EUDC-L error [%]'].min(),2)})
errorsDF.loc['Maximum'] = pd.Series({'NEDC-H [%]':round(valuesDF['NEDC-H error [%]'].max(),2), 'UDC-H [%]':round(valuesDF['UDC-H error [%]'].max(),2), 'EUDC-H [%]':round(valuesDF['EUDC-H error [%]'].max(),2),
                                    'NEDC-L [%]':round(valuesDF['NEDC-L error [%]'].max(),2), 'UDC-L [%]':round(valuesDF['UDC-L error [%]'].max(),2), 'EUDC-L [%]':round(valuesDF['EUDC-L error [%]'].max(),2)})
errorsDF.loc['Cases in ±4%'] = pd.Series({'NEDC-H [%]':round(sum(abs(valuesDF['NEDC-H error [%]'])<4)/len(valuesDF['NEDC-H error [%]'])*100,1), 'UDC-H [%]':round(sum(abs(valuesDF['UDC-H error [%]'])<4)/len(valuesDF['UDC-H error [%]'])*100,1), 'EUDC-H [%]':round(sum(abs(valuesDF['EUDC-H error [%]'])<4)/len(valuesDF['EUDC-H error [%]'])*100,1),
                                         'NEDC-L [%]':round(sum(abs(valuesDF['NEDC-L error [%]'])<4)/len(valuesDF['NEDC-L error [%]'])*100,1), 'UDC-L [%]':round(sum(abs(valuesDF['UDC-L error [%]'])<4)/len(valuesDF['UDC-L error [%]'])*100,1), 'EUDC-L [%]':round(sum(abs(valuesDF['EUDC-L error [%]'])<4)/len(valuesDF['EUDC-L error [%]'])*100,1)})
errorsDF.loc['Cases in ±2.5%'] = pd.Series({'NEDC-H [%]':round(sum(abs(valuesDF['NEDC-H error [%]'])<2.5)/len(valuesDF['NEDC-H error [%]'])*100,1), 'UDC-H [%]':round(sum(abs(valuesDF['UDC-H error [%]'])<2.5)/len(valuesDF['UDC-H error [%]'])*100,1), 'EUDC-H [%]':round(sum(abs(valuesDF['EUDC-H error [%]'])<2.5)/len(valuesDF['EUDC-H error [%]'])*100,1),
                                           'NEDC-L [%]':round(sum(abs(valuesDF['NEDC-L error [%]'])<2.5)/len(valuesDF['NEDC-L error [%]'])*100,1), 'UDC-L [%]':round(sum(abs(valuesDF['UDC-L error [%]'])<2.5)/len(valuesDF['UDC-L error [%]'])*100,1), 'EUDC-L [%]':round(sum(abs(valuesDF['EUDC-L error [%]'])<2.5)/len(valuesDF['EUDC-L error [%]'])*100,1)})
errorsDF.loc['P75-P25'] = pd.Series({'NEDC-H [%]':round(np.percentile(valuesDF['NEDC-H error [%]'],75)-np.percentile(valuesDF['NEDC-H error [%]'],25),2), 'UDC-H [%]':round(np.percentile(valuesDF['UDC-H error [%]'],75)-np.percentile(valuesDF['UDC-H error [%]'],25),2), 'EUDC-H [%]':round(np.percentile(valuesDF['EUDC-H error [%]'],75)-np.percentile(valuesDF['EUDC-H error [%]'],25),2),
                                     'NEDC-L [%]':round(np.percentile(valuesDF['NEDC-L error [%]'],75)-np.percentile(valuesDF['NEDC-L error [%]'],25),2), 'UDC-L [%]':round(np.percentile(valuesDF['UDC-L error [%]'],75)-np.percentile(valuesDF['UDC-L error [%]'],25),2), 'EUDC-L [%]':round(np.percentile(valuesDF['EUDC-L error [%]'],75)-np.percentile(valuesDF['EUDC-L error [%]'],25),2)})

errorsDF
Out[8]:
NEDC-H [%] UDC-H [%] EUDC-H [%] NEDC-L [%] UDC-L [%] EUDC-L [%]
Averages -1.07 -2.6 0.26 -1.1 -2.64 0.22
StdDev 2.39 3.8 2.2 2.44 3.73 2.57
Minimum -6.16 -13.83 -3.68 -6.54 -14.51 -3.67
Maximum 8.26 7.67 15.54 10.88 10.69 19.73
Cases in ±4% 89.4 60.7 96.9 91.7 56.3 97.8
Cases in ±2.5% 59.5 24.4 84.8 61 29.9 89.9
P75-P25 3.4 4.35 2.68 2.86 3.62 1.99

Distribution of the NEDC, UDC and EUDC errors [%]

In [9]:
mydict = ([('NEDC', 0), ('UDC', 1), ('EUDC', 2)])
mydict = collections.OrderedDict(mydict)
for cycle in mydict:
    if cycle == 'NEDC':
        boxcolor = 'green'
    elif cycle == 'UDC':
        boxcolor = 'blue'
    else:
        boxcolor = 'red'
    # Create a figure instance
    fig = plt.figure(1, figsize=(14, 7))
    # Create an axes instance
    ax = fig.add_subplot(111)
    hist = valuesDF[cycle+'-H error [%]'].hist(bins=np.arange(min(valuesDF['UDC-H error [%]']), max(valuesDF['UDC-H error [%]']) + 0.5, 0.5), color=boxcolor, label = 'High')
    hist = valuesDF[cycle+'-L error [%]'].hist(bins=np.arange(min(valuesDF['UDC-L error [%]']), max(valuesDF['UDC-L error [%]']) + 0.5, 0.5), color=boxcolor, alpha = 0.5, label = 'Low')
    hist.set_xlabel(cycle+" error [%]",fontsize=14)
    hist.set_ylabel("frequency",fontsize=14)
    
    hist.legend(prop={'size': 15})
    
    hist.set_ylim(0,350)
    plt.title(cycle+' CO$_2$ emission error distribution', fontsize=20)
    plt.ylabel("frequency",fontsize=18)
    plt.tick_params(axis='x', which='major', labelsize=16)
    plt.tick_params(axis='y', which='major', labelsize=16)
    ax.get_xaxis().tick_bottom()
    ax.get_yaxis().tick_left()
    ax.set_xlim(-20, 20)
    plt.show()

Comparative emission error per driving cycle (gCO$_2$ km$^{-1}$)

In [10]:
#Alternatively show boxplots
toboxplot = [valuesDF['NEDC-H error [%]'],valuesDF['NEDC-L error [%]'],valuesDF['UDC-H error [%]'],valuesDF['UDC-L error [%]'],
            valuesDF['EUDC-H error [%]'],valuesDF['EUDC-L error [%]']]

# Create a figure instance
fig = plt.figure(1, figsize=(14, 7))
# Create an axes instance
ax = fig.add_subplot(111)
# Create the boxplot with fill color
bp = ax.boxplot(toboxplot, sym='', patch_artist=True, whis=10000, showmeans=True, meanprops=(dict(marker='o',markerfacecolor='yellow')))
for box in bp['boxes']:
    # change outline color
    box.set( color='black', linewidth=1)
    # change fill color
    box.set( facecolor = '#b78adf' )
    ## Custom x-axis labels
ax.set_xticklabels(['NEDC-H','NEDC-L', 'UDC-H','UDC-L','EUDC-H','EUDC-L'],fontsize=20)
## Remove top axes and right axes ticks
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
#Set y axis title
plt.title('CO$_2$ emission error by driving cycle', fontsize=20)
plt.ylabel("error [%]",fontsize=18)
plt.tick_params(axis='y', which='major', labelsize=16)
ax.set_ylim(-25, 25)
plt.setp(bp['medians'], color = 'purple', linewidth = 2)
plt.show()
print('The purple box represents the 1st and 3rd quartile.\nThe dark purple line is the median.\nThe yellow dot is the mean.\nthe whiskers show the min and max values.')
The purple box represents the 1st and 3rd quartile.
The dark purple line is the median.
The yellow dot is the mean.
the whiskers show the min and max values.

Error statistics per technology type

In [11]:
#Create a dataframe with the NECD, UDC, EUDC and vehicle model and case
CarMod = pd.DataFrame({'dNEDCh':valuesDF.dNEDCh,'dUDCh':valuesDF.dUDCh,'dEUDCh':valuesDF.dEUDCh,'dNEDCl':valuesDF.dNEDCl,'dUDCl':valuesDF.dUDCl,'dEUDCl':valuesDF.dEUDCl,'Model':valuesDF.Model,'Case':valuesDF.Case})         
In [12]:
#Print a dictionary with the tested technologies and their identification codes
tec = pd.DataFrame(index=['Base case','Gear configuration A','Gear configuration B','No Start/Stop','No Break energy recuperation','Variable valve lifting','Direct injection/Multipoint injection','No Lean Burn','Thermal management'])
tec['Technology code'] = ['BC','GCA','GCB','NOSS','NOBERS','VVL','DI/MPI','NOLB','ThM']
tec.columns.name='Technology type'
tec
Out[12]:
Technology type Technology code
Base case BC
Gear configuration A GCA
Gear configuration B GCB
No Start/Stop NOSS
No Break energy recuperation NOBERS
Variable valve lifting VVL
Direct injection/Multipoint injection DI/MPI
No Lean Burn NOLB
Thermal management ThM
In [13]:
#Function that assigns the number of case to the specific technology tested for each vehicle model

def assign_technol_perCarAndCase(df):
    #looks for the case # in the input file and assigns a technology
    df_basecase = df[CarMod['Case'] <= 27]
    df_basecase.loc[:,'Tecno'] = 'BC'
    #some vehicles have more possible technologies than others (extrashort, short, long, extralong) and an additional technology assignment is performed for the groups that have it
    In_extrashort = (CarMod['Model'] == 'Vehicle05')
    In_short = (CarMod['Model'] == 'Vehicle06')|(CarMod['Model'] == 'Vehicle08')| (CarMod['Model'] == 'Vehicle02')| (CarMod['Model'] == 'Vehicle04')
    In_long = (CarMod['Model'] == 'Vehicle01') | (CarMod['Model'] == 'Vehicle07')
    In_extralong = (CarMod['Model'] == 'Vehicle03')
    #assign technologies per car group
    I_gbc1 = (CarMod['Case'] >= 28) & (CarMod['Case'] <= 54)
    I_gbcA = (I_gbc1 & In_short) | (I_gbc1 & In_long) | (I_gbc1 & In_extralong)
    df_gbcA = df[I_gbcA]
    df_gbcA.loc[:,'Tecno'] = 'GCA'
    I_gbc2 = (CarMod['Case'] >= 55) & (CarMod['Case'] <= 81)
    I_gbcB = (I_gbc2 & In_short) |(I_gbc2 & In_long) | (I_gbc2 & In_extralong)
    df_gbcB = df[I_gbcB]
    df_gbcB.loc[:,'Tecno'] = 'GCB'
    I_noss_reg = (CarMod['Case'] >= 82) & (CarMod['Case'] <= 108)
    I_noss_extrashort = (CarMod['Case'] >= 28) & (CarMod['Case'] <= 54)
    I_noss = (I_noss_extrashort & In_extrashort) | (I_noss_reg & In_short)| (I_noss_reg & In_long) | (I_noss_reg & In_extralong)
    df_noss = df[I_noss]
    df_noss.loc[:,'Tecno'] = 'NOSS'
    I_nobers_reg = (CarMod['Case'] >= 109) & (CarMod['Case'] <= 135)
    I_nobers_extrashort = (CarMod['Case'] >= 55) & (CarMod['Case'] <= 81)
    I_nobers = (I_nobers_extrashort & In_extrashort) | (I_nobers_reg & In_short)| (I_nobers_reg & In_long) | (I_nobers_reg & In_extralong)
    df_nobers = df[I_nobers]
    df_nobers.loc[:,'Tecno'] = 'NOBERS'
    I_vvl_reg = (CarMod['Case'] >= 136) & (CarMod['Case'] <= 162)
    I_vvl_extrashort = (CarMod['Case'] >= 82) & (CarMod['Case'] <= 108)
    I_vvl = (I_vvl_extrashort & In_extrashort) | (I_vvl_reg & In_long)| (I_vvl_reg & In_extralong)
    df_vvl = df[I_vvl]
    df_vvl.loc[:,'Tecno'] = 'VVL'
    I_dimpi_reg = (CarMod['Case'] >= 163) & (CarMod['Case'] <= 189)
    I_dimpi_extrashort = (CarMod['Case'] >= 109) & (CarMod['Case'] <= 135)
    I_dimpi = (I_dimpi_extrashort & In_extrashort) | (I_dimpi_reg & In_long)| (I_dimpi_reg & In_extralong)
    df_dimpi = df[I_dimpi]
    df_dimpi.loc[:,'Tecno'] = 'DI/MPI'
    I_nolb_extralong = (CarMod['Case'] >= 190) & (CarMod['Case'] <= 216)
    I_nolb = (I_nolb_extralong & In_extralong)
    df_nolb = df[I_nolb]
    df_nolb.loc[:,'Tecno'] = 'NOLB'
    I_extrashort_tm = (CarMod['Case'] >= 136)
    I_short_tm = (CarMod['Case'] >= 136)
    I_long_tm = (CarMod['Case'] >= 190)
    I_extralong_tm = (CarMod['Case'] >= 244)
    I_tm = (In_extrashort & I_extrashort_tm) | (In_short & I_short_tm)|(In_long & I_long_tm) | (In_extralong & I_extralong_tm)
    df_tm = df[I_tm]
    df_tm.loc[:,'Tecno'] = 'ThM'
    #Append to the original DF a column with the technology IDcode
    pd.options.mode.chained_assignment = None  # default='warn'
    bigdata = pd.concat([df_basecase,df_gbcA,df_gbcB,df_noss,df_nobers,df_vvl,df_dimpi,df_nolb,df_tm], ignore_index=False)
    return bigdata
In [14]:
#Plot the NEDC errors per technology type in a boxplot
tech = assign_technol_perCarAndCase(valuesDF)
techBC = tech[tech['Tecno'] == 'BC']
techGCA = tech[tech['Tecno'] == 'GCA']
techGCB = tech[tech['Tecno'] == 'GCB']
techNOSS = tech[tech['Tecno'] == 'NOSS']
techBERS = tech[tech['Tecno'] == 'NOBERS']
techVVL = tech[tech['Tecno'] == 'VVL']
techDIMPI = tech[tech['Tecno'] == 'DI/MPI']
techNOLB = tech[tech['Tecno'] == 'NOLB']
techThM = tech[tech['Tecno'] == 'ThM']
mydict = ([('NEDC', 0), ('UDC', 1), ('EUDC', 2)])
mydict = collections.OrderedDict(mydict)
for cycle in mydict:
    techboxplot = [techBC[cycle+'-H error [%]'],techGCA[cycle+'-H error [%]'],techGCB[cycle+'-H error [%]'],techNOSS[cycle+'-H error [%]'],techBERS[cycle+'-H error [%]'],techVVL[cycle+'-H error [%]'],techDIMPI[cycle+'-H error [%]'],techNOLB[cycle+'-H error [%]'],techThM[cycle+'-H error [%]']]
    if cycle == 'NEDC':
        boxcolor = 'green'
    elif cycle == 'UDC':
        boxcolor = 'blue'
    else:
        boxcolor = 'red'
    # Create a figure instance
    fig = plt.figure(1, figsize=(14, 7))
    # Create an axes instance
    ax = fig.add_subplot(111)
    # Create the boxplot with fill color
    bp = ax.boxplot(techboxplot, sym='', patch_artist=True, whis=10000, showmeans=True, meanprops=(dict(marker='o',markerfacecolor='yellow')))
    for box in bp['boxes']:
        # change outline color
        box.set( color='black', linewidth=1)
        # change fill color
        box.set(facecolor = boxcolor)            
        ## Custom x-axis labels
    ax.set_xticklabels(['BC', 'GCA', 'GCB','NOSS','NOBERS','VVL','DI/MPI','NOLB','ThM'],fontsize=20)
    ## Remove top axes and right axes ticks
    ax.get_xaxis().tick_bottom()
    ax.get_yaxis().tick_left()
    #Set y axis title
    plt.title(cycle+'-H CO$_2$ emission error by technology type', fontsize=20)
    plt.ylabel("error [%]",fontsize=18)
    plt.tick_params(axis='y', which='major', labelsize=18)
    ax.set_ylim(-20, 20)
    plt.setp(bp['medians'], color = 'purple', linewidth = 2)
    plt.show()
    print('The green box represents the 1st and 3rd quartile.\nThe dark purple line is the median.\nThe yellow dot is the mean.\nthe whiskers show the min and max values.')
    print('\nDescriptive statistics for '+cycle+'-H CO2 emission error per technology type')
    grouped = tech.groupby('Tecno')
#     gmean = grouped['d'+cycle+'h'].mean()
    gmean = grouped[cycle+'-H error [%]'].mean()
    gsem = grouped[cycle+'-H error [%]'].sem()
    gmedian = grouped[cycle+'-H error [%]'].median()
    gstd = grouped[cycle+'-H error [%]'].std()
    gvar = grouped[cycle+'-H error [%]'].var()
    gskew = grouped[cycle+'-H error [%]'].skew()
    grange = grouped[cycle+'-H error [%]'].max()-grouped.dNEDCh.min()
    gmin = grouped[cycle+'-H error [%]'].min()
    gmax = grouped[cycle+'-H error [%]'].max()
    gsum = grouped[cycle+'-H error [%]'].sum()
    gcount = grouped[cycle+'-H error [%]'].count()
    gCI95 = 2*grouped[cycle+'-H error [%]'].sem()
    errorsTec = pd.DataFrame(index=['Averages','StdError','Median','StdDev','Variance','Kurtosis','Skweness','Range','Minimum','Maximum','Sum','Count','Confidence level (95%)'], columns=['BC','GCA', 'GCB','NOSS','NOBERS','VVL','DI/MPI','NOLB','ThM'])
    errorsTec.loc['Averages'] = pd.Series.round(gmean,2)
    errorsTec.loc['StdError'] = pd.Series.round(gsem,2)
    errorsTec.loc['Median'] = pd.Series.round(gmedian,2)
    errorsTec.loc['StdDev'] = pd.Series.round(gstd,2)
    errorsTec.loc['Variance'] = pd.Series.round(gvar,2)
    errorsTec.loc['Kurtosis'] = [round(techBC[cycle+'-H error [%]'].kurtosis(),2),round(techGCA[cycle+'-H error [%]'].kurtosis(),2),round(techGCB[cycle+'-H error [%]'].kurtosis(),2),round(techNOSS[cycle+'-H error [%]'].kurtosis(),2),round(techBERS[cycle+'-H error [%]'].kurtosis(),2),round(techVVL[cycle+'-H error [%]'].kurtosis(),2),round(techDIMPI[cycle+'-H error [%]'].kurtosis(),2),round(techNOLB[cycle+'-H error [%]'].kurtosis(),2),round(techThM[cycle+'-H error [%]'].kurtosis(),2)]
    errorsTec.loc['Skweness'] = pd.Series.round(gskew,2)
    errorsTec.loc['Range'] = pd.Series.round(grange,2)
    errorsTec.loc['Minimum'] = pd.Series.round(gmin,2)
    errorsTec.loc['Maximum'] = pd.Series.round(gmax,2)
    errorsTec.loc['Sum'] = pd.Series.round(gsum)
    errorsTec.loc['Count'] = pd.Series.round(gcount)
    errorsTec.loc['Confidence level (95%)'] = pd.Series.round(gCI95,2)
    errorsTec.columns.name=cycle+'-H error'
    display(errorsTec)
C:\Apps\co2mpas_AIO-v1.5.4\Apps\WinPython\python-3.5.2.amd64\lib\site-packages\pandas\core\indexing.py:296: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[key] = _infer_fill_value(value)
C:\Apps\co2mpas_AIO-v1.5.4\Apps\WinPython\python-3.5.2.amd64\lib\site-packages\pandas\core\indexing.py:476: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
The green box represents the 1st and 3rd quartile.
The dark purple line is the median.
The yellow dot is the mean.
the whiskers show the min and max values.

Descriptive statistics for NEDC-H CO2 emission error per technology type
NEDC-H error BC GCA GCB NOSS NOBERS VVL DI/MPI NOLB ThM
Averages -0.95 0.07 -0.4 -0.32 -3.12 -1.81 -2.05 -2.41 -0.33
StdError 0.13 0.16 0.2 0.16 0.14 0.15 0.14 0.14 0.17
Median -1.58 0.1 0.22 -1.04 -3.89 -2 -2.3 -2.57 -1.23
StdDev 1.97 2.19 2.49 2.29 2.05 1.6 1.44 0.74 2.52
Variance 3.89 4.8 6.18 5.23 4.2 2.57 2.07 0.55 6.35
Kurtosis -0.7 -1.16 -1.23 -0.82 -0.74 -0.93 0.29 -0.97 -0.01
Skweness 0.47 0.18 -0.44 0.65 0.63 0.37 0.7 0.43 0.8
Range 11.59 11.41 13.58 12.18 13.07 10.27 10.92 5.38 16.07
Minimum -4.38 -3.92 -5.31 -4.2 -6.16 -4.21 -4.58 -3.59 -4
Maximum 3.12 3.9 3.12 4.48 1.15 2.34 2.01 -1.15 8.26
Sum -214 13 -65 -69 -671 -196 -222 -65 -70
Count 224 189 162 216 215 108 108 27 214
Confidence level (95%) 0.26 0.32 0.39 0.31 0.28 0.31 0.28 0.29 0.34
The green box represents the 1st and 3rd quartile.
The dark purple line is the median.
The yellow dot is the mean.
the whiskers show the min and max values.

Descriptive statistics for UDC-H CO2 emission error per technology type
UDC-H error BC GCA GCB NOSS NOBERS VVL DI/MPI NOLB ThM
Averages -2.21 -0.74 -0.57 -0.98 -6.01 -4.43 -4.31 -4.56 -2.33
StdError 0.2 0.26 0.34 0.27 0.23 0.18 0.19 0.24 0.21
Median -2.73 -1.01 -0.6 -2.27 -6.35 -4.46 -3.95 -4.97 -2.88
StdDev 3.01 3.52 4.29 3.94 3.34 1.86 1.96 1.24 3.07
Variance 9.05 12.4 18.43 15.5 11.16 3.46 3.82 1.53 9.42
Kurtosis -0.37 -1.01 -1.12 -0.66 -0.68 -0.6 -0.94 -1.26 -0.28
Skweness 0.39 0.16 -0.08 0.75 -0.13 0.09 -0.22 0.49 0.56
Range 12.47 14.53 18.13 14.5 11.69 7.69 9.15 4.23 11.85
Minimum -7.82 -7.51 -8.8 -9.39 -13.83 -8.45 -8.51 -6.15 -8.08
Maximum 4 7.02 7.67 6.8 -0.24 -0.25 0.23 -2.3 4.03
Sum -495 -140 -92 -212 -1292 -478 -466 -123 -499
Count 224 189 162 216 215 108 108 27 214
Confidence level (95%) 0.4 0.51 0.67 0.54 0.46 0.36 0.38 0.48 0.42
The green box represents the 1st and 3rd quartile.
The dark purple line is the median.
The yellow dot is the mean.
the whiskers show the min and max values.

Descriptive statistics for EUDC-H CO2 emission error per technology type
EUDC-H error BC GCA GCB NOSS NOBERS VVL DI/MPI NOLB ThM
Averages 0.11 0.83 -0.11 0.44 -0.74 0.36 -0.18 -0.37 1.28
StdError 0.11 0.13 0.14 0.11 0.11 0.17 0.17 0.14 0.25
Median -0.46 0.16 -0.44 -0.07 -1.28 0.03 -0.8 -0.28 -0.25
StdDev 1.7 1.73 1.78 1.66 1.59 1.8 1.8 0.71 3.73
Variance 2.91 2.99 3.18 2.77 2.52 3.24 3.22 0.5 13.9
Kurtosis -0.77 -1.12 0.88 -0.96 -1.01 -0.96 0.91 -1.32 3.22
Skweness 0.47 0.54 0.99 0.44 0.43 -0.02 1.08 -0.15 1.91
Range 13.63 11.7 16.58 12.76 14.71 12.36 15.36 7.29 23.35
Minimum -2.63 -1.69 -2.31 -2.39 -3.68 -2.91 -2.68 -1.55 -2.3
Maximum 5.16 4.19 6.11 5.06 2.78 4.42 6.45 0.75 15.54
Sum 26 156 -18 95 -158 39 -20 -10 274
Count 224 189 162 216 215 108 108 27 214
Confidence level (95%) 0.23 0.25 0.28 0.23 0.22 0.35 0.35 0.27 0.51
In [15]:
#Avoid using seaborn templates and go back to matplotlib templates
mpl.rcParams.update(inline_rc)

Section 2. Performance of the model. Statistics per vehicle model and case test.

Glossary of vehicle models and number of test cases considered in the report

In [16]:
mod_cases_stats = valuesDF.groupby(['Model'],as_index=False).count() 
mod_cases_stats['Brand and model'] = ['Vehicle 01','Vehicle 02','Vehicle 03','Vehicle 04','Vehicle 05','Vehicle 06','Vehicle 07', 'Vehicle 08']
cols = mod_cases_stats.columns.tolist()
cols = cols[-1:] + cols[:2]
mod_cases_stats = mod_cases_stats[cols]
mod_cases_stats
Out[16]:
Brand and model Model Case
0 Vehicle 01 Vehicle01 216
1 Vehicle 02 Vehicle02 163
2 Vehicle 03 Vehicle03 244
3 Vehicle 04 Vehicle04 135
4 Vehicle 05 Vehicle05 163
5 Vehicle 06 Vehicle06 163
6 Vehicle 07 Vehicle07 217
7 Vehicle 08 Vehicle08 162

NEDC, UDC, and EUDC CO$_2$ emission error per vehicle model

In [17]:
#In order to create statistic tables and plots for each model car, a numeric car ID 'cid' has to be assigned to each vehicle
tech = assign_technol_perCarAndCase(valuesDF)
Carlist = list(sorted(tech['Model'].unique()))
Cidlist = list(range(len(Carlist)))
tech.cid = tech['Model'].replace(Carlist, Cidlist, regex = True)
tech['cod'] = tech.cid
dictecnos = {'BC':'o', 'GCA':'s', 'GCB':'v', 'NOSS':'p','NOBERS':'D','VVL':'4','DI/MPI':'+','NOLB':'h','ThM':'*'}
#Create a table with the error statistics for each car model
for x in Carlist:
    Car = tech[tech['Model'] == x]
    grouped = Car.groupby('Tecno')
    CarDF = pd.DataFrame(index=['Averages','Median', 'StdDev'], columns=['NEDC-H [gCO$_2$ km$^{-1}$]','UDC-H [gCO$_2$ km$^{-1}$]', 'EUDC-H [gCO$_2$ km$^{-1}$]'])
    CarDF.loc['Averages'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(Car.dNEDCh.mean(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(Car.dUDCh.mean(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(Car.dEUDCh.mean(),2)})
    CarDF.loc['Median'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(Car.dNEDCh.median(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(Car.dUDCh.median(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(Car.dEUDCh.median(),2)})
    CarDF.loc['StdDev'] = pd.Series({'NEDC-H [gCO$_2$ km$^{-1}$]':round(Car.dNEDCh.std(),2), 'UDC-H [gCO$_2$ km$^{-1}$]':round(Car.dUDCh.std(),2), 'EUDC-H [gCO$_2$ km$^{-1}$]':round(Car.dEUDCh.std(),2)})
    CarDF.columns.name=Car.iat[0,5]
    display(CarDF)
    
    CarDFF = pd.DataFrame(index=['Averages','Median', 'StdDev'], columns=['NEDC-H [%]','NEDC-L [%]'])
    CarDFF.loc['Averages'] = pd.Series({'NEDC-H [%]':round(Car['NEDC-H error [%]'].mean(),2), 'NEDC-L [%]':round(Car['NEDC-L error [%]'].mean(),2)})
    CarDFF.loc['Median'] = pd.Series({'NEDC-H [%]':round(Car['NEDC-H error [%]'].median(),2), 'NEDC-L [%]':round(Car['NEDC-L error [%]'].median(),2)})
    CarDFF.loc['StdDev'] = pd.Series({'NEDC-H [%]':round(Car['NEDC-H error [%]'].std(),2), 'NEDC-L [%]':round(Car['NEDC-L error [%]'].std(),2)})
    CarDFF.columns.name=Car.iat[0,5]
    display(CarDFF)
    #plot the CO2 emission error histogram per vehicle model and cycle
    mydict = ([('NEDC', 0), ('UDC', 1), ('EUDC', 2)])
    mydict = collections.OrderedDict(mydict)
    for cycle in mydict:
        if cycle == 'NEDC':
            boxcolor = 'green'
        elif cycle == 'UDC':
            boxcolor = 'blue'
        else:
            boxcolor = 'red'
        fig = plt.figure(1, figsize=(14, 7))
        plt.title(Car.iat[0,5],fontsize=20)
        plot = fig.add_subplot(111)
        plot.tick_params(axis='x', which='major', labelsize=14)
        plot.tick_params(axis='y', which='major', labelsize=14)
        plot.set_xlim(-20, 20)
        plot.get_xaxis().tick_bottom()
        plot.get_yaxis().tick_left()
        car_hist = Car[cycle+'-H error [%]'].hist(bins=25, color=boxcolor)
        car_hist.set_xlabel(cycle+" CO$_2$ emission error [%]",fontsize=20)
        car_hist.set_ylabel("frequency",fontsize=20)
        plt.show()
    #plot the emission error per case, model, and cycle
        fig = plt.figure(1, figsize=(14, 7))
        plt.title(Car.iat[0,5],fontsize=20)
        plot = fig.add_subplot(111)
        plot.tick_params(axis='x', which='major', labelsize=14)
        plot.tick_params(axis='y', which='major', labelsize=14)
        plot.set_xlim(0, 240)
        plot.set_ylim(-20,20)
        plot.get_xaxis().tick_bottom()
        plot.get_yaxis().tick_left()
        for key, group in grouped:
            plt.plot(group['Case'], group[cycle+'-H error [%]'], color=boxcolor, marker=dictecnos[key], label = key, linestyle='')
            first_legend = plt.legend(numpoints=1, bbox_to_anchor=(1.0, 1.), loc=1, borderaxespad=0.)
            plot.ax = plt.gca().add_artist(first_legend)
        plot.set_xlabel("Case #",fontsize=20)
        plot.set_ylabel(cycle+" error [%]",fontsize=20)
        line1 = plot.axhline(y=-2.5, color='grey', linestyle='-.', label='± 2.5 %')
        line2 = plot.axhline(y=2.5, color='grey', linestyle='-.')
        line3 = plot.axhline(y=-4, color='black', linestyle='--', label='± 4.0 %')
        line4 = plot.axhline(y=4, color='black', linestyle='--')
        plt.legend(handles=[line1, line3], loc = 3)
        plt.show()
Vehicle01 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages -2.68 -3.63 -2.13
Median -3.91 -6.39 -2.38
StdDev 3.38 8.11 1.16
Vehicle01 NEDC-H [%] NEDC-L [%]
Averages -1.6 -0.78
Median -2.36 -1.78
StdDev 2.01 2.41
Vehicle02 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages -3.94 -8.29 -1.41
Median -3.44 -7.55 -1.04
StdDev 1.9 3.52 1.27
Vehicle02 NEDC-H [%] NEDC-L [%]
Averages -2.42 -3.33
Median -2.13 -3.16
StdDev 1.16 1.03
Vehicle03 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages -1.06 -5.96 1.77
Median -0.87 -5.98 1.65
StdDev 2.05 3.27 1.95
Vehicle03 NEDC-H [%] NEDC-L [%]
Averages -0.61 -0.86
Median -0.53 -0.89
StdDev 1.17 0.98
Vehicle04 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages -3.37 -6 -1.84
Median -2.8 -4.94 -1.55
StdDev 1.39 2.66 0.74
Vehicle04 NEDC-H [%] NEDC-L [%]
Averages -2.31 -1.83
Median -1.95 -1.46
StdDev 0.95 0.93
Vehicle05 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages -0.41 -6.6 3.14
Median -0.5 -6.34 2.26
StdDev 2.93 4.38 3.33
Vehicle05 NEDC-H [%] NEDC-L [%]
Averages -0.34 0.06
Median -0.45 -0.8
StdDev 2.71 3.91
Vehicle06 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages 5.52 7.28 4.51
Median 5.65 7.69 4.42
StdDev 2.17 4.61 1.43
Vehicle06 NEDC-H [%] NEDC-L [%]
Averages 2.69 1.93
Median 2.78 1.89
StdDev 1.05 1.03
Vehicle07 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages -7.37 -17.46 -1.53
Median -6.87 -16.55 -1.41
StdDev 1.85 4.2 0.86
Vehicle07 NEDC-H [%] NEDC-L [%]
Averages -3.72 -3.29
Median -3.52 -3.09
StdDev 0.91 0.95
Vehicle08 NEDC-H [gCO$_2$ km$^{-1}$] UDC-H [gCO$_2$ km$^{-1}$] EUDC-H [gCO$_2$ km$^{-1}$]
Averages 0.67 1.09 0.44
Median 0.8 1.43 0.22
StdDev 2.39 4.88 1.7
Vehicle08 NEDC-H [%] NEDC-L [%]
Averages 0.42 -0.34
Median 0.49 -0.24
StdDev 1.46 1.39