Example #1
0
from formatmatrices import formatmatrix
from numpy import array
from visualise import visualiseOpenLoopSystem
"""This has been altered for the sake of convenience"""
testcase = 't'

dispRGA = True
dispEigenForwardAndBackward = True
dispEigenBlend = True
dispEdgeWeight = True
dispBestControl = True

if testcase == 'a':
    """This is btest1"""

    test = formatmatrix("btest1.csv", "btest1ObviousConnections.txt", 3, 0)

    test2 = visualiseOpenLoopSystem(
        test.nodummyvariablelist, test.nodummydiff, 2, test.scaledforwardgain,
        test.scaledforwardconnection, test.scaledforwardvariablelist,
        test.scaledbackwardgain, test.scaledbackwardconnection,
        test.scaledbackwardvariablelist, test.nodummygain,
        test.nodummyconnection, ['v3', 'v4'])

    nodepos = {
        test.nodummyvariablelist[0]: array([1, 1]),
        test.nodummyvariablelist[1]: array([1, 2]),
        test.nodummyvariablelist[2]: array([4, 1]),
        test.nodummyvariablelist[3]: array([4, 2])
    }
Example #2
0
'''
"""This class will be used to run controlranking"""

"""Import classes"""
from controlranking import loopranking
from formatmatrices import formatmatrix
from numpy import array, transpose, arange, empty
import networkx as nx
import matplotlib.pyplot as plt
from operator import itemgetter

testcase = 'local1' #use local gains to calculate importances if == local

if testcase == 'local':
    
    datamatrix = formatmatrix("connectionsTEcontrol.csv", "scaledcontrol.txt", 21 ,0)
    datamatrixNC = formatmatrix("connectionsTE.csv","scaledinputs100h5.txt",13,0 )
    controlmatrix = loopranking(datamatrix.scaledforwardgain, datamatrix.scaledforwardvariablelist, datamatrix.scaledforwardconnection, datamatrix.scaledbackwardgain, datamatrix.scaledbackwardvariablelist, datamatrix.scaledbackwardconnection, datamatrix.nodummyvariablelist, datamatrixNC.scaledforwardgain, datamatrixNC.scaledforwardvariablelist, datamatrixNC.scaledforwardconnection, datamatrixNC.scaledbackwardgain, datamatrixNC.scaledbackwardvariablelist, datamatrixNC.scaledbackwardconnection)
    
    controlmatrix.displayControlImportances(datamatrixNC.nodummyconnection, datamatrix.nodummyconnection)
    
    controlmatrix.showAll()
    controlmatrix.exportToGML()
else:
    #this works
    datamatrix = formatmatrix("connectionsTEcontrol.csv","controlcorrelation.txt",0,0,partialcorrelation=True)
    datamatrixNC = formatmatrix("connectionsTE.csv","controlcorrelationNOCONTROL.txt",0,0,partialcorrelation=True)
    controlmatrix = loopranking(datamatrix.scaledforwardgain, datamatrix.scaledforwardvariablelist, datamatrix.scaledforwardconnection, datamatrix.scaledbackwardgain, datamatrix.scaledbackwardvariablelist, datamatrix.scaledbackwardconnection, datamatrix.nodummyvariablelist, datamatrixNC.scaledforwardgain, datamatrixNC.scaledforwardvariablelist, datamatrixNC.scaledforwardconnection, datamatrixNC.scaledbackwardgain, datamatrixNC.scaledbackwardvariablelist, datamatrixNC.scaledbackwardconnection)
    
    controlmatrix.displayControlImportances(datamatrixNC.nodummyconnection, datamatrix.nodummyconnection)
    
Example #3
0
@author: St Elmo Wilken
'''
"""This class will be used to run controlranking"""
"""Import classes"""
from controlranking import loopranking
from formatmatrices import formatmatrix
from numpy import array, transpose, arange, empty
import networkx as nx
import matplotlib.pyplot as plt
from operator import itemgetter

testcase = 'local1'  #use local gains to calculate importances if == local

if testcase == 'local':

    datamatrix = formatmatrix("connectionsTEcontrol.csv", "scaledcontrol.txt",
                              21, 0)
    datamatrixNC = formatmatrix("connectionsTE.csv", "scaledinputs100h5.txt",
                                13, 0)
    controlmatrix = loopranking(
        datamatrix.scaledforwardgain, datamatrix.scaledforwardvariablelist,
        datamatrix.scaledforwardconnection, datamatrix.scaledbackwardgain,
        datamatrix.scaledbackwardvariablelist,
        datamatrix.scaledbackwardconnection, datamatrix.nodummyvariablelist,
        datamatrixNC.scaledforwardgain, datamatrixNC.scaledforwardvariablelist,
        datamatrixNC.scaledforwardconnection, datamatrixNC.scaledbackwardgain,
        datamatrixNC.scaledbackwardvariablelist,
        datamatrixNC.scaledbackwardconnection)

    controlmatrix.displayControlImportances(datamatrixNC.nodummyconnection,
                                            datamatrix.nodummyconnection)
Example #4
0
"""This has been altered for the sake of convenience"""
testcase = 't'

dispRGA = True
dispEigenForwardAndBackward = True
dispEigenBlend = True
dispEdgeWeight = True
dispBestControl = True

if testcase == 'a':


    """This is btest1"""
    
    test = formatmatrix("btest1.csv", "btest1ObviousConnections.txt", 3,0)
    
    test2 = visualiseOpenLoopSystem(test.nodummyvariablelist, test.nodummydiff, 2,test.scaledforwardgain, test.scaledforwardconnection, test.scaledforwardvariablelist, test.scaledbackwardgain, test.scaledbackwardconnection, test.scaledbackwardvariablelist, test.nodummygain, test.nodummyconnection, ['v3', 'v4'])
    
    
    nodepos = {test.nodummyvariablelist[0]: array([1,1]), test.nodummyvariablelist[1]: array([1,2]), test.nodummyvariablelist[2]: array([4,1]), test.nodummyvariablelist[3]: array([4,2])}
    
  
    test2.displayConnectivityAndLocalGains(test.nodummyconnection, test.nodummygain, test.nodummyvariablelist, nodepos)
    
    if dispRGA: 
        test2.displayRGA(1, nodepos)
        test2.displayRGA(2, nodepos)
        test2.displayRGAmatrix()
    
    if dispEigenForwardAndBackward: