Graphics - Physical 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
# Define data folder
data_folder = "./Data/FOTDS/2/"
# Define the export folder
export_folder = "../Latex/Graphics/Physical_"

In [2]:
# Open the data file
# Column names
temp_range = range(273,314,5)
column_names = ["{:03d}".format(x) for x in temp_range]+['Qdot', 'Inertia Fan', 'Inertia Valve', 'Gascooler', 'Zeta']

# Read the Data from Fan to Temperature
Fan_Temp_K = pd.read_csv(data_folder+'Fan_Temperature_K.csv', sep='  ', header = None, names = column_names)
Fan_Temp_T = pd.read_csv(data_folder+'Fan_Temperature_T.csv', sep='  ', header = None, names = column_names)
Fan_Temp_L = pd.read_csv(data_folder+'Fan_Temperature_L.csv', sep='  ', header = None, names = column_names)

# Sort for Gain -> Temp, Lag -> Temp, Delay -> Temp, Parameter -> All other stuff
dict= {'Gain': Fan_Temp_K[column_names[:-5]],
         'Lag':Fan_Temp_T[column_names[:-5]],
         'Delay':Fan_Temp_L[column_names[:-5]],
         'Parameter': Fan_Temp_K[column_names[-5:]]}
# Concat
Fan_Temp = pd.concat(dict.values(),axis=1,keys=dict.keys())

# Read the Data from Fan to Pressure
Fan_Pressure_K = pd.read_csv(data_folder+'Fan_Pressure_K.csv', sep='  ', header = None, names = column_names)
Fan_Pressure_T = pd.read_csv(data_folder+'Fan_Pressure_T.csv', sep='  ', header = None, names = column_names)
Fan_Pressure_L = pd.read_csv(data_folder+'Fan_Pressure_L.csv', sep='  ', header = None, names = column_names)
# Give the Columns
dict = {'Gain': Fan_Pressure_K[column_names[:-5]],
        'Lag':Fan_Pressure_T[column_names[:-5]],
        'Delay':Fan_Pressure_L[column_names[:-5]],
        'Parameter': Fan_Temp_K[column_names[-5:]]}
# Concat
Fan_Pressure = pd.concat(dict.values(),axis=1,keys=dict.keys())

# Read the Data from Valve to Temperature
Val_Temp_K = pd.read_csv(data_folder+'Valve_Temperature_K.csv', sep='  ', header = None, names = column_names)
Val_Temp_T = pd.read_csv(data_folder+'Valve_Temperature_T.csv', sep='  ', header = None, names = column_names)
Val_Temp_L = pd.read_csv(data_folder+'Valve_Temperature_L.csv', sep='  ', header = None, names = column_names)
# Give the Columns
dict = {'Gain': Val_Temp_K[column_names[:-5]],
        'Lag':Val_Temp_T[column_names[:-5]],
        'Delay':Val_Temp_L[column_names[:-5]],
        'Parameter': Val_Temp_K[column_names[-5:]]}
Valve_Temp = pd.concat(dict.values(),axis=1,keys=dict.keys())

# Read the Data from Valve to Pressure
Val_Pres_K = pd.read_csv(data_folder+'Valve_Pressure_K.csv', sep='  ', header = None, names = column_names)
Val_Pres_T = pd.read_csv(data_folder+'Valve_Pressure_T.csv', sep='  ', header = None, names = column_names)
Val_Pres_L = pd.read_csv(data_folder+'Valve_Pressure_L.csv', sep='  ', header = None, names = column_names)
# Give the Columns
dict = {'Gain': Val_Pres_K[column_names[:-5]],
        'Lag':Val_Pres_T[column_names[:-5]],
        'Delay':Val_Pres_L[column_names[:-5]],
        'Parameter': Val_Pres_K[column_names[-5:]]}
Valve_Pressure = pd.concat(dict.values(),axis=1,keys=dict.keys())


C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:7: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  import sys
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:8: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:9: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  if __name__ == '__main__':
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:20: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:21: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:22: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:32: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:33: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:34: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:43: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:44: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:45: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.

