-
Notifications
You must be signed in to change notification settings - Fork 2
/
acq400_caploop_rtrig.py
executable file
·74 lines (55 loc) · 2.04 KB
/
acq400_caploop_rtrig.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
""" capture loop test
acq400_caploop UUT1 [UUT2 ..]
where UUT1 is the ip-address or host name of first uut
example test client runs captures in a loop on one or more uuts
pre-requisite: UUT's are configured and ready to make a transient
capture
eg clk is running. soft trg enabled
eg transient length set.
"""
import sys
import acq400_hapi
import argparse
class RemoteTrigger:
def __init__(self, uut):
self.uut = acq400_hapi.Acq400(uut)
def __call__(self):
print("{} trigger".format(self.uut.uut))
self.uut.s0.soft_trigger = 1
def run_shots(args):
uuts = [ acq400_hapi.Acq400(u) for u in args.uuts ]
acq400_hapi.cleanup.init()
for uut in uuts:
uut.s1.shot = 0
if hasattr(uut.s0, 'TIM_CTRL_LOCK'):
print "LOCKDOWN {}".format(uut)
uut.s0.TIM_CTRL_LOCK = 1
shot_controller = acq400_hapi.ShotController(uuts)
shot = 0
if args.trigger_uut != None:
_remote_trigger = RemoteTrigger(args.trigger_uut)
_soft_trigger = False
else:
_remote_trigger = None
_soft_trigger = True
try:
while shot < args.nshots:
print("shot {} of {}".format(shot, args.nshots))
shot_controller.run_shot(
remote_trigger=_remote_trigger,
soft_trigger=_soft_trigger)
shot += 1
except acq400_hapi.cleanup.ExitCommand:
print("ExitCommand raised and caught")
finally:
print("Finally, going down")
def run_main():
parser = argparse.ArgumentParser(description='acq400 looptest')
parser.add_argument('--trigger_uut', default=None, type=str, help="external trigger uut eg ACQ1001+DIO, soft_trigger brought to front panel" )
parser.add_argument('--nshots', default=9999999, type=int, help="number of shots, default infinit")
parser.add_argument('uuts', nargs='+', help="uuts")
run_shots(parser.parse_args())
# execution starts here
if __name__ == '__main__':
run_main()