Post extraction python scripts

# A python module that make calculation on HdbData and create calculated attribute
# Input data value: [s,us,type,val]
# s = numer of second since epoch
# us = micro second
# type = HdbType (see org.tango.jhdb.HdbSigInfo)
# val = value (double, double array or string accroding to type, all nummerical type are converted to double)

from HDBViewer import PyHDBInterface

class PyHDBInterface(PyHDBInterface):

	def __init__(self, nb, data):

		# Input parameters
		self.nb = nb		# number of attributes = data	# Attribute data [["Att1",length,[s,us,type,val],[s,us,type,val],...],["Att2",...]

		# Check input data
		if nb != 2:
			raise Exception("Invalid input argument")

		length1 = data[0][1]
		length2 = data[1][1]

		if length1 != length2:
			raise Exception("Length must be equal")

		self.length = length1

	def getResult(self):

		# Build output (formatted as input)
		# make the sum of the 2 input attributes
		sum = ["Sum",self.length]
		for i in range(0,self.length):
			t0 =[0][2+i][0]
			us =[0][2+i][1]
			_type =[0][2+i][2]
			sval =[0][2+i][3] +[1][2+i][3]
			val = [t0,us,_type,sval]

		output = [sum]
		return output

Link to HDB java doc:

Previous topic

Welcome to HDB++ Viewer’s documentation!

This Page