test_dfp_sim.py
Go to the documentation of this file.
1 from wirecell.dfp import graph, nodetype, dot
2 from subprocess import check_output
3 import json
4 
6  g = graph.Graph()
7  for ind,letter in enumerate("UVW"):
8  drifter = graph.key("Drifter","Drifter"+letter)
9  diffuser = graph.key("Diffuser","Diffuser"+letter)
10  ductor = graph.key("PlaneDuctor","PlaneDuctor"+letter)
11  graph.connect(g, "TrackDepos", drifter)
12  graph.connect(g, drifter, diffuser)
13  graph.connect(g, diffuser, ductor)
14  graph.connect(g, ductor, "PlaneSliceMerger", 0, ind)
15  graph.connect(g, "PlaneSliceMerger", "Digitizer")
16  graph.connect(g, "WireSource", "Digitizer",0,1)
17  graph.connect(g, "Digitizer", "ChannelCellSelector")
18  graph.connect(g, "WireSource", "BoundCells")
19  graph.connect(g, "BoundCells", "ChannelCellSelector",0,1)
20  graph.connect(g, "ChannelCellSelector", "CellSliceSink")
21  desc = nodetype.loads(open("nodedesc.json").read())
22  graph.validate(g, desc)
23 
24  ag = dot.gvgraph(g);
25  open("test_dfp_sim.dot","w").write(ag.string())
26  print check_output("dot -Tpdf -otest_dfp_sim.pdf test_dfp_sim.dot", shell=True)
27 
28  wcg = graph.wirecell_graph(g)
29  cfg = [dict(type= "TbbFlow", data=dict(dfp = "TbbDataFlowGraph", graph = wcg)),]
30 
31  json.dump(cfg, open("test_dfp_sim.cfg","w"), indent=2)
32 
33 if '__main__' == __name__:
35 
36 
int open(const char *, int)
Opens a file descriptor.
size_t write(int, const char *, size_t)
Writes count bytes from buf to the filedescriptor fd.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
int read(int, char *, size_t)
Read bytes from a file descriptor.
def test_gen_sim_dfp()
Definition: test_dfp_sim.py:5