Graphics - MIMO Study-checkpoint



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
studyname = "../Latex/Graphics/H01_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 [77]:
# 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,100), 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.show()


<matplotlib.figure.Figure at 0x10ea07b8>

In [78]:
# 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,100), 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.show()


<matplotlib.figure.Figure at 0x12d85d30>

In [79]:
# 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,100), 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.show()


<matplotlib.figure.Figure at 0xc0d44a8>

In [75]:
# 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.show()


<matplotlib.figure.Figure at 0x10f74c50>

In [86]:
# Make a histogram
from scipy.stats import norm
plt.clf()
fig, ax = plt.subplots(3, sharex=True, figsize = cm2in(plot_width,3*plot_height))
x = []
y = []
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))
#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')
ax[0].legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
ax[0].set_xscale('log')

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.hist(x, 500, normed=1, histtype='stepfilled',stacked= True, color=TUBScolorscale[1:10], alpha = 0.7)
ax[1].set_xlabel('$M_S$')
ax[1].set_ylabel('CDF')
ax[1].legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
ax[1].set_xscale('log')

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')
ax[2].legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
ax[2].set_xscale('log')
ax[2].set_xlim(1,2)
#plt.savefig(export_folder+model_name+"_MS_CDF.svg")
plt.show()


<matplotlib.figure.Figure at 0x12a23d30>

In [83]:
# Make a histogram
from scipy.stats import norm
plt.clf()
fig, ax = plt.subplots(1, sharex=True, figsize = cm2in(plot_width,plot_height))
x = []
y = []
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.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.set_xlabel('$M_S$')
ax.set_ylabel('CDF')
ax.legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
ax.set_xscale('log')
#plt.savefig(export_folder+model_name+"_MS_CDF.svg")
plt.show()


<matplotlib.figure.Figure at 0x14d20d30>

In [84]:
# Make a histogram
from scipy.stats import norm
plt.clf()
fig, ax = plt.subplots(1, sharex=True, figsize = cm2in(plot_width,plot_height))
x = []
y = []
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.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.set_xlabel('$M_S$')
ax.set_ylabel('CDF')
ax.legend(loc="upper left" ,bbox_to_anchor=(1.0,1.0))
ax.set_xscale('log')
#plt.savefig(export_folder+model_name+"_MS_CDF.svg")
plt.show()


<matplotlib.figure.Figure at 0x9bf2a58>

In [ ]: