コード例 #1
0
ファイル: ContingencyVis.py プロジェクト: AnjoMan/PyTreeMap
 def __init__(self, results_file, system_file = None):
     mCPFresults = JSON_systemFile(results_file, system_file)
     
     (faults, faultTree) = getFaults(TreemapFault, mCPFresults)
     
     mDetails = DetailsWidget([0,0,200,200])
     mOneline = OneLineWidget( mCPFresults.Branches + mCPFresults.Buses + mCPFresults.Generators,[0,0,900,900], details = mDetails)
     mTreemap  = TreemapGraphicsVis(pos = [0,0,900,900],faultTree = faultTree, details = mDetails)
     
     
     
     
     
     super().__init__(treemap=mTreemap, oneline=mOneline, details=mDetails, pos = (20,20,1800,950))
コード例 #2
0
ファイル: TreemapGraphics.py プロジェクト: AnjoMan/PyTreeMap
def main():
    from pytreemap.visualize.TreemapGraphics import TreemapFault, TreemapGraphicsVis
    
    
    def getFullFileNames(geoFile, resultFile):
        return (os.path.join(pytreemap.system.__path__[0], geoFile), os.path.join(pytreemap.__path__[0], 'sample_results', resultFile))
    
#     mCase = ('case118_geometry.json', 'cpfResults_case118_2level.json')
    mCase = ('case30_geometry.json', 'cpfResults_case30_2level.json')
#     mCase = ('case30_geometry.json', 'cpfResults_small.json')

    mFile = 'cpfResults_case30_2level.json'
    mFile = os.path.join(pytreemap.__path__[0], 'sample_results', mFile)
    
    
#     mSys = 'case118_geometry.json'
#     mRes = 'cpfResults_case118_2level.json'
    
#     mCase = getFullFileNames(*mCase)
#     mCPFresults = JSON_systemFile(*mCase)


    mCPFresults = JSON_systemFile(mFile)
    
    (faults, faultTree) = getFaults(TreemapFault, mCPFresults)
    
    
# #     file = 'cpfResults_4branches'
# #     file = 'cpfResults_case30_2level'
#     file = 'cpfResults'
# #     file = 'cpfResults_case118_2level'
# #     

#     (faults, faultTree) = getFaults(TreemapFault, CPFfile(file))
# #     
# #     values = [14, 1, 17, 14, 17, 18, 8, 8, 6, 10, 2, 1, 4, 9, 10, 0, 16, 13, 8, 12, 6, 17, 5, 1, 19, 4, 11, 16, 11, 5, 17, 16, 4, 7, 17, 14, 11, 16, 13, 19]
# #     
# #     values = [flt.subValue for flt in faultTree[1][1].connections]
# #     
    app = QApplication(sys.argv)
    
    ex = TreemapGraphicsVis(pos = [100,100,700,700],faultTree = faultTree)
#     ex = TreemapGraphicsVis(pos = [100,100,100,100],faultTree = faultTree)
#     ex = TreemapGraphicsVis(pos = [100,100,100,100],values = values)


#     ex2 = TreemapGraphicsVis( pos=[1100,50,400,400],values = values, name="Treemap of Random Values")
    
    sys.exit(app.exec_())
コード例 #3
0
ファイル: TreeGraphics.py プロジェクト: AnjoMan/PyTreeMap
    def __init__(self, results_file, system_file, pos=[20, 20, 1600, 700]):

        (faults, faultTree) = getFaults(TreeFault, JSON_systemFile(results_file, system_file))

        super().__init__(pos, faultTree)
コード例 #4
0
ファイル: run_treemap.py プロジェクト: AnjoMan/PyTreeMap
"""

import sys
import pytreemap
from pytreemap.visualize.TreemapGraphics import TreemapGraphicsVis, TreemapFault
from pytreemap.visualize.VisBuilder import JSON_systemFile, getFaults
from PySide.QtGui import QApplication
import os


# get results file
results_file = (
    sys.argv[1]
    if len(sys.argv) > 1
    else os.path.join(pytreemap.__path__[0], "sample_results", "cpfResults_case30_2level.json")
)


# start QApplication service
app = QApplication(sys.argv)

# load system file
mSystem = JSON_systemFile(res=results_file)

(faults, faultTree) = getFaults(TreemapFault, mSystem)
ex = TreemapGraphicsVis(faultTree=faultTree)

# run
sys.exit(app.exec_())