13 dce1 = db.DetectorCrateLink(detector=det, crate=cr1, address=42)
21 dce2 = det.add_crate(cr2, 40)
29 crate.add_wib(wib, slot)
32 for connector
in range(4):
35 wibs[0].add_board(board, connector)
39 for spot
in range(spots):
40 conductor = db.Conductor()
41 conductors.append(conductor)
42 boards[0].add_conductor(conductor, spot, layer)
48 boards[0].add_chip(chip, spot)
51 for address
in range(16):
53 chan = db.Channel(conductor=conductors[address])
55 chips[0].add_channel(chan, address)
62 det = ses.query(db.Detector).one()
65 print 'DET.crates:', det.crates
66 print 'DET.crate_links:', det.crate_links
67 print 'DET.crates[0].detectors:', det.crates[0].detectors
68 print 'DET.crates[1].detectors:', det.crates[1].detectors
70 assert det.crates[0].detectors[0] == det
72 assert det.crate_links[0].address == 40
73 assert det.crate_links[1].address == 42
75 assert det.crates[0] == det.crate_links[1].crate
76 assert det.crates[1] == det.crate_links[0].crate
78 crate42 = ses.query(db.DetectorCrateLink).\
79 filter(db.DetectorCrateLink.address==42).one().crate
81 assert crate42 == det.crate_links[1].crate
84 board = crate42.wibs[0].boards[0]
87 print board.conductors
91 for ch
in chip.channels:
92 print ch, ch.conductor
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.