def execute_script(): log = xes_importer.apply( os.path.join("..", "tests", "input_data", "running-example.xes")) hw_values = sna_algorithm.apply( log, variant=sna_algorithm.Variants.HANDOVER_LOG) wt_values = sna_algorithm.apply( log, variant=sna_algorithm.Variants.WORKING_TOGETHER_LOG) sub_values = sna_algorithm.apply( log, variant=sna_algorithm.Variants.SUBCONTRACTING_LOG) ja_values = sna_algorithm.apply( log, variant=sna_algorithm.Variants.JOINTACTIVITIES_LOG) gviz_sub = pn_vis.apply( sub_values, variant=pn_vis.Variants.NETWORKX, parameters={pn_vis.Variants.NETWORKX.value.Parameters.FORMAT: "svg"}) gviz_hw = pn_vis.apply(hw_values, variant=pn_vis.Variants.PYVIS) gviz_wt = pn_vis.apply( wt_values, variant=pn_vis.Variants.NETWORKX, parameters={pn_vis.Variants.NETWORKX.value.Parameters.FORMAT: "svg"}) gviz_ja = pn_vis.apply(ja_values, variant=pn_vis.Variants.PYVIS) pn_vis.view(gviz_sub, variant=pn_vis.Variants.NETWORKX) pn_vis.view(gviz_hw, variant=pn_vis.Variants.PYVIS) pn_vis.view(gviz_wt, variant=pn_vis.Variants.NETWORKX) pn_vis.view(gviz_ja, variant=pn_vis.Variants.PYVIS)
def view_sna(sna_metric): """ Represents a SNA metric (.html) Parameters --------------- sna_metric Values of the metric """ from pm4py.visualization.sna import visualizer as sna_visualizer gviz = sna_visualizer.apply(sna_metric, variant=sna_visualizer.Variants.PYVIS) sna_visualizer.view(gviz)
def save_vis_sna(sna_metric, file_path: str): """ Saves the visualization of a SNA metric in a .html file Parameters ---------------- sna_metric Values of the metric file_path Destination path """ from pm4py.visualization.sna import visualizer as sna_visualizer gviz = sna_visualizer.apply(sna_metric, variant=sna_visualizer.Variants.PYVIS) sna_visualizer.save(gviz, file_path)
from enum import Enum log = xes_importer.apply( '/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/test.xes' ) ''' dataframe = log_converter.apply(log, variant=log_converter.Variants.TO_DATA_FRAME) dataframe.to_csv('/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/running-example.csv') ''' ''' tree = inductive_miner.apply_tree(log) gviz = pt_visualizer.apply(tree, parameters={pt_visualizer.Variants.WO_DECORATION.value.Parameters.FORMAT: "png"}) pt_visualizer.save(gviz,"/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/ptree.png") ''' hw_values = sna.apply(log, variant=sna.Variants.HANDOVER_LOG) gviz_hw_py = sna_visualizer.apply(hw_values, variant=sna_visualizer.Variants.PYVIS) #sna_visualizer.view(gviz_hw_py, variant=sna_visualizer.Variants.PYVIS) #sna_visualizer.save(gviz_hw_py,"/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/handover.png") def findlabel(tree, list): if tree.children != []: for child in tree.children: #if child.operator != pt_operator.Operator.LOOP: findlabel(child, list) else: if tree.label != None: #print(tree.label,"tree.label") list.append(tree.label)