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_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()
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()