def guess_conf(type, location, header): print >> sys.stderr, "l", location, "t", type if type.startswith("Obvius, A8812"): conf = {"sensors": [], "meters": [], "extra": {"Rate": 300}} if header: # make a guessed config based on the header for col in header: m = re.match("^(.*)\((.*)\)$", col) if m: name, unit = m.groups(0) for pat, rep in unit_replace: unit = re.sub(pat, rep, unit) name = name.strip() if name.endswith("Min") or \ name.endswith("Max") or \ name.startswith("time"): continue print "%s ... %s ... %s" % (col, name, unit) conf["sensors"].append( (col, MAYBEFLOATPAT, "", util.str_path(name), unit)) return conf # elif type.startswith("AcquiSuite 8811-1"): # if not header: return True # print header # elif type.startswith("Obvius, ModHopper, R9120"): # if not header: return True # print header return None
def setup(self, opts): self.restrict = opts.get("Restrict") self.group = opts.get("Group") self.opstr = opts.get("Operator") OperatorDriver.setup(self, opts, self.restrict, shelveoperators=False) # look up the streams, units, and group tags. client = SmapClient() streams = client.tags(self.restrict, '*') # 'uuid, Properties/UnitofMeasure, Metadata/SourceName, %s' % # self.group) #print streams groupitems = {} # find the groups for s in streams: if not s[self.group] in groupitems: groupitems[s[self.group]] = [] groupitems[s[self.group]].append(s) # instantiate one operator per group with the appropriate inputs for group, tags in groupitems.iteritems(): inputs = map(operator.itemgetter('uuid'), tags) op = self.operator_class(tags) path = '/' + util.str_path(group) self.add_operator(path, op)
def guess_conf(type, location, header): print >>sys.stderr, "l", location, "t", type if type.startswith("Obvius, A8812"): conf = { "sensors" : [], "meters" : [], "extra" : {"Rate": 300} } if header: # make a guessed config based on the header for col in header: m = re.match("^(.*)\((.*)\)$", col) if m: name, unit = m.groups(0) for pat, rep in unit_replace: unit = re.sub(pat, rep, unit) name = name.strip() if name.endswith("Min") or \ name.endswith("Max") or \ name.startswith("time"): continue print "%s ... %s ... %s" % (col, name, unit) conf["sensors"].append((col, MAYBEFLOATPAT, "", util.str_path(name), unit)) return conf # elif type.startswith("AcquiSuite 8811-1"): # if not header: return True # print header # elif type.startswith("Obvius, ModHopper, R9120"): # if not header: return True # print header return None