def test_gen_sim_dfp():
    g = graph.Graph()
    for ind, letter in enumerate("UVW"):
        drifter = graph.key("Drifter", "Drifter" + letter)
        diffuser = graph.key("Diffuser", "Diffuser" + letter)
        ductor = graph.key("PlaneDuctor", "PlaneDuctor" + letter)
        graph.connect(g, "TrackDepos", drifter)
        graph.connect(g, drifter, diffuser)
        graph.connect(g, diffuser, ductor)
        graph.connect(g, ductor, "PlaneSliceMerger", 0, ind)
    graph.connect(g, "PlaneSliceMerger", "Digitizer")
    graph.connect(g, "WireSource", "Digitizer", 0, 1)
    graph.connect(g, "Digitizer", "ChannelCellSelector")
    graph.connect(g, "WireSource", "BoundCells")
    graph.connect(g, "BoundCells", "ChannelCellSelector", 0, 1)
    graph.connect(g, "ChannelCellSelector", "CellSliceSink")
    desc = nodetype.loads(open("nodedesc.json").read())
    graph.validate(g, desc)

    ag = dot.gvgraph(g)
    open("test_dfp_sim.dot", "w").write(ag.string())
    print check_output("dot -Tpdf -otest_dfp_sim.pdf test_dfp_sim.dot",
                       shell=True)

    wcg = graph.wirecell_graph(g)
    cfg = [
        dict(type="TbbFlow", data=dict(dfp="TbbDataFlowGraph", graph=wcg)),
    ]

    json.dump(cfg, open("test_dfp_sim.cfg", "w"), indent=2)
Esempio n. 2
0
def test_gen_sim_dfp():
    g = graph.Graph()
    for ind,letter in enumerate("UVW"):
        drifter = graph.key("Drifter","Drifter"+letter)
        diffuser = graph.key("Diffuser","Diffuser"+letter)
        ductor = graph.key("PlaneDuctor","PlaneDuctor"+letter)
        graph.connect(g, "TrackDepos", drifter)
        graph.connect(g, drifter, diffuser)
        graph.connect(g, diffuser, ductor)
        graph.connect(g, ductor, "PlaneSliceMerger", 0, ind)
    graph.connect(g, "PlaneSliceMerger", "Digitizer")
    graph.connect(g, "WireSource", "Digitizer",0,1)
    graph.connect(g, "Digitizer", "ChannelCellSelector")
    graph.connect(g, "WireSource", "BoundCells")
    graph.connect(g, "BoundCells", "ChannelCellSelector",0,1)
    graph.connect(g, "ChannelCellSelector", "CellSliceSink")
    desc = nodetype.loads(open("nodedesc.json").read())
    graph.validate(g, desc)

    ag = dot.gvgraph(g);
    open("test_dfp_sim.dot","w").write(ag.string())
    print check_output("dot -Tpdf -otest_dfp_sim.pdf test_dfp_sim.dot", shell=True)

    wcg = graph.wirecell_graph(g)
    cfg = [dict(type= "TbbFlow", data=dict(dfp = "TbbDataFlowGraph", graph = wcg)),]

    json.dump(cfg, open("test_dfp_sim.cfg","w"), indent=2)
def test_make():
    'Make a wirecell.dfp.graph.Graph'
    g = graph.Graph()
    a = graph.key("A","a")
    b = graph.key("B","b")
    graph.connect(g, a,b, 0,0)
    graph.connect(g, a,b, 1,1)
    graph.connect(g, a,b, 2,2)
    graph.connect(g, a,b, 3,0)

    desc = nodetype.loads(node_desc_json)
    graph.validate(g, desc)

    gvgraph = dot.gvgraph_nodetypes(g, desc)
    print gvgraph.string()
Esempio n. 4
0
def test_make():
    'Make a wirecell.dfp.graph.Graph'
    g = graph.Graph()
    a = graph.key("A", "a")
    b = graph.key("B", "b")
    graph.connect(g, a, b, 0, 0)
    graph.connect(g, a, b, 1, 1)
    graph.connect(g, a, b, 2, 2)
    graph.connect(g, a, b, 3, 0)

    desc = nodetype.loads(node_desc_json)
    graph.validate(g, desc)

    gvgraph = dot.gvgraph_nodetypes(g, desc)
    print gvgraph.string()
Esempio n. 5
0
def test_nodedesc():
    'Make a wirecell.dfp.graph.Graph'
    
    addtypes = True
    rankdir='TB'
    if addtypes:
        rankdir='LR'

    ag = pgv.AGraph(name="nodetypes", directed=True, strict=False, rankdir=rankdir)
    ag.node_attr['shape'] = 'record'

    j = open("nodedesc.json").read()
    for typ,dat in nodetype.loads(j).items():
        ag.add_node(typ, label = dot.nodetype_label(dat, addtypes))

    print ag.string()
Esempio n. 6
0
def test_nodedesc():
    'Make a wirecell.dfp.graph.Graph'

    addtypes = True
    rankdir = 'TB'
    if addtypes:
        rankdir = 'LR'

    ag = pgv.AGraph(name="nodetypes",
                    directed=True,
                    strict=False,
                    rankdir=rankdir)
    ag.node_attr['shape'] = 'record'

    j = open("nodedesc.json").read()
    for typ, dat in nodetype.loads(j).items():
        ag.add_node(typ, label=dot.nodetype_label(dat, addtypes))

    print ag.string()