# Script used on developing # Orlando Soto, January 2014. from org.csstudio.opibuilder.scriptUtil import PVUtil pv0 = PVUtil.getDouble(pvs[0]) if (pv0 > 0): frequency = 100.0e6/(pv0) else: frequency = 100.0e6 if frequency/1e3 < 1: pvs[1].setValue("%.3f (Hz)" % frequency) elif frequency/1e6 < 1: pvs[1].setValue("%.3f (KHz)" % (frequency/1e3)) else: pvs[1].setValue("%.3f (MHz)" % (frequency/1e6)) widget.setPropertyValue('tooltip','Actual frequency\n' + 'pv_name: ' + str(pvs[0].getName()) + '\n' + 'pv_value: ' + str(pvs[0].getValue()))