filtration_steps=args.filtration_steps) print "Decomp. took {}s.".format(time.time() - t0) print "Number of loops:", dual.number_of_nodes() print "Number of tree nodes:", tree.number_of_nodes() if args.save != "": print "Saving file." SAVE_FORMAT_VERSION = 5 sav = {'version':SAVE_FORMAT_VERSION, \ 'leaf':leaf, 'tree':tree, 'dual':dual, \ 'filtration':filtr, 'pruned':pruned, \ 'removed-edges':removed_edges} storage.save(sav, args.save) print "Done." if args.plot: plt.figure() plot.draw_leaf(leaf, "Input leaf data") plt.figure() plot.draw_leaf(pruned, "Pruned leaf data and dual graph") plot.draw_dual(dual) plt.figure() plot.draw_tree(tree) plt.figure() plot.draw_filtration(filtr) plt.show()
print "Plotting/saving plots." fname = "" fname_no_ext = "" fext = ".png" if args.save_plots != "": fname, fext = os.path.splitext(args.save_plots) fname_no_ext = fname + "_no_ext" print fname, fext plt.figure() print "Drawing leaf." plot.draw_leaf(leaf, fname=fname, fext=fext, dpi=600) plt.figure() print "Drawing hierarchical trees." plot.draw_tree(marked_tree, pos=tree_pos, fname=fname, fext=fext) plt.figure() if args.tree_heights: pos = tree_pos_h else: pos = tree_pos plot.draw_tree(marked_tree_no_ext, pos=pos, fname=fname_no_ext, fext=fext) plt.figure() print "Drawing filtration." plot.draw_filtration(filt, fname=fname, fext=fext, dpi=600)