Example #1
0
    # Change colors
    for these_nodes, color in zip((services, derivatives),
                                  (sensor_color, source_color)):
        for node in these_nodes:
            g.get_node(node).attr['fillcolor'] = color
            g.get_node(node).attr['style'] = 'filled'

    # Create subgraphs
    for si, subgraph in enumerate(subgraphs):
        g.add_subgraph(subgraph[0], 'cluster%s' % si,
                       label=subgraph[1], color='black')

    # Format (sub)graphs
    for gr in g.subgraphs() + [g]:
        for x in [gr.node_attr, gr.edge_attr]:
            x['fontname'] = font_face
    g.node_attr['shape'] = 'box'

    g.layout('dot')
    g.draw(out_fname, format='svg')
    return g


# This is useful for testing/iterating to see what the result looks like
if __name__ == '__main__':
    from mne.io.constants import Bunch
    out_dir = op.abspath(op.join(op.dirname(__file__), '..', '_build', 'html'))
    app = Bunch(builder=Bunch(outdir=out_dir,
                              config=Bunch(make_flow_diagram=True)))
    g = generate_flow_diagram(app)
Example #2
0
"""


def generate_commands_rst(app):
    out_dir = op.join(app.builder.outdir, 'generated')
    out_fname = op.join(out_dir, 'commands.rst')

    command_path = op.join(os.path.dirname(__file__), '..', '..', 'mne',
                           'commands')
    print command_path
    fnames = glob.glob(op.join(command_path, 'mne_*.py'))

    with open(out_fname, 'w') as f:
        f.write(header)
        for fname in fnames:
            cmd_name = op.basename(fname)[:-3]

            output, _ = run_subprocess(['python', fname, '--help'])
            f.write(command_rst %
                    (cmd_name, cmd_name.replace('mne_', 'mne '), output))

    print('Done')


# This is useful for testing/iterating to see what the result looks like
if __name__ == '__main__':
    from mne.io.constants import Bunch
    out_dir = op.abspath(op.join(op.dirname(__file__), '..'))
    app = Bunch(builder=Bunch(outdir=out_dir))
    generate_commands_rst(app)