本文整理汇总了Python中org.csstudio.opibuilder.scriptUtil.PVUtil.getDoubleArray方法的典型用法代码示例。如果您正苦于以下问题:Python PVUtil.getDoubleArray方法的具体用法?Python PVUtil.getDoubleArray怎么用?Python PVUtil.getDoubleArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.csstudio.opibuilder.scriptUtil.PVUtil
的用法示例。
在下文中一共展示了PVUtil.getDoubleArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sqrt
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDoubleArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, DataUtil, ConsoleUtil
from math import sqrt
rms_pv = pvArray[1]
mean_pv = pvArray[2]
max_pv = pvArray[3]
min_pv = pvArray[4]
try:
y = PVUtil.getDoubleArray(pvArray[0])
rms_val = sqrt(sum([pow(y_i,2) for y_i in y])/len(y))
mean_val = sum(y)/len(y)
max_val = max(y)
min_val = min(y)
widget.getWidget("RMS").setPropertyValue("text", int(rms_val))
widget.getWidget("Mean").setPropertyValue("text", int(mean_val))
widget.getWidget("Max").setPropertyValue("text", int(max_val))
widget.getWidget("Min").setPropertyValue("text", int(min_val))
except:
pass
示例2: range
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDoubleArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, DataUtil
import math
ref_orbit_pv = pvArray[0]
bpm_pos_pv = pvArray[1]
orbit_pv = pvArray[2]
y_pv = pvArray[3]
try:
bpm_pos = PVUtil.getDoubleArray(bpm_pos_pv)
ref_orbit = PVUtil.getDoubleArray(ref_orbit_pv)
orbit = PVUtil.getDoubleArray(orbit_pv)
y = DataUtil.createDoubleArray(len(orbit))
for i in range(len(orbit)):
y[i] = orbit[i] - ref_orbit[i]
y_pv.setValue(y)
# Set y axis limits
abs_y = [math.fabs(i) for i in y]
default = 10
maximum = max(abs_y) if len(abs_y) > 0 else default
if maximum <= default:
widget.setPropertyValue("axis_1_maximum", default)
widget.setPropertyValue("axis_1_minimum", -default)
else:
widget.setPropertyValue("axis_1_maximum", maximum)
widget.setPropertyValue("axis_1_minimum", -maximum)
except:
pass
示例3: min
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDoubleArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, ConsoleUtil
table = widget.getTable()
times = PVUtil.getDoubleArray(pvs[0])
codes = PVUtil.getDoubleArray(pvs[1])
N = min(len(times), len(codes))
while table.getRowCount()<N:
table.insertRow(table.getRowCount())
while table.getRowCount()>N:
table.deleteRow(table.getRowCount()-1)
times, codes = times[:N], codes[:N]
for row,(T,C) in enumerate(zip(times, codes)):
table.setCellText(row,0,str(T))
table.setCellText(row,1,"%d"%C)
示例4: open
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDoubleArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil, DataUtil, FileUtil, ConsoleUtil
## Get Orbit Widgets Information
graph_orbit_x = display.getWidget("Graph Orbit X")
graph_orbit_y = display.getWidget("Graph Orbit Y")
orbit_x_pv = graph_orbit_x.getPV()
orbit_y_pv = graph_orbit_y.getPV()
## Save File
try:
try:
orbit_x = PVUtil.getDoubleArray(orbit_x_pv)
orbit_y = PVUtil.getDoubleArray(orbit_y_pv)
orbit_xy = orbit_x + orbit_y
except:
ConsoleUtil.writeError("Graphics PV must be defined. Choose a register first.")
raise
file = FileUtil.saveFileDialog(False)
widget.setPropertyValue("label", file)
orbit_xy_data = open(file, "w")
for data in orbit_xy:
orbit_xy_data.write("%s\n" % data)
orbit_xy_data.close()
except:
pass
示例5: str
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDoubleArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil,WidgetUtil,ConsoleUtil
import fnmatch
import nodeLoader
import array
import math
nodeLoader.readTree() #Read in the node tree
views=["B_SYS_HV"] #list of possible views
topnode = str(widget.getMacroValue("TOP")) #Get the top node
rangemode = str(widget.getMacroValue("SCALE")) #Get the scale for the (= Whole or Part)
title = str(widget.getMacroValue("TITLE")) #Get the title
node = PVUtil.getString(pvArray[0]) #Get the current node from local pv
rangepv = PVUtil.getDoubleArray(pvArray[1])
if node.find(topnode) <0: #if the node doesn't contain topnode
node = topnode #force to top
#ConsoleUtil.writeInfo("Node = "+node+" Top = "+topnode)
view=-1 #init index of view
for n in range(len(views)): #find the vew for this node
if node.find(views[n]) > -1:
view=n
if view > -1: #if it's a valid view
widget.setPropertyValue("axis_1_auto_scale","true")
if node in nodeLoader.NodeIndex: #check for node and get index
#ConsoleUtil.writeInfo("Node = "+node+" Top = "+topnode)
index = int(nodeLoader.NodeIndex[node])
erange = nodeLoader.ElementRange[index].strip("'")
示例6: int
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getDoubleArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil,WidgetUtil,ConsoleUtil
xcoords = PVUtil.getDoubleArray(pvArray[0])
ycoords = PVUtil.getDoubleArray(pvArray[1])
size = PVUtil.getDoubleArray(pvArray[2])
layer = PVUtil.getDoubleArray(pvArray[3])
wlayer = int(widget.getMacroValue("LAYER"))
#P = widget.getMacroValue("P")
s=16
#ConsoleUtil.writeInfo(str(xcoords[5]))
for n in range(0,232):
if not size[n]==999:
linkingContainer = WidgetUtil.createWidgetModel("org.csstudio.opibuilder.widgets.linkingContainer")
linkingContainer.setPropertyValue("opi_file", "tile.opi")
#linkingContainer.addMacro("ID",str(n))
linkingContainer.addMacro("ID", str(n).zfill(3))
linkingContainer.setPropertyValue("resize_behaviour", 2)
linkingContainer.setPropertyValue("border_style", 2)
l = int(layer[n])
ConsoleUtil.writeInfo(str(l) + " " + str(wlayer))
if l==wlayer:
side=s*size[n]
posx=(220+s*xcoords[n])
posy=(160-s*ycoords[n])
if size[n] ==1:
posy=posy+s
#ConsoleUtil.writeInfo(str(posx) + " " + str(posy))
linkingContainer.setPropertyValue("x", posx)
linkingContainer.setPropertyValue("y", posy)
linkingContainer.setPropertyValue("width", side)