In [1]:
# Import Pandas
import pandas as pd
# Import Numpy
import numpy as np
# Import Bokeh
import bokeh.plotting as bk
import bokeh.io as bi
from bokeh.io import export_svgs
bi.output_notebook()
In [2]:
# Read the Data
Data = pd.read_csv('./Experiments/MIMO/MIMO_280817_1.csv', sep=';')
# Give the Columns
Data.columns
Out[2]:
In [5]:
# Sample Count
msd_sample = Data['sig_max_cl_D']
msd_sample = msd_sample.notnull().sum()
msa_sample = Data['sig_max_cl_A']
msa_sample = msa_sample.notnull().sum()
msm_sample = Data['sig_max_cl_M']
msm_sample = msm_sample.notnull().sum()
# Ist das wirklich nur numerisch oder stabilität!?
# Get Data above a maximum gain of 2 dB
msd_unstable = Data[Data['sig_max_s_D']>10.0]
msd_unstable = msd_unstable['sig_max_s_D'].notnull().sum()
msa_unstable = Data[Data['sig_max_s_A']>10.0]
msa_unstable = msa_unstable['sig_max_s_A'].notnull().sum()
msm_unstable = Data[Data['sig_max_s_M']>10.0]
msm_unstable = msm_unstable['sig_max_s_M'].notnull().sum()
# Print
msd_sample, msa_sample, msm_sample, msd_unstable, msa_unstable, msm_unstable
Out[5]:
In [71]:
# select a palette
from bokeh.palettes import Plasma9 as palette
# itertools handles the cycling
import itertools
from bokeh.models import Range1d, Label
# create a color iterator
colors = itertools.cycle(palette)
# count higher then MS > 5
# Closed loop vs Sensitivity
p2 = bk.figure(title="Decentralized Control", plot_width = 800, plot_height = 800, x_axis_label='Maximum Sensitivity Closed Loop', y_axis_label='Maximum Sensitivity Sensitivity Transfer Function', y_axis_type='log', x_axis_type='log')
for i, color in zip(range(6,0,-1), colors):
# Load the Data Closed loop
x = Data[((Data['Order'] == i))]['sig_max_cl_D']
y = Data[((Data['Order'] == i))]['sig_max_s_D']
p2.scatter(x,y, color = color, alpha = 1, legend='Order '+str(i))
# Get the legend horizontal
p2.legend.orientation='horizontal'
# Make a copy for later plot
p3 = p2
# Add annotation
label1 = Label(x=50, y=1.0, text='No. of samples: '+str(msd_sample))
#label2 = Label(x=1.4, y=0.975, text='Critical Systems: '+str(msreal_unstable))
p2.add_layout(label1)
#p2.add_layout(label2)
# Show and Export
#p2.output_backend = "svg"
#export_svgs(p2, filename="SISO_Robustness.svg")
bk.show(p2)
In [75]:
# select a palette
from bokeh.palettes import Plasma9 as palette
# itertools handles the cycling
import itertools
from bokeh.models import Range1d, Label
# create a color iterator
colors = itertools.cycle(palette)
# count higher then MS > 5
# Closed loop vs Sensitivity
p2 = bk.figure(title="Aström Control",plot_width = 800, plot_height = 800, x_axis_label='Maximum Sensitivity Closed Loop', y_axis_label='Maximum Sensitivity Sensitivity Transfer Function', y_axis_type='log', x_axis_type='log')
for i, color in zip(range(6,0,-1), colors):
# Load the Data Closed loop
x = Data[((Data['Order'] == i))]['sig_max_cl_A']
y = Data[((Data['Order'] == i))]['sig_max_s_A']
p2.scatter(x,y, color = color, alpha = 1, legend='Order '+str(i))
# Get the legend horizontal
p2.legend.orientation='horizontal'
# Make a copy for later plot
p3 = p2
# Add annotation
label1 = Label(x=0.001, y=100.0, text='No. of samples: '+str(msa_sample))
#label2 = Label(x=1.4, y=0.975, text='Critical Systems: '+str(msreal_unstable))
p2.add_layout(label1)
#p2.add_layout(label2)
# Show and Export
#p2.output_backend = "svg"
#export_svgs(p2, filename="SISO_Robustness.svg")
bk.show(p2)
In [73]:
# select a palette
from bokeh.palettes import Plasma9 as palette
# itertools handles the cycling
import itertools
from bokeh.models import Range1d, Label
# create a color iterator
colors = itertools.cycle(palette)
# count higher then MS > 5
# Closed loop vs Sensitivity
p2 = bk.figure(title="Decoupled Control",plot_width = 800, plot_height = 800, x_axis_label='Maximum Sensitivity Closed Loop', y_axis_label='Maximum Sensitivity Sensitivity Transfer Function', y_axis_type='log', x_axis_type='log')
for i, color in zip(range(6,0,-1), colors):
# Load the Data Closed loop
x = Data[((Data['Order'] == i))]['sig_max_cl_M']
y = Data[((Data['Order'] == i))]['sig_max_s_M']
p2.scatter(x,y, color = color, alpha = 1, legend='Order '+str(i))
# Get the legend horizontal
p2.legend.orientation='horizontal'
# Make a copy for later plot
p3 = p2
# Add annotation
label1 = Label(x=50, y=1.0, text='No. of samples: '+str(msm_sample))
#label2 = Label(x=1.4, y=0.975, text='Critical Systems: '+str(msreal_unstable))
p2.add_layout(label1)
#p2.add_layout(label2)
# Show and Export
#p2.output_backend = "svg"
#export_svgs(p2, filename="SISO_Robustness.svg")
bk.show(p2)
In [51]:
# Histogram
data1 = Data[Data['sig_max_s_D']<10.0]['sig_max_s_D'].dropna()
data2 = Data[Data['sig_max_s_A']<10.0]['sig_max_s_A'].dropna()
data3 = Data[Data['sig_max_s_M']<10.0]['sig_max_s_M'].dropna()
hist1, edge1 = np.histogram(data1.values , density=False, bins = 100)
hist2, edge2 = np.histogram(data2.values , density=False, bins = 100)
hist3, edge3 = np.histogram(data3.values , density=False, bins = 100)
p1 = bk.figure(title="Maximum Sensitivity Histogram", x_range=(0,10), x_axis_label = "Maximum Sensitivity", y_axis_label =" Samples")
p1.quad(top=hist1, bottom = 0, left=edge1[:-1], right=edge1[1:], color="red", alpha=0.5)
p1.quad(top=hist2, bottom = 0, left=edge2[:-1], right=edge2[1:], color = "green", alpha = 0.5)
p1.quad(top=hist3, bottom = 0, left=edge3[:-1], right=edge3[1:], color = "blue", alpha = 0.5)
bk.show(p1)
In [79]:
data1 = Data[Data['Order']<7]['sig_max_s_D'].dropna()
data1 = data1[Data['sig_max_s_D']<10.0]
no1 = data1.notnull().sum()
data2 = Data[Data['Order']<7]['sig_max_s_A'].dropna()
data2 = data2[Data['sig_max_s_A']<10.0]
no2 = data2.notnull().sum()
data3 = Data[Data['Order']<7]['sig_max_s_M'].dropna()
data3 = data3[Data['sig_max_s_M']<10.0]
no3 = data3.notnull().sum()
hist1, edge1 = np.histogram(data1.values , density=False, bins = 100)
hist2, edge2 = np.histogram(data2.values , density=False, bins = 100)
hist3, edge3 = np.histogram(data3.values , density=False, bins = 100)
p1 = bk.figure(title="Maximum Sensitivity Histogram", x_axis_label = "Maximum Sensitivity", y_axis_label =" Samples")
p1.quad(top=hist1, bottom = 0, left=edge1[:-1], right=edge1[1:], color="red", alpha=0.5)
p1.quad(top=hist2, bottom = 0, left=edge2[:-1], right=edge2[1:], color = "green", alpha = 0.5)
p1.quad(top=hist3, bottom = 0, left=edge3[:-1], right=edge3[1:], color = "blue", alpha = 0.5)
# Add annotation
label1 = Label(x=6, y=800.0, text='Decentral Samples '+str(no1))
label2 = Label(x=6, y=750.0, text='Aström Samples '+str(no2))
label3 = Label(x=6, y=700.0, text='Modified Samples '+str(no3))
#label2 = Label(x=1.4, y=0.975, text='Critical Systems: '+str(msreal_unstable))
p1.add_layout(label1)
p1.add_layout(label2)
p1.add_layout(label3)
bk.show(p1)
In [67]:
no1,no2,no3
Out[67]:
In [ ]: