from org.csstudio.opibuilder.scriptUtil import DataUtil, PVUtil, ConsoleUtil from java.lang import Thread, Runnable from math import cos, sin, pi class runInThread(Runnable): # Class to run the script on a thread. def run(self): temp_data = PVUtil.getDoubleArray(pvs[0]) pv0 = pvs[1] r=17.0 xyArray = DataUtil.createDoubleArray(int(r**2)) # Filling Upstream Dtheta = pi/180.0*(360.0/48.0) for i in range(48): x=r*(cos(Dtheta*float(i))/2.0 + 0.5) y=r*(sin(Dtheta*float(i))/2.0 + 0.5) # ConsoleUtil.writeInfo("%d"%(int(r*int(y) + int(x)) - 1)) # ConsoleUtil.writeInfo("%d\t%d\t%d"%(int(x),int(y),(int(r*int(y) + int(x)) - 1))) xyArray[int(r*(int(y)%int(r)) + int(x)%int(r))] = temp_data[i] pv0.setValue(xyArray) th = Thread(runInThread()) # Creating the thread. th.start() # Running the thread.