-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanCoordinator.py
More file actions
71 lines (52 loc) · 2.25 KB
/
ScanCoordinator.py
File metadata and controls
71 lines (52 loc) · 2.25 KB
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
71
from copy import copy, deepcopy
from StaticDefs import DEF_ON_SYSTEMS, DEF_OFF_SYSTEMS, QD_AND_ACTIVE_SURFACE_ON_RCVRS
from StaticDefs import PFRCVRS, PF2RCVRS
from Manager import Manager
class ScanCoordinator(Manager):
"Responsiple for turning config into into manager parameters"
def __init__(self, config):
super(ScanCoordinator, self).__init__(config)
self.mgrName = 'ScanCoordinator'
self.DEFAULT = 'Default'
self.AS = 'ActiveSurface'
self.QD = 'QuadrantDetector'
def findParameterValues(self):
self.findSubsystemSelectValues()
# Misc stuff
self.seq.add_param(self.mgrName, 'switching_signals_master', self.config['backend'])
# TBF: Why?
self.seq.add_param(self.mgrName, 'scanLength,seconds', 1)
def findSubsystemSelectValues(self):
# what's the default always on managers?
onMgrs = deepcopy(DEF_ON_SYSTEMS[self.DEFAULT])
# then what's on for these observations?
onMgrs.append(self.config['backend'])
# convert PF receiver names to RcvrPF_1/2:
# onMgrs.append(config['receiver'])
rx = self.config['receiver']
if rx in PFRCVRS:
rx = 'RcvrPF_1'
if rx in PF2RCVRS:
rx = 'RcvrPF_2'
onMgrs.append(rx)
# will the QD and Active Surface mgrs be on?
qdActiveSurfaceOn = rx in QD_AND_ACTIVE_SURFACE_ON_RCVRS
if qdActiveSurfaceOn:
onMgrs.extend([self.QD, self.AS])
# set params for those that are off, but maybe should be on?
systems = deepcopy(DEF_OFF_SYSTEMS[self.DEFAULT])
if not qdActiveSurfaceOn:
systems.extend([self.QD, self.AS])
for mgr in systems:
onBool = mgr in onMgrs
on = 1 if onBool else 0
# param = ('ScanCoordinator,subsystemSelect,%s' % mgr, on)
# params.append(param)
self.seq.add_param(self.mgrName, 'subsystemSelect,%s' % mgr, on)
# make sure everything's covered
params = []
for mgr in onMgrs:
param = (self.mgrName, 'subsystemSelect,%s' % mgr, 1)
if param not in params:
params.append(param)
self.seq.add_param(self.mgrName, param[1], 1)