def datum(self, sample): if not sample.has_path(self.__path): return None try: rec_node = sample.node('rec') except KeyError: return None rec = LocalizedDatetime.construct_from_jdict(rec_node) value = sample.node(self.__path) self.__func.append(rec, value) if not self.__func.has_regression(): return None slope, intercept = self.__func.line() if slope is None: return None target = PathDict() if sample.has_path('rec'): target.copy(sample, 'rec') target.append(self.__path + '.src', value) target.append(self.__path + '.slope', round(slope, self.__precision)) target.append(self.__path + '.intercept', round(intercept, self.__precision)) return target.node()
def datum(self, sample): if not sample.has_path(self.__path): return None rec = LocalizedDatetime.construct_from_jdict(sample.node('rec')) value = sample.node(self.__path) self.__func.append(rec, value) if not self.__func.has_tally(): return None slope, intercept = self.__func.compute() if slope is None: return None target = PathDict() target.copy(datum, 'rec') target.append(self.__path + '.src', value) target.append(self.__path + '.slope', round(slope * 60 * 60, 6)) # x-scale is hours target.append(self.__path + '.intercept', round(intercept, 6)) return target.node()
def datum(self, datum): we_v = float(datum.node(self.__path + '.weV')) ae_v = float(datum.node(self.__path + '.aeV')) diff = we_v - ae_v conversion = (diff * 1000) / float( self.__sensitivity ) # value [ppb] = raw [mV] / sensitivity [mV / ppb] target = PathDict() target.copy(datum, 'rec', self.__path + '.weV', self.__path + '.aeV') target.append(self.__path + '.diff', round(diff, 6)) target.append(self.__path + '.conv', round(conversion, 6)) return target.node()
def datum(self, datum): latest = float(datum.node(self.__path)) if self.__aggregate is None: self.__aggregate = latest return None self.__aggregate = (0.9 * self.__aggregate) + (0.1 * latest) error = latest - self.__aggregate target = PathDict() target.copy(datum, 'rec') target.append(self.__path + '.src', latest) target.append(self.__path + '.agr', round(self.__aggregate, 6)) target.append(self.__path + '.err', round(error, 6)) return target.node()
def datum(self, sample): if not sample.has_path(self.__path): return None value = sample.node(self.__path) self.__func.append(value) avg = self.__func.compute() if avg is None: return None target = PathDict() if sample.has_path('rec'): target.copy(sample, 'rec') target.append(self.__path + '.src', value) target.append(self.__path + '.avg', round(avg, self.__precision)) return target.node()
def datum(self, sample): latest = float(sample.node(self.__path)) if self.__aggregate is None: self.__aggregate = latest return None self.__aggregate = (0.9 * self.__aggregate) + (0.1 * latest) error = latest - self.__aggregate target = PathDict() if sample.has_path('rec'): target.copy(sample, 'rec') target.append(self.__path + '.src', latest) target.append(self.__path + '.agr', round(self.__aggregate, self.__precision)) target.append(self.__path + '.err', round(error, self.__precision)) return target.node()
def datum(self, sample): if not sample.has_path(self.__path): return None value = sample.node(self.__path) self.__func.append(value) if not self.__func.has_tally(): return None avg = self.__func.compute() if avg is None: return None target = PathDict() target.copy(datum, 'rec') target.append(self.__path + '.src', value) target.append(self.__path + '.avg', round(avg, 6)) return target.node()
datum = PathDict.construct_from_jstr(line) if datum is None: break document_count += 1 value = datum.node(cmd.path) if value is None: break target = PathDict() if datum.has_path('rec'): target.copy(datum, 'rec') target.append(cmd.path + '.src', value) target.append(cmd.path + '.lpf', round(lpf.line(value), cmd.precision)) print(JSONify.dumps(target.node())) sys.stdout.flush() processed_count += 1 # ---------------------------------------------------------------------------------------------------------------- # end... except KeyboardInterrupt: if cmd.verbose:
node = datum.node(path) print("node:%s" % node) except Exception as ex: print(type(ex).__name__) print("=") # -------------------------------------------------------------------------------------------------------------------- target = PathDict() print(target) print("-") print(datum) print("-") target.copy(datum, "rec") print(target) print("-") path1 = "val.opc.bin1.0" print(path1) print("-") path2 = "val.opc.bin2" print(path2) print("-") path3 = "val.opc.bin1.1" print(path3) print("-")
datum = PathDict(jdict) print(datum) print("=") # -------------------------------------------------------------------------------------------------------------------- target = PathDict() print(target) print("-") print(datum) print("-") target.copy(datum) print(target) print("-") path1 = "val.opc.bin1.0" print(path1) print("-") path2 = "val.opc.bin2" print(path2) print("-") path3 = "val.opc.bin1.1" print(path3) print("-")
print("-") datum = PathDict(jdict) print(datum) print("=") # -------------------------------------------------------------------------------------------------------------------- target = PathDict() print(target) print("-") print(datum) print("-") target.copy(datum) print(target) print("-") path1 = "val.opc.bin1.0" print(path1) print("-") path2 = "val.opc.bin2" print(path2) print("-") path3 = "val.opc.bin1.1" print(path3) print("-")
print("node:%s" % node) except Exception as ex: print(type(ex).__name__) print("=") # -------------------------------------------------------------------------------------------------------------------- target = PathDict() print(target) print("-") print(datum) print("-") target.copy(datum, "rec") print(target) print("-") path1 = "val.opc.bin1.0" print(path1) print("-") path2 = "val.opc.bin2" print(path2) print("-") path3 = "val.opc.bin1.1" print(path3) print("-")
print("node: %s" % node) print("=") # -------------------------------------------------------------------------------------------------------------------- # Copying... target = PathDict() print("target: %s" % target) print("-") print("datum: %s" % datum) jstr = JSONify.dumps(datum) print(jstr) print("-") target.copy(datum, "rec") print("target + rec: %s" % target) jstr = JSONify.dumps(target) print(jstr) print("-") target.copy(datum, "val.opc_n2.bin2:0:1") print("target + val.opc_n2.bin2:0:1: %s" % target) jstr = JSONify.dumps(target) print(jstr) print("=") target = PathDict() print("target: %s" % target) print("-")