Example #1
0
            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()
Example #2
0
        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)
        
        print "Calculating average asymmetries."
        Delta = args.Delta*marked_tree.node[marked_tree.graph['root']
                ]['subtree-degree']
        Delta_no_ext = args.Delta*marked_tree_no_ext.node[
                marked_tree_no_ext.graph['root']]['subtree-degree']

        avg_asymmetries_plot(marked_tree, Delta, fname=fname + 
                "_asym_{}".format(args.Delta), fext=fext)
        avg_asymmetries_plot(marked_tree_no_ext, Delta_no_ext, 
                mode="no-external", fname=fname_no_ext + 
                "_asym_{}".format(args.Delta), fext=fext)
        plot_low_level_avg_asymmetries(marked_tree, 
                0.75, Delta, fname=fname + "_asym_{}".format(args.Delta), 
                fext=fext)