In [23]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(1, figsize=cm2in(plot_width, plot_height))

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
print(length)
dom_max = []
dom_min = []
det_max = []
det_min = []
x = []
# Preallocation
for scenario in range(0,length):
    x = []
    main = []
    minor = []
    delta = []
    for temps in temp_range:
        # Minimum of the main diagonal
        main.append(np.min(np.abs(np.array([Fan_Temp['Gain', str(temps)][scenario],Valve_Pressure['Gain', str(temps)][scenario]]))))
        # Maximum of the splitter and minor Diagonal
        s = (Fan_Pressure['Gain', str(temps)][scenario])*(Valve_Temp['Gain', str(temps)][scenario])
        s1 = s / Valve_Pressure['Gain', str(temps)][scenario]
        s2 = s / Fan_Temp['Gain', str(temps)][scenario]
        minor.append(np.max(np.abs(np.array([s1,s2]))))
        delta.append(np.max(np.abs(np.array([s1,s2])))/np.abs(np.min(np.array([Fan_Temp['Gain', str(temps)][scenario],Valve_Pressure['Gain', str(temps)][scenario]]))))
        # Append the temperature    
        x.append(temps)
    
    # Plot the value
    if scenario == 8:
        ax.plot(x, delta, color = TUBScolorscale[1])
        #ax.plot(x, main, color = TUBScolorscale[1])
        #ax.plot(x,minor,color=TUBScolorscale[1], linestyle = "dashed")
    else:
        ax.plot(x, delta, color = 'grey', alpha = 0.1)
        #ax.plot(x, main, color = 'grey', alpha = 0.3)
        #ax.plot(x,minor,color='grey', alpha = 0.3, linestyle = "dashed")

plt.grid(True)
plt.xticks(temp_range)
plt.xlabel('T_{amb} [K]')
plt.ylabel('\Delta_D')
plt.savefig(export_folder+'ErrorSteadyState.svg')
plt.show()


38
<matplotlib.figure.Figure at 0xa181e10>

In [27]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(1, figsize=cm2in(plot_width, 1.5*plot_height))

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
for scenario in range(0,length):
    x = []
    dom1, dom2 = [], []
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        main = (Fan_Temp['Gain', str(temps)][scenario])*(Valve_Pressure['Gain', str(temps)][scenario])
        #minor = (Fan_Pressure['Lag', str(temps)][scenario]+Fan_Pressure['Delay', str(temps)][scenario])*(Valve_Temp['Lag', str(temps)][scenario]+Valve_Temp['Delay', str(temps)][scenario])
        minor = (Fan_Pressure['Gain', str(temps)][scenario])*(Valve_Temp['Gain', str(temps)][scenario])
        dom1.append(np.abs((minor)/main))
        dom2.append(np.abs((minor/main)**2))
        x.append(temps)
    if scenario == 8:
        ax.plot(x,dom1, color = TUBScolorscale[1])
        ax.plot(x,np.array(dom2),color = TUBScolorscale[1], linestyle = "dashed")
    else:
        ax.plot(x,dom1, color = 'grey', alpha = 0.1)
        ax.plot(x,np.array(dom2), color = 'grey', alpha = 0.1, linestyle = "dashed")

plt.grid(True)
plt.xticks(temp_range)
plt.xlabel('T_{amb} [K]')
plt.ylabel('\det(\ma{E})')
plt.savefig(export_folder+'Dominance_SteadyState.svg')
plt.show()


<matplotlib.figure.Figure at 0xa303da0>

In [4]:
plt.clf()
fig, ax = plt.subplots(1)
for i in range(0,len(TUBScolorscale)):
    ax.scatter(i,i, color=TUBScolorscale[i])
plt.show()


<matplotlib.figure.Figure at 0x9b73e48>

