本文整理汇总了Python中org.csstudio.opibuilder.scriptUtil.PVUtil.getLong方法的典型用法代码示例。如果您正苦于以下问题:Python PVUtil.getLong方法的具体用法?Python PVUtil.getLong怎么用?Python PVUtil.getLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.csstudio.opibuilder.scriptUtil.PVUtil
的用法示例。
在下文中一共展示了PVUtil.getLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
def main():
if spectrumPv.isConnected():
spectrum = PVUtil.getLong(spectrumPv)
if spectrum is None:
spectrum = 1
else:
spectrum = 1
if periodPv.isConnected():
period = PVUtil.getLong(periodPv)
if period is None:
period = 1
else:
period = 1
if modePv.isConnected() and PVUtil.getString(modePv).lower() == "counts":
mode = "YC"
axis_title = "Counts"
else:
mode = "Y"
axis_title = "Counts/us"
widget.setPropertyValue("trace_0_x_pv","$(P)DAE:SPEC:" + str(period) + ":" + str(spectrum) + ":X")
widget.setPropertyValue("trace_0_y_pv","$(P)DAE:SPEC:" + str(period) + ":" + str(spectrum) + ":" + mode)
widget.setPropertyValue("axis_1_axis_title", axis_title)
示例2: getWidgetPVLong
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
def getWidgetPVLong(display, widget):
"""Fetch value of a widget's PV
@param display BOY Display
@param widget Widget name
@return Value of that PV as long
"""
pv = display.getWidget(widget).getPV()
return PVUtil.getLong(pv);
示例3: run
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
def run(self):
i=0
while PVUtil.getLong(pvs[2]) ==1:
Thread.sleep(500)
timerLabel.setPropertyValue("foreground_color",
ColorFontUtil.YELLOW if i%2==0 else ColorFontUtil.RED)
i=i+1
timerLabel.setPropertyValue("foreground_color", ColorFontUtil.BLACK)
示例4: main
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
def main():
# Ampl
if PVUtil.getLong(pvs[0]) == 1:
graph = "TopGraph"
# CAV Ampl
offset1 = PVUtil.getDouble(pvs[7])
one = PVUtil.getDouble(pvs[1])
# FWD Ampl
offset2 = PVUtil.getDouble(pvs[8])
two = PVUtil.getDouble(pvs[2])
# REV Ampl
offset3 = PVUtil.getDouble(pvs[9])
three = PVUtil.getDouble(pvs[3])
# Phase
if PVUtil.getLong(pvs[0]) == 2:
graph = "BottomGraph"
# CAV Phase offset and magnitude
offset1 = PVUtil.getDouble(pvs[10])
one = PVUtil.getDouble(pvs[4])
# FWD Phase offset and magnitude
offset2 = PVUtil.getDouble(pvs[11])
two = PVUtil.getDouble(pvs[5])
# REV Phase offset and magnitude
offset3 = PVUtil.getDouble(pvs[12])
three = PVUtil.getDouble(pvs[6])
# Execute the commands only if the button has been pressed
if PVUtil.getLong(pvs[0]) != 0:
# Get the graph widget and turn off autoscale
display.getWidget(graph).setPropertyValue("axis_1_auto_scale", "0")
display.getWidget(graph).setPropertyValue("axis_2_auto_scale", "0")
display.getWidget(graph).setPropertyValue("axis_3_auto_scale", "0")
# Set the max and min values of the y-axis
display.getWidget(graph).setPropertyValue("axis_1_maximum", one + offset1)
display.getWidget(graph).setPropertyValue("axis_1_minimum", one - offset1)
display.getWidget(graph).setPropertyValue("axis_2_maximum", two + offset2)
display.getWidget(graph).setPropertyValue("axis_2_minimum", two - offset2)
display.getWidget(graph).setPropertyValue("axis_3_maximum", three + offset3)
display.getWidget(graph).setPropertyValue("axis_3_minimum", three - offset3)
# Reset the rescale action indicator to 0
pvs[0].setValue(0)
示例5: main
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
def main():
# Get current PV value
curr = PVUtil.getLong(get_pv)
# If currently 0, then set to 1
if curr == 0:
print "Setting to 1"
set_pv.setValue(1)
# If currently 1, then set to 0
if curr == 1:
print "Setting to 0"
set_pv.setValue(0)
示例6: int
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
box = 1
while box < 20:
level = 0
while level < 5:
channel = 0
while channel < 8:
getpv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:WriteInUse" % (box, level, channel))
newvalue = PVUtil.getLong(getpv)
print newvalue
newvalue = int(newvalue)
setpv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:InUse" % (box, level, channel))
setpv.setValue(newvalue)
channel+=1
level+=1
box+=1
示例7:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
#!/bin/python
# Description: Automatically turn on or off the frequency offset
# based on the frequency offset value
from org.csstudio.opibuilder.scriptUtil import PVUtil
# pvs[0] = $(TS)$(LLRF):DRV0:sel2_phstep_ao
# pvs[1] = $(TS)$(LLRF):DRV0:sel2_dds_bo
# Get the scalar value
val = PVUtil.getLong(pvs[0])
# Set the boolean value based on this:
if val != 0:
pvs[1].setValue(1) # Turn it on
elif val == 0:
pvs[1].setValue(0) # Turn it off
示例8:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil
macroInput = DataUtil.createMacrosInput(True)
boxpv = widget.getPVByName("loc://monitor_box")
boxnumber = PVUtil.getLong(boxpv)
macroInput.put("BOXNO", "%s" % boxnumber)
macroInput.put("BOX", "BOX:%s" % boxnumber)
macroInput.put("P", "CB:CB:HV")
widgetController.setPropertyValue("macros", macroInput)
widgetController.setPropertyValue("opi_file",
widgetController.getPropertyValue("opi_file"), True)
示例9: Thread
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
if not display.isActive():
return
if PVUtil.getLong(pvs[0])==0:
stopped = True
break
pvs[1].setValue(100-100*i/total)
hourPV.setValue(int(i/3600))
minPV.setValue(int(i%3600/60))
secPV.setValue(int(i%60))
Thread.sleep(1000)
timerLabel.setPropertyValue("foreground_color", ColorFontUtil.RED)
if stopped:
timerLabel.setPropertyValue("text", "Interrupted!")
else:
timerLabel.setPropertyValue("text", "Time's Up!!!")
widget.executeAction(0)
pvs[2].setValue(1)
Thread(Blink()).start()
startButton.setEnabled(True)
stopButton.setEnabled(False)
resetButton.setEnabled(True)
bar.setVisible(False)
hourText.setEnabled(True)
minText.setEnabled(True)
secText.setEnabled(True)
if PVUtil.getLong(pvs[0])==1:
thread =Thread(Timer());
thread.start()
示例10: run
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
def run(self):
#this method must be called in UI thread
intensityGraph.setROIDataBounds(name, PVUtil.getLong(roiXPV), PVUtil.getLong(roiYPV), PVUtil.getLong(roiWPV),PVUtil.getLong(roiHPV))
示例11: len
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil,WidgetUtil,ConsoleUtil
import nodeLoader
from java.util import Arrays
#This is the code to update the list of items in combo widget to chose a node
#in the CLAS EPICS tree.
#It is triggered by selection of a new node using the local PV loc://$(DID)_NODE
#It makes the item list of all the ancestors, the node, and the subnodes
nodeLoader.readTree() #make sure the node tree is made
nodefull = PVUtil.getString(pvArray[0]) #Full name of the node Eg. B_SYS_HV_ECAL_SEC1
nodetot = PVUtil.getLong(pvArray[1]) #Total no of nodes clicked on
topnode = widget.getMacroValue("TOP") #Name of the top node Eg. B_SYS_HV
ntop = len(topnode.split("_")) #Work out the no of levels in the top node (eg. 3 here)
if nodefull.find(topnode) < 0: #if topnode not in fullnode
nodefull=topnode #set to topnode
nlist = nodefull.split("_") #Split the full nodename into a list
node = topnode #Start off the node that this combo will display
itemlist = [] #start off the itemlist
if nodefull == topnode:
parent = topnode
itemlist.append(topnode) #Append to the item list
else:
for t in range(ntop,len(nlist)): #Construct it's node name
itemlist.append(node) #Append to the item list
parent = node
示例12:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
widgetname = widget.getPropertyValue("pv_name")
nameparts = widgetname.split(":")
pvname = "CB:CB:HV:BOX:%s:%s:%s:InUse" % (nameparts[4],nameparts[5],nameparts[6])
pv = widget.getPVByName("%s" % pvname)
newpvvalue = -1
pvvalue = PVUtil.getLong(pv)
if pvvalue == 0:
newpvvalue = 1
elif pvvalue == 1:
newpvvalue = 0
pv = widget.getPVByName("%s" % pvname)
print pv
pv.setValue(newpvvalue)
示例13:
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import DataUtil
macroInput = DataUtil.createMacrosInput(True)
pvvalue = widget.getPVByName("loc://channel_in_use")
boxnumber = PVUtil.getLong(pvvalue)
macroInput.put("BOXNO", "%s" % boxnumber)
macroInput.put("BOX", "BOX:%s" % boxnumber)
macroInput.put("P", "CB:CB:HV")
widgetController.setPropertyValue("macros", macroInput)
widgetController.setPropertyValue("opi_file",
widgetController.getPropertyValue("opi_file"), True)
示例14: open
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
f= open(file, "w")
box = 1
while box < 20:
level = 0
while level < 5:
channel = 0
while channel < 8:
voltage_pv = widget.getPVByName("CB:CB:HV:BOX:%s:%s:%s:LatestSetVolt" % (box, level, channel))
voltage = PVUtil.getLong(voltage_pv)
f.write("%s %s %s %s\n" % (box, level, channel, voltage))
channel+=1
level+=1
box+=1
f.close()
filename_pv.setValue("")
filepath_pv.setValue("")
if save_load_option == "Save channel usage configuration":
示例15: str
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getLong [as 别名]
# binary. All paths will be relative to this location.
# Originally this was a shell script, but I changed it to a Python script
# because it made path finding much easier. I can tell CSS BOY to
# execute from $(user.dir), which is where css was executed
# Get the file save duration time as a variable
# This is run from ops/cavCtl/css/CSS_EPICS/
p = subprocess.Popen(["../../sdds/caget_v2", "-t", "LLRF4:FILE0:FileDurTime"], stdout=subprocess.PIPE, cwd=css_dir)
wait = p.communicate()[0]
# Add 2 seconds to the total wait time and sleep for that time
time.sleep(float(wait) + 2)
# Get the local welch values
welch1 = str(PVUtil.getLong(display.getWidget("welch1").getPV()))
welch2 = str(PVUtil.getLong(display.getWidget("welch2").getPV()))
# Get the absolute path of the plotPSD script
# This is run from the css/CSS_EPICS directory
plotpath = os.path.normpath(os.path.join(css_dir, "../../sdds/plotPSD"))
# Get the data file path as a string
p = subprocess.Popen(
["../../sdds/caget_v2", "-St", "LLRF4:FILE0:FullFileName_RBV"], stdout=subprocess.PIPE, cwd=css_dir
)
filepath = p.communicate()[0] # Get the output of the above command
# If this PV is given a relative path, then the IOC treats it relative to the
# location where the IOC was started. I can't get this info, so I can't
# handle relative paths. Only absolute paths work
# filepath = os.path.abspath(filepath)