Graphics - MIMO Study



In [1]:
# Import the needed packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from Algorithms import cm2in
from Algorithms import TUBScolorscale

# Plot width and heigth in cm
plot_width = 19.
plot_height = 7.5

In [2]:
# Open the data file
# Read the Data
Data = pd.read_csv('./Data/H05_TICONST.csv', sep=';')
# Define the studyname
export_folder = "../Latex/Graphics/MIMO_"
model_name = "H05_TICONST"
# Give the Columns
Data.columns


Out[2]:
Index([u'Unnamed: 0', u'Degree', u'MS_RGA', u'w_MS_RGA', u'Grad_RGA', u'MS_A',
       u'w_MS_A', u'Grad_A', u'MS_D', u'w_MS_D', u'Grad_D', u'w_0.01_RGA',
       u'w_0.01_A', u'w_0.01_D', u'w_0.02_RGA', u'w_0.02_A', u'w_0.02_D',
       u'w_0.1_RGA', u'w_0.1_A', u'w_0.1_D', u'w_0.00666666666667_RGA',
       u'w_0.00666666666667_A', u'w_0.00666666666667_D', u'w_0.005_RGA',
       u'w_0.005_A', u'w_0.005_D'],
      dtype='object')

In [3]:
# Histogram
# Make a plot
plt.clf()
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')
# Make a plot
plt.clf()
fig, ax = plt.subplots(1,2, figsize=cm2in(plot_width, plot_height))

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['MS_RGA']
    # Scatter
    # Histogram
    ax[0].hist(x.values,bins = np.linspace(1,2,600), histtype='bar',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[0].set_xlabel('$\overline{\sigma}$')
ax[0].set_ylabel('Samples')
ax[0].set_xlim(1,2)
#ax[0].set_ylim(0,300)
ax[0].set_yscale('log')

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['w_MS_RGA']
    # Scatter
    # Histogram
    ax[1].hist(x.values,bins = np.logspace(-3,1,600), histtype='stepfilled',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[1].set_xlabel('$\omega(\overline{\sigma})$')
ax[1].set_ylabel('Samples')
ax[1].set_xscale('log')
ax[1].set_xlim(0,1)

plt.grid(True)
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.4,0.1))
plt.savefig(export_folder+model_name+"_MS_RGA.svg")
plt.show()


<matplotlib.figure.Figure at 0x9bbf828>

In [4]:
# Histogram
# Make a plot
plt.clf()
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')
# Make a plot
plt.clf()
fig, ax = plt.subplots(1,2, figsize=cm2in(plot_width, plot_height))

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['MS_A']
    # Scatter
    # Histogram
    ax[0].hist(x.values,bins = np.linspace(1,2,600), histtype='bar',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[0].set_xlabel('$\overline{\sigma}$')
ax[0].set_ylabel('Samples')
ax[0].set_xlim(1,2)
#ax[0].set_ylim(0,300)
ax[0].set_yscale('log')
# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['w_MS_A']
    # Scatter
    # Histogram
    ax[1].hist(x.values,bins = np.logspace(-3,1,600), histtype='stepfilled',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[1].set_xlabel('$\omega(\overline{\sigma})$')
ax[1].set_ylabel('Samples')
ax[1].set_xscale('log')
ax[1].set_xlim(0,1)

plt.grid(True)
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.4,0.1))
plt.savefig(export_folder+model_name+"_MS_A.svg")
plt.show()


<matplotlib.figure.Figure at 0xa097ba8>

In [5]:
# Histogram
# Make a plot
plt.clf()
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')
# Make a plot
plt.clf()
fig, ax = plt.subplots(1,2, figsize=cm2in(plot_width, plot_height))

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['MS_D']
    # Scatter
    # Histogram
    ax[0].hist(x.values,bins = np.linspace(1,2,600), histtype='bar',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[0].set_xlabel('$\overline{\sigma}$')
ax[0].set_ylabel('Samples')
ax[0].set_xlim(1,2)
#ax[0].set_ylim(0,200)
ax[0].set_yscale('log')
# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['w_MS_D']
    # Scatter
    # Histogram
    ax[1].hist(x.values,bins = np.logspace(-3,1,600), histtype='stepfilled',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[1].set_xlabel('$\omega(\overline{\sigma})$')
ax[1].set_ylabel('Samples')
ax[1].set_xscale('log')
ax[1].set_xlim(0,1)

plt.grid(True)
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.4,0.1))
plt.savefig(export_folder+model_name+"_MS_R2D2.svg")
plt.show()


<matplotlib.figure.Figure at 0xa065320>