In [18]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(5, figsize=cm2in(plot_width,plot_width), sharex = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
for scenario in range(0,length):
    x = []
    #'Qdot', 'Inertia Fan', 'Inertia Valve', 'Gascooler', 'Zeta'
    q, tf, tv, gc,z = [],[],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        q.append(Valve_Pressure['Parameter','Qdot'][scenario])
        tf.append(Valve_Pressure['Parameter','Inertia Fan'][scenario])
        tv.append(Valve_Pressure['Parameter','Inertia Valve'][scenario])
        gc.append(Valve_Pressure['Parameter','Gascooler'][scenario])
        z.append(Valve_Pressure['Parameter','Zeta'][scenario])
        x.append(scenario+1)
    ax[0].scatter(x,q,color = TUBScolorscale[scenario])
    ax[1].scatter(x,tf,color = TUBScolorscale[scenario])
    ax[2].scatter(x,tv,color = TUBScolorscale[scenario])
    ax[3].scatter(x,gc,color = TUBScolorscale[scenario])
    ax[4].scatter(x,z,color = TUBScolorscale[scenario])


plt.grid(True)
ax[0].set_title('Scenario Coding and Parameter')
ax[0].set_ylabel('Cooling Capacity')
ax[1].set_ylabel('Lag Fan')
ax[2].set_ylabel('Lag Valve')
ax[3].set_ylabel('Parallel Tubes')
ax[4].set_ylabel('Zeta')
ax[4].set_xlabel('Scenario No.')
plt.xticks(np.arange(1, length+1, 1.0))
#plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.4,0.1))
plt.show()


<matplotlib.figure.Figure at 0xa2904e0>
<matplotlib.figure.Figure at 0x9ff58d0>

In [45]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(2,2, figsize=cm2in(plot_width,plot_width), sharex = True, sharey = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
max_k1,max_k2,max_k3,max_k4 = [],[],[],[]
min_k1,min_k2,min_k3,min_k4 = [],[],[],[]
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Gain', str(temps)][scenario])
        vp.append(Valve_Pressure['Gain', str(temps)][scenario])
        fp.append( Fan_Pressure['Gain', str(temps)][scenario])
        vt.append(Valve_Temp['Gain', str(temps)][scenario])
        
        
        x.append(temps)
    if scenario == 8:
        ax[0,0].plot(x,ft,color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,0].plot(x,fp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
    else:
        ax[0,0].plot(x,ft,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt,color = 'grey', alpha = 0.1,label = 'Scenario '+str(scenario))
        ax[1,0].plot(x,fp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))

plt.grid(True)
ax[1,0].set_xlabel('T_{amb} [K]')
ax[1,1].set_xlabel('T_{amb} [K]')
ax[0,0].set_ylabel('K_{11} [ K~s ]')
ax[0,1].set_ylabel('K_{12} [ \\frac{K}{m^2}]')
ax[1,0].set_ylabel('K_{21} [ bar~s ]')
ax[1,1].set_ylabel('K_{22} [ \\frac{bar}{m^2} ]')
#plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.6,0.4))
plt.savefig("../Latex/Graphics/Gain_Change.svg")
plt.show()


<matplotlib.figure.Figure at 0xa243908>

In [5]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(3,4, figsize=cm2in(20,3*plot_height), sharex = True, sharey = False)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
max_k1,max_k2,max_k3,max_k4 = [],[],[],[]
min_k1,min_k2,min_k3,min_k4 = [],[],[],[]
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Gain', str(temps)][scenario])
        vp.append(Valve_Pressure['Gain', str(temps)][scenario])
        fp.append( Fan_Pressure['Gain', str(temps)][scenario])
        vt.append(Valve_Temp['Gain', str(temps)][scenario])
        
        
        x.append(temps)
    if scenario == 8:
        ax[0,0].plot(x,ft,color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[0,2].plot(x,fp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[0,3].plot(x,vp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
    else:
        ax[0,0].plot(x,ft,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt,color = 'grey', alpha = 0.1,label = 'Scenario '+str(scenario))
        ax[0,2].plot(x,fp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[0,3].plot(x,vp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
    
    # Lag
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Lag', str(temps)][scenario])
        vp.append(Valve_Pressure['Lag', str(temps)][scenario])
        fp.append( Fan_Pressure['Lag', str(temps)][scenario])
        vt.append(Valve_Temp['Lag', str(temps)][scenario])
        
        
        x.append(temps)
    if scenario == 8:
        ax[1,0].plot(x,ft,color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vt, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,2].plot(x,fp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,3].plot(x,vp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
    else:
        ax[1,0].plot(x,ft,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vt,color = 'grey', alpha = 0.1,label = 'Scenario '+str(scenario))
        ax[1,2].plot(x,fp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[1,3].plot(x,vp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))

    # Delay
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Delay', str(temps)][scenario])
        vp.append(Valve_Pressure['Delay', str(temps)][scenario])
        fp.append( Fan_Pressure['Delay', str(temps)][scenario])
        vt.append(Valve_Temp['Delay', str(temps)][scenario])
        
        
        x.append(temps)
    if scenario == 8:
        ax[2,0].plot(x,ft,color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[2,1].plot(x,vt, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[2,2].plot(x,fp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[2,3].plot(x,vp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
    else:
        ax[2,0].plot(x,ft,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[2,1].plot(x,vt,color = 'grey', alpha = 0.1,label = 'Scenario '+str(scenario))
        ax[2,2].plot(x,fp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[2,3].plot(x,vp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        
plt.grid(True)
# Set the labels
ax[2,0].set_xlabel('T_{amb} [K]')
ax[2,1].set_xlabel('T_{amb} [K]')
ax[2,2].set_xlabel('T_{amb} [K]')
ax[2,3].set_xlabel('T_{amb} [K]')
# Gain
ax[0,0].set_title('K_{11} ')
ax[0,1].set_title('K_{12} ')
ax[0,2].set_title('K_{21}')
ax[0,3].set_title('K_{22}')
# Lag
ax[1,0].set_title('T_{11}')
ax[1,1].set_title('T_{12}')
ax[1,2].set_title('T_{21}')
ax[1,3].set_title('T_{22}')
# Delay
ax[2,0].set_title('L_{11}')
ax[2,1].set_title('L_{12}')
ax[2,2].set_title('L_{21}')
ax[2,3].set_title('L_{22}')
#plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.6,0.4))
plt.savefig("../Latex/Graphics/FOTD_Change.svg")
plt.show()


<matplotlib.figure.Figure at 0xbf39438>

In [46]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(2,2, figsize=cm2in(plot_width,plot_width), sharex = True, sharey = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
max_k1,max_k2,max_k3,max_k4 = [],[],[],[]
min_k1,min_k2,min_k3,min_k4 = [],[],[],[]
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Lag', str(temps)][scenario])
        vp.append(Valve_Pressure['Lag', str(temps)][scenario])
        fp.append( Fan_Pressure['Lag', str(temps)][scenario])
        vt.append(Valve_Temp['Lag', str(temps)][scenario])
        
        
        x.append(temps)
    if scenario == 8:
        ax[0,0].plot(x,ft,color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,0].plot(x,fp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
    else:
        ax[0,0].plot(x,ft,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt,color = 'grey', alpha = 0.1,label = 'Scenario '+str(scenario))
        ax[1,0].plot(x,fp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
    

plt.grid(True)
ax[1,0].set_xlabel('T_{amb} [K]')
ax[1,1].set_xlabel('T_{amb} [K]')
ax[0,0].set_ylabel('T_{11} [s ]')
ax[0,1].set_ylabel('T_{12} [s]')
ax[1,0].set_ylabel('T_{21} [s]')
ax[1,1].set_ylabel('T_{22} [s]')
#plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.6,0.4))
plt.savefig("../Latex/Graphics/Lag_Change.svg")
plt.show()


<matplotlib.figure.Figure at 0x3e4e780>

In [47]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(2,2, figsize=cm2in(plot_width,plot_width), sharex = True, sharey = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
max_k1,max_k2,max_k3,max_k4 = [],[],[],[]
min_k1,min_k2,min_k3,min_k4 = [],[],[],[]
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Delay', str(temps)][scenario])
        vp.append(Valve_Pressure['Delay', str(temps)][scenario])
        fp.append( Fan_Pressure['Delay', str(temps)][scenario])
        vt.append(Valve_Temp['Delay', str(temps)][scenario])
        
        
        x.append(temps)
    if scenario == 8:
        ax[0,0].plot(x,ft,color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,0].plot(x,fp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vp, color = TUBScolorscale[1], label = 'Scenario '+str(scenario))
    else:
        ax[0,0].plot(x,ft,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[0,1].plot(x,vt,color = 'grey', alpha = 0.1,label = 'Scenario '+str(scenario))
        ax[1,0].plot(x,fp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))
        ax[1,1].plot(x,vp,color = 'grey', alpha = 0.1, label = 'Scenario '+str(scenario))

plt.grid(True)
ax[1,0].set_xlabel('T_{amb} [K]')
ax[1,1].set_xlabel('T_{amb} [K]')
ax[0,0].set_ylabel('L_{11} [s ]')
ax[0,1].set_ylabel('L_{12} [s]')
ax[1,0].set_ylabel('L_{21} [s]')
ax[1,1].set_ylabel('L_{22} [s]')
#plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.6,0.4))
plt.savefig("../Latex/Graphics/Delay_Change.svg")
plt.show()


<matplotlib.figure.Figure at 0xbf338d0>

In [10]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(2,2, figsize=cm2in(plot_width,plot_width), sharex = True, sharey = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Lag', str(temps)][scenario])
        vp.append(Valve_Pressure['Lag', str(temps)][scenario])
        fp.append( Fan_Pressure['Lag', str(temps)][scenario])
        vt.append(Valve_Temp['Lag', str(temps)][scenario])
        
        x.append(temps)
    ax[0,0].plot(x,ft, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))
    ax[0,1].plot(x,vt, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))
    ax[1,0].plot(x,fp, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))
    ax[1,1].plot(x,vp, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))

plt.grid(True)
ax[1,0].set_xlabel('Temperature [K]')
ax[1,1].set_xlabel('Temperature [K]')
ax[1,0].set_ylabel('Temperature [K]')
ax[0,0].set_ylabel('Pressure [bar]')
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.6,0.4))
plt.show()


<matplotlib.figure.Figure at 0xa8c1f60>

In [12]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(2,2, figsize=cm2in(plot_width,plot_width), sharex = True, sharey = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Delay', str(temps)][scenario])
        vp.append(Valve_Pressure['Delay', str(temps)][scenario])
        fp.append( Fan_Pressure['Delay', str(temps)][scenario])
        vt.append(Valve_Temp['Delay', str(temps)][scenario])
        
        x.append(temps)
    ax[0,0].plot(x,ft, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))
    ax[0,1].plot(x,vt, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))
    ax[1,0].plot(x,fp, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))
    ax[1,1].plot(x,vp, color = TUBScolorscale[scenario], label = 'Scenario '+str(scenario))

plt.grid(True)
ax[1,0].set_xlabel('Temperature [K]')
ax[1,1].set_xlabel('Temperature [K]')
ax[1,0].set_ylabel('Temperature [K]')
ax[0,0].set_ylabel('Pressure [bar]')
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.6,0.4))
plt.show()


<matplotlib.figure.Figure at 0xa823d68>

In [ ]:
# Diagonal Dominance -> Steady State
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Make a plot
plt.clf()
fig, ax = plt.subplots(2,2, figsize=cm2in(plot_width,plot_width), sharex = True, sharey = True)

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
for scenario in range(0,length):
    x = []
    ft, vp, fp, vt = [],[],[],[]
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        ft.append(Fan_Temp['Delay', str(temps)][scenario])
        vp.append(Valve_Pressure['Delay', str(temps)][scenario])
        fp.append( Fan_Pressure['Delay', str(temps)][scenario])
        vt.append(Valve_Temp['Delay', str(temps)][scenario])
        
        x.append(temps)
    ax[0,0].plot(x,ft)
    ax[0,1].plot(x,vt)
    ax[1,0].plot(x,fp)
    ax[1,1].plot(x,vp)

plt.grid(True)
ax[1,0].set_xlabel('Temperature [K]')
ax[1,1].set_xlabel('Temperature [K]')
ax[1,0].set_ylabel('Temperature [K]')
ax[0,0].set_ylabel('Pressure [bar]')
plt.legend(loc="lower right", ncol=1,  bbox_to_anchor=(1.4,0.1))
plt.show()

In [52]:
# Gain 3d Plot
# Make a plot
plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')
from mpl_toolkits.mplot3d import Axes3D
# Make a plot
plt.clf()
fig = plt.figure(figsize=cm2in(plot_width,plot_width), )
ax = fig.add_subplot(111,projection = '3d')

# Data Sorting for Parameter Values
length = Fan_Temp.shape[0]
# Preallocation
for scenario in range(0,length):
    x,y,z = [],[],[]
    # Calculate the mean for gain
    gain = []
    for temps in temp_range:
        # Minor Diagonal
        #main = (Fan_Temp['Lag', str(temps)][scenario]+Fan_Temp['Delay', str(temps)][scenario])*(Valve_Pressure['Lag', str(temps)][scenario]+Valve_Pressure['Delay', str(temps)][scenario])
        gain.append(Fan_Temp['Gain', str(temps)][scenario])
        #vp.append(Valve_Pressure['Delay', str(temps)][scenario])
        #fp.append( Fan_Pressure['Delay', str(temps)][scenario])
        #vt.append(Valve_Temp['Delay', str(temps)][scenario])
        
    x = Fan_Temp['Parameter','Inertia Valve'][scenario]
    y = Fan_Temp['Parameter','Gascooler'][scenario]
    z = Fan_Temp['Parameter','Zeta'][scenario]
    ax.plot(x,y,z,s = 50*np.abs(np.mean(gain)), color = TUBScolorscale[scenario])
    #ax.scatter(0,y,z, s = 50, color = TUBScolorscale[scenario],marker ='+')
    #ax.scatter(x,80,z, s = 50, color = TUBScolorscale[scenario],marker ='+')
    #ax.scatter(x,y,0, s = 50, color = TUBScolorscale[scenario],marker ='+')
    ax.scatter(x,y,z, s = 50*(np.abs(np.mean(gain))+np.abs(np.var(gain))),alpha = 0.3, color = TUBScolorscale[scenario])

plt.grid(True)
plt.show()


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-52-663db491a649> in <module>()
     27     y = Fan_Temp['Parameter','Gascooler'][scenario]
     28     z = Fan_Temp['Parameter','Zeta'][scenario]
---> 29     ax.plot(x,y,z,s = 50*np.abs(np.mean(gain)), color = TUBScolorscale[scenario])
     30     #ax.scatter(0,y,z, s = 50, color = TUBScolorscale[scenario],marker ='+')
     31     #ax.scatter(x,80,z, s = 50, color = TUBScolorscale[scenario],marker ='+')

C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\mpl_toolkits\mplot3d\axes3d.pyc in plot(self, xs, ys, *args, **kwargs)
   1533         # Match length
   1534         if not cbook.iterable(zs):
-> 1535             zs = np.ones(len(xs)) * zs
   1536 
   1537         lines = Axes.plot(self, xs, ys, *args[argsi:], **kwargs)

TypeError: object of type 'numpy.int64' has no len()

In [72]:
from pandas.tools.plotting import parallel_coordinates

#data = pandas.read_csv(r'C:\Python27\Lib\site-packages\pandas\tests\data\iris.csv', sep=',')
Fan_Pressure['Gain'].columns

pd.tools.plotting.parallel_coordinates(
    Fan_Pressure['Gain'], 
    Fan_Pressure['Gain'].columns)
plt.show()


C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\ipykernel_launcher.py:8: FutureWarning: 'pandas.tools.plotting.parallel_coordinates' is deprecated, import 'pandas.plotting.parallel_coordinates' instead.
  
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-72-04a8f81da5cb> in <module>()
      6 pd.tools.plotting.parallel_coordinates(
      7     Fan_Pressure['Gain'].values,
----> 8     Fan_Pressure['Gain'].columns)
      9 plt.show()

C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\pandas\tools\plotting.pyc in wrapper(*args, **kwargs)
     15                           "import 'pandas.plotting.{t}' instead.".format(t=t),
     16                           FutureWarning, stacklevel=2)
---> 17             return getattr(_plotting, t)(*args, **kwargs)
     18         return wrapper
     19 

C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\pandas\util\_decorators.pyc in wrapper(*args, **kwargs)
     89                 else:
     90                     kwargs[new_arg_name] = new_arg_value
---> 91             return func(*args, **kwargs)
     92         return wrapper
     93     return _deprecate_kwarg

C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\pandas\util\_decorators.pyc in wrapper(*args, **kwargs)
     89                 else:
     90                     kwargs[new_arg_name] = new_arg_value
---> 91             return func(*args, **kwargs)
     92         return wrapper
     93     return _deprecate_kwarg

C:\Users\juliu\Anaconda3\envs\py27\lib\site-packages\pandas\plotting\_misc.pyc in parallel_coordinates(frame, class_column, cols, ax, color, use_columns, xticks, colormap, axvlines, axvlines_kwds, sort_labels, **kwds)
    441 
    442     n = len(frame)
--> 443     classes = frame[class_column].drop_duplicates()
    444     class_col = frame[class_column]
    445 

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

In [ ]: