def __init__(self, explorer, recorder, assignment, dataset, logpath): self.explorer = explorer self.recorder = recorder self.assignment = assignment self.dataset = dataset self.logpath = logpath self.activities = [a for a in read.read_registre(self.logpath)]
total = float(sum(dstdict.values())) for (dst, weight) in dstdict.iteritems(): graph[src][dst] = weight * 1. / total return graph, start, end if __name__ == "__main__": import argparse DEFAULT_GRAPH = "graph.pdf" parser = argparse.ArgumentParser("Create state machine graph from Tableau or Registre log.") parser.add_argument("-t", "--tableaulog", help="path to the Tableau log file to parse") parser.add_argument("-r", "--registrelog", help="path to the Tableau log file to parse") parser.add_argument("-o", "--output", help="path to the graph to output (default is %s)" % DEFAULT_GRAPH) parser.add_argument("-n", "--normalize", action="store_true", help="whether to normalize the edge weights to be frequencies rather than counts") args = parser.parse_args() if args.tableaulog is None and args.registrelog is None: raise RuntimeError("You must provide an input file.") parser.print_help() if args.tableaulog is not None and args.registrelog is not None: raise RuntimeError("Please provide only one input.") parser.print_help() if args.output is None: args.output = DEFAULT_GRAPH activity_gen = map.parse_tableau_log(args.tableaulog) if args.tableaulog else read.read_registre(args.registrelog) activities = [activity for activity in activity_gen] graph_activity(activities, args.output, normalize=args.normalize)
parser.add_argument( "-t", "--tableaulog", help="path to the Tableau log file to parse") parser.add_argument( "-r", "--registrelog", help="path to the Tableau log file to parse") parser.add_argument( "-o", "--output", help="path to the graph to output (default is %s)" % DEFAULT_GRAPH) parser.add_argument( "-n", "--normalize", action="store_true", help= "whether to normalize the edge weights to be frequencies rather than counts" ) args = parser.parse_args() if args.tableaulog is None and args.registrelog is None: raise RuntimeError("You must provide an input file.") parser.print_help() if args.tableaulog is not None and args.registrelog is not None: raise RuntimeError("Please provide only one input.") parser.print_help() if args.output is None: args.output = DEFAULT_GRAPH activity_gen = map.parse_tableau_log( args.tableaulog) if args.tableaulog else read.read_registre( args.registrelog) activities = [activity for activity in activity_gen] graph_activity(activities, args.output, normalize=args.normalize)