In [6]:
# Histogram
# Make a plot
plt.clf()
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')
# Make a plot
plt.clf()
fig, ax = plt.subplots(1,3, figsize=cm2in(plot_width, plot_height), sharey=True)

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['Grad_RGA']
    # Scatter
    # Histogram
    ax[0].hist(x.values,bins = np.linspace(0,2,500), histtype='bar',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[0].set_xlabel('$d\overline{\sigma}_{\omega}$')
ax[0].set_ylabel('Samples')
ax[0].set_xlim(0,2)
#ax[0].set_ylim(0,200)

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['Grad_A']
    # Scatter
    # Histogram
    ax[1].hist(x.values,bins = np.linspace(0,2,500), histtype='stepfilled',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[1].set_xlabel('$d\overline{\sigma}_{\omega}$')
ax[1].set_ylabel('Samples')
#ax[1].set_xscale('log')
ax[1].set_xlim(0,2)

# Data
for cur_order in range(1,10):
    x = Data[((Data['Degree'] == cur_order))]['Grad_D']
    # Scatter
    # Histogram
    ax[2].hist(x.values,bins = np.linspace(0,2,500), histtype='stepfilled',normed = False, label = 'Order '+str(cur_order),edgecolor = None, alpha = 0.8, color = TUBScolorscale[cur_order])
    #ax.scatter(x,y, color = TUBScolorscale[cur_order])
ax[2].set_xlabel('$d\overline{\sigma}_{\omega}$')
ax[2].set_ylabel('Samples')
#ax[1].set_xscale('log')
ax[2].set_xlim(0,2)


ax[0].set_title('RGA')
ax[1].set_title('Astr\\"om')
ax[2].set_title('R2D2')
plt.grid(True)
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.7,0.1))
plt.savefig(export_folder+model_name+"_GradMS.svg")
plt.show()


<matplotlib.figure.Figure at 0xbc8cb38>

In [3]:
# Make a histogram
from scipy.stats import norm
# Make a plot
plt.clf()
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

fig, ax = plt.subplots(3, sharex=True, figsize = cm2in(plot_width,3*plot_height))

# RGA
# Add all samples
x = np.sort(Data['MS_RGA'])
y = np.array(range(len(x)))/float(len(x))
ax[0].plot(x,y, color = TUBScolorscale[0], linestyle = 'dashed', label="All samples")
# Find the value for y = 0.8, meaning 80 percent of all samples
y_rob = np.argmax(y[:]>.8)
ms_rob = x[y_rob]
y_rob= y[y_rob]

ax[0].axvspan(np.min(x),ms_rob, color ='green', alpha =0.2)
ax[0].axvspan(ms_rob,np.max(x), color ='red', alpha =0.2)

for cur_order in range(1,10):
    x = np.sort(Data[((Data['Degree'] == cur_order))]['MS_RGA'])
    # Get the cdf
    y = np.array(range(len(x)))/float(len(x))
    ax[0].plot(x,y, color = TUBScolorscale[cur_order], label="Order "+str(cur_order))
# Add all samples
x = np.sort(Data['MS_RGA'])
y = np.array(range(len(x)))/float(len(x))
ax[0].plot(x,y, color = TUBScolorscale[0], linestyle = 'dashed', label="All samples")
#ax.hist(x, 500, normed=1, histtype='stepfilled',stacked= True, color=TUBScolorscale[1:10], alpha = 0.7)
#ax[0].set_xlabel('$M_S$')
ax[0].set_ylabel('CDF - RGA')
#ax[0].legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
#ax[0].set_xscale('log')

# Static Decoupling
# Add all samples
x = np.sort(Data['MS_A'])
y = np.array(range(len(x)))/float(len(x))
ax[1].plot(x,y, color = TUBScolorscale[0], linestyle = 'dashed', label="All samples")
# Find the value for y = 0.8, meaning 80 percent of all samples
y_rob = np.argmax(y[:]>.8)
ms_rob = x[y_rob]
y_rob= y[y_rob]

ax[1].axvspan(np.min(x),ms_rob, color ='green', alpha =0.2)
ax[1].axvspan(ms_rob,np.max(x), color ='red', alpha =0.2)

for cur_order in range(1,10):
    x = np.sort(Data[((Data['Degree'] == cur_order))]['MS_A'])
    # Get the cdf
    y = np.array(range(len(x)))/float(len(x))
    ax[1].plot(x,y, color = TUBScolorscale[cur_order], label="Order "+str(cur_order))

#ax[1].set_xlabel('$M_S$')
ax[1].set_ylabel('CDF - Astr\\"om')
ax[1].legend(loc="upper left" ,bbox_to_anchor=(1.0,1.05))
#ax[1].set_xscale('log')

#R2D2
# Add all samples
x = np.sort(Data['MS_D'])
y = np.array(range(len(x)))/float(len(x))
ax[2].plot(x,y, color = TUBScolorscale[0], linestyle = 'dashed', label="All samples")
# Find the value for y = 0.8, meaning 80 percent of all samples
y_rob = np.argmax(y[:]>.8)
ms_rob = x[y_rob]
y_rob= y[y_rob]

ax[2].axvspan(np.min(x),ms_rob, color ='green', alpha =0.2)
ax[2].axvspan(ms_rob,np.max(x), color ='red', alpha =0.2)

for cur_order in range(1,10):
    x = np.sort(Data[((Data['Degree'] == cur_order))]['MS_D'])
    # Get the cdf
    y = np.array(range(len(x)))/float(len(x))
    ax[2].plot(x,y, color = TUBScolorscale[cur_order], label="Order "+str(cur_order))
#ax.hist(x, 500, normed=1, histtype='stepfilled',stacked= True, color=TUBScolorscale[1:10], alpha = 0.7)

ax[2].set_xlabel('$M_S$')
ax[2].set_ylabel('CDF - R2D2')
#ax[2].legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
#ax[2].set_xscale('log')
ax[2].set_xlim(.99,4)
plt.savefig(export_folder+model_name+"_MS_CDF.svg")
plt.show()


<matplotlib.figure.Figure at 0x9dfad30>

In [ ]: