本文整理汇总了Python中MDSplus.Data.compile方法的典型用法代码示例。如果您正苦于以下问题:Python Data.compile方法的具体用法?Python Data.compile怎么用?Python Data.compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDSplus.Data
的用法示例。
在下文中一共展示了Data.compile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Dispatch(dispatch_type=2)
ans.ident=self.ident.get_text()
try:
ans.ident=Data.compile(ans.ident)
except Exception:
pass
ans.phase=self.phase.get_text()
try:
ans.phase=Data.compile(ans.phase)
except Exception:
pass
try:
ans.when=Data.compile(self.sequence.get_text())
except Exception:
msg="Invalid sequence specified.\n\n%s" % (sys.exc_info()[1],)
MDSplusErrorMsg('Invalid Sequence',msg)
raise
ans.completion=self.event.get_text()
if ans.completion == '':
ans.completion=None
else:
try:
ans.completion=Data.compile(ans.event)
except Exception:
pass
return ans
示例2: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Window()
t=self.startIdx.get_text()
if t == '':
ans.startIdx=None
else:
try:
ans.startIdx=Data.compile(self.startIdx.get_text())
except Exception:
msg="Invalid startIdx specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid StartIdx',msg)
raise
t=self.endIdx.get_text()
if t == '':
ans.endIdx=None
else:
try:
ans.endIdx=Data.compile(self.endIdx.get_text())
except Exception:
msg="Invalid endIdx specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid EndIdx',msg)
raise
t=self.timeAt0.get_text()
if t != '':
try:
ans.timeAt0=Data.compile(self.timeAt0.get_text())
except Exception:
msg="Invalid timeAt0 specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid TimeAt0',msg)
raise
return ans
示例3: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Range()
t=self.begin.get_text()
if t == '':
ans.begin=None
else:
try:
ans.begin=Data.compile(self.begin.get_text())
except Exception:
msg="Invalid begin specified.\n\n%s" % (sys.exc_info()[1],)
MDSplusErrorMsg('Invalid Begin',msg)
raise
t=self.ending.get_text()
if t == '':
ans.ending=None
else:
try:
ans.ending=Data.compile(self.ending.get_text())
except Exception:
msg="Invalid ending specified.\n\n%s" % (sys.exc_info()[1],)
MDSplusErrorMsg('Invalid Ending',msg)
raise
t=self.delta.get_text()
if t != '':
try:
ans.delta=Data.compile(self.delta.get_text())
except Exception:
msg="Invalid delta specified.\n\n%s" % (sys.exc_info()[1],)
MDSplusErrorMsg('Invalid Delta',msg)
raise
return ans
示例4: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception,e:
pass
示例5: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Method()
ans.method=self.method.get_text()
try:
ans.method=Data.compile(ans.method)
except Exception,e:
pass
示例6: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Dispatch(dispatch_type=2)
ans.ident=self.ident.get_text()
try:
ans.ident=Data.compile(ans.ident)
except Exception,e:
pass
示例7: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Window()
t=self.startIdx.get_text()
if t == '':
ans.startIdx=None
else:
try:
ans.startIdx=Data.compile(self.startIdx.get_text())
except Exception,e:
msg="Invalid startIdx specified.\n\n%s" % (e,)
MDSplusErrorMsg('Invalid StartIdx',msg)
raise
示例8: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Range()
t=self.begin.get_text()
if t == '':
ans.begin=None
else:
try:
ans.begin=Data.compile(self.begin.get_text())
except Exception,e:
msg="Invalid begin specified.\n\n%s" % (e,)
MDSplusErrorMsg('Invalid Begin',msg)
raise
示例9: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Method()
ans.method=self.method.get_text()
try:
ans.method=Data.compile(ans.method)
except Exception:
pass
try:
ans.object=Data.compile(self.device.get_text())
except Exception:
msg="Invalid device specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Device',msg)
raise
if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
ans.timeout=None
else:
try:
ans.timeout=Data.compile(self.timeout.get_text())
except Exception:
msg="Invalid timeout specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Timeout',msg)
raise
idx=len(self.args)-1
found=False
while idx >= 0:
t = self.args[idx].get_text()
if t == '':
if found:
ans.setArgumentAt(idx,None)
else:
try:
a=Data.compile(t)
except Exception:
msg="Invalid argument (%d) specified.\n\n%s" % (idx+1,sys.exc_info(),)
MDSplusErrorMsg('Invalid Argument',msg)
raise
ans.setArgumentAt(idx,a)
found=True
idx=idx-1
return ans
示例10: getValue
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def getValue(self):
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception:
pass
ans.routine=self.routine.get_text()
try:
ans.routine=Data.compile(ans.routine)
except Exception:
pass
if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
ans.timeout=None
else:
try:
ans.timeout=Data.compile(self.timeout.get_text())
except Exception:
msg="Invalid timeout specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Timeout',msg)
raise
idx=len(self.args)-1
found=False
while idx >= 0:
t = self.args[idx].get_text()
if t == '':
if found:
ans.setArgumentAt(idx,None)
else:
try:
a=Data.compile(t)
except Exception:
msg="Invalid argument specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Argument',msg)
raise
ans.setArgumentAt(idx,a)
found=True
idx=idx-1
return ans
示例11: applyPart
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def applyPart(self,channel,field,idx):
value=channel[field].get_text()
if value == '':
value=None
else:
try:
value=Data.compile(value)
except Exception:
MDSplusErrorMsg('Invalid value','Error compiling %s for channel %d\n\n%s\n\n%s' % (field,idx,value,sys.exc_info()))
raise
try:
if channel[field+'Node'].compare(value) != 1:
channel[field+'Node'].record=value
except Exception:
MDSplusErrorMsg('Error storing value','Error storing value %s for channel %d\n\n\%s' % (field,idx,sys.exc_info()))
示例12: store
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def store(self, arg):
"""
Store the data from the device
Fetch and store the device status (firmware etc)
If the device is finished
For each channel that is on and active in the mask
read the data
store the data into the raw nodes
store the expression into the data nodes
"""
debug=os.getenv("DEBUG_DEVICES")
try:
boardip=self.check( 'str(self.boardip.record)', "Must specify a board ipaddress")
UUT = acq200.Acq200(transport.factory(boardip))
try:
ans = []
cmds = self.status_cmds.record
for cmd in cmds:
print cmd
a = UUT.uut.acq2sh(cmd)
ans.append(a)
self.board_status.record = Data.compile('build_signal($,*, $)', ans, cmds)
except Exception, e:
pass
complete = 0
tries = 0
if UUT.get_state().split()[-1] == "ST_RUN" :
raise Exception, "Device not Triggered \n device returned -%s-" % UUT.get_state().split()[-1]
if debug:
print "about to get the vins\n"
vins = self.getVins(UUT)
self.ranges.record = vins
(tot, pre, post, run) = UUT.get_numSamples()
pre = int(pre)
post = int(post)
mask = UUT.uut.acqcmd('getChannelMask').split('=')[-1]
if debug:
print "pre = %d, post = %d" % (pre, post, )
clock_src=self.check('self.clock_src.record.getOriginalPartName().getString()[1:]', "Clock source must be a string")
if clock_src == 'INT_CLOCK' or clock_src == 'MASTER' :
self.clock.record = Range(delta=1./self.getInternalClock(UUT))
else:
self.clock.record = self.clock_src
clock = self.clock.record
if debug:
print "about to start the script"
(fd,fname) = mkstemp('.sh')
f=open(fname, 'w')
f.write("#!/bin/sh\n")
f.write("touch /tmp/starting_%d\n" % self.boardip.tree.shot)
f.write("acqcmd --until ST_STOP\n")
f.write("mdsConnect %s\n" %str(self.hostip.record))
cmd = "mdsValue \"job_start('%s', %d)\"" % (self.path, self.tree.shot)
cmd = cmd.replace('\\', '\\\\\\\\\\\\\\')
f.write("%s\n"%( cmd,))
f.write("mdsOpen %s %d\n" % (self.boardip.tree.name, self.boardip.tree.shot,))
for chan in range(16) :
chan_node = eval('self.input_%2.2d' % (chan+1,))
chan_raw_node = eval('self.input_%2.2d_raw' % (chan+1,))
if chan_node.on :
if debug:
print "it is on so ..."
if mask[chan:chan+1] == '1' :
try:
start = eval("int(self.input_%2.2d_start_idx)"%(chan+1))
except:
start = pre
try:
end = eval("int(self.input_%2.2d_end_idx)"%(chan+1))
except:
end = post
try:
inc = eval("int(self.input_%2.2d_inc)"%(chan+1))
except:
inc = 1
if debug:
print "build the command"
command = "mdsPutCh --field %s:raw --expr %%calsig --timebase %d,%d,%d %d\n" % (chan_node.getFullPath(), int(start), int(end-start+1), int(inc), chan+1)
command = command.replace('\\','\\\\')
if debug:
print "about to execute %s" % command
f.write(command)
if inc > 1 :
clk=None
delta=None
begin=None
ending=None
try :
clk = self.clock.evaluate()
delta = clk.delta
begin = clk.begin
ending = clk.ending
except:
pass
if delta :
#.........这里部分代码省略.........
示例13: MDSplusErrorMsg
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception,e:
pass
ans.routine=self.routine.get_text()
try:
ans.routine=Data.compile(ans.routine)
except Exception,e:
pass
if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
ans.timeout=None
else:
try:
ans.timeout=Data.compile(self.timeout.get_text())
except Exception,e:
msg="Invalid timeout specified.\n\n%s" % (e,)
MDSplusErrorMsg('Invalid Timeout',msg)
raise
idx=len(self.args)-1
found=False
while idx >= 0:
t = self.args[idx].get_text()
if t == '':
if found:
ans.setArgumentAt(idx,None)
else:
try:
a=Data.compile(t)
except Exception,e:
示例14: store
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
#.........这里部分代码省略.........
c[group*8+2] = c[group*8+2]+1
if sampleCount >= currStartIdx and sampleCount <= currEndIdx :
channels[group*8+3][c[group*8+3]] = (segment.data[groupOffset+rpnt] & 0x00FFF000) >> 12
c[group*8+3] = c[group*8+3]+1
if sampleCount +1 >= currStartIdx and sampleCount + 1 <= currEndIdx :
channels[group*8+3][c[group*8+3]] = ((segment.data[groupOffset+rpnt] & 0xFF000000) >> 24) | ((segment.data[groupOffset+rpnt+1] & 0x0000000F) << 8)
c[group*8+3] = c[group*8+3]+1
if rpnt % 9 == 4:
if sampleCount +2 >= currStartIdx and sampleCount +2 <= currEndIdx :
channels[group*8+3][c[group*8+3]] = (segment.data[groupOffset+rpnt] & 0x0000FFF0) >> 4
c[group*8+3] = c[group*8+3]+1
if sampleCount >= currStartIdx and sampleCount <= currEndIdx :
channels[group*8+4][c[group*8+4]] = (segment.data[groupOffset+rpnt] & 0x0FFF0000) >> 16
c[group*8+4] = c[group*8+4]+1
if sampleCount +1 >= currStartIdx and sampleCount + 1 <= currEndIdx :
channels[group*8+4][c[group*8+4]] = ((segment.data[groupOffset+rpnt] & 0xF0000000) >> 28) | ((segment.data[groupOffset+rpnt+1] & 0x000000FF) << 4)
c[group*8+4] = c[group*8+4]+1
if rpnt % 9 == 5:
if sampleCount +2 >= currStartIdx and sampleCount +2 <= currEndIdx :
channels[group*8+4][c[group*8+4]] = (segment.data[groupOffset+rpnt] & 0x000FFF00) >> 8
c[group*8+4] = c[group*8+4]+1
if sampleCount >= currStartIdx and sampleCount <= currEndIdx :
channels[group*8+5][c[group*8+5]] = (segment.data[groupOffset+rpnt] & 0xFFF00000) >> 20
c[group*8+5] = c[group*8+5]+1
if rpnt % 9 == 6:
if sampleCount +1 >= currStartIdx and sampleCount + 1 <= currEndIdx :
channels[group*8+5][c[group*8+5]] = segment.data[groupOffset+rpnt] & 0x00000FFF
c[group*8+5] = c[group*8+5]+1
if sampleCount +2 >= currStartIdx and sampleCount +2 <= currEndIdx :
channels[group*8+5][c[group*8+5]] = (segment.data[groupOffset+rpnt] & 0x00FFF000) >> 12
c[group*8+5] = c[group*8+5]+1
if sampleCount >= currStartIdx and sampleCount <= currEndIdx :
channels[group*8+6][c[group*8+6]] = ((segment.data[groupOffset+rpnt] & 0xFF000000) >> 24) | ((segment.data[groupOffset+rpnt+1] & 0x0000000F) << 8)
c[group*8+6] = c[group*8+6]+1
if rpnt % 9 == 7:
if sampleCount +1 >= currStartIdx and sampleCount + 1 <= currEndIdx :
channels[group*8+6][c[group*8+6]] = (segment.data[groupOffset+rpnt] & 0x0000FFF0) >> 4
c[group*8+6] = c[group*8+6]+1
if sampleCount +2 >= currStartIdx and sampleCount +2 <= currEndIdx :
channels[group*8+6][c[group*8+6]] = (segment.data[groupOffset+rpnt] & 0x0FFF0000) >> 16
c[group*8+6] = c[group*8+6]+1
if sampleCount >= currStartIdx and sampleCount <= currEndIdx :
channels[group*8+7][c[group*8+7]] = ((segment.data[groupOffset+rpnt] & 0xF0000000) >> 28) | ((segment.data[groupOffset+rpnt+1] & 0x000000FF) << 4)
c[group*8+7] = c[group*8+7]+1
if rpnt % 9 == 8:
if sampleCount +1 >= currStartIdx and sampleCount + 1 <= currEndIdx :
channels[group*8+7][c[group*8+7]] = (segment.data[groupOffset+rpnt] & 0x000FFF00) >> 8
c[group*8+7] = c[group*8+7]+1
if sampleCount +2 >= currStartIdx and sampleCount +2 <= currEndIdx :
channels[group*8+7][c[group*8+7]] = (segment.data[groupOffset+rpnt] & 0xFFF00000) >> 20
c[group*8+7] = c[group*8+7]+1
if rpnt % 9 == 8:
sampleCount = sampleCount + 3
rpnt = rpnt + 1
#endwhile
groupOffset = groupOffset + groupSize
#endif
#endfor group in range(0:8)
#endfor samples in range(0, actSegments)
if len(TreeNode(baseNid + self.N_TRIG_SOURCE).getShape()) > 0:
dim = Dimension(Window(startIdx,endIdx+(actSegments - 1) * (endIdx - startIdx), trig[0]),Range(Float64Array(trig) + Float64(startIdx * dt), Float64Array(trig) + Float64(endIdx * dt), Float64Array(deltas)))
else:
dim = Dimension(Window(startIdx,endIdx+(actSegments - 1) * (endIdx - startIdx), trig),Range(Float64Array(triggers) - Float64(triggers[0]) + Float64(trig) + Float64(startIdx * dt), Float64Array(triggers) - Float64(triggers[0]) + Float64(trig) + Float64(endIdx * dt), Float64Array(deltas)))
print 'DIM: ', dim
dim.setUnits("s");
chan0Nid = baseNid + self.N_CHANNEL_0
data0Nid = baseNid + self.N_DATA_0
for group in range(0,8):
if groupMask & (1 << group):
try:
offset = TreeNode(baseNid + self.N_CHANNEL_0 + group * self.N_CHAN_DATA + self.N_CHAN_OFFSET).data()
except:
print 'Error evaluating group offset'
caenLib.CAENVME_End(handle)
return 0
for chan in range(0,8):
raw = Int16Array(channels[group * 8 + chan])
raw.setUnits("counts")
data = Data.compile("2*($VALUE - 2048)/4096.+$1", offset);
data.setUnits("Volts")
signal = Signal(data, raw, dim)
try:
TreeNode(baseNid + self.N_DATA_0 + group * 8 + chan).putData(signal)
except:
print 'Cannot write Signal in the tree'
caenLib.CAENVME_End(handle)
return 0
#endfor
#endif
#endfor
caenLib.CAENVME_End(handle)
return 1
except:
print 'Generic Error'
caenLib.CAENVME_End(handle)
return 0
示例15: store
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import compile [as 别名]
def store(self, arg):
"""
Store the data from the device
Fetch and store the device status (firmware etc)
If the device is finished
For each channel that is on and active in the mask
read the data
store the data into the raw nodes
store the expression into the data nodes
"""
debug=os.getenv("DEBUG_DEVICES")
try:
boardip=self.check( 'str(self.boardip.record)', "Must specify a board ipaddress")
UUT = acq200.Acq200(transport.factory(boardip))
try:
ans = []
cmds = self.status_cmds.record
for cmd in cmds:
print cmd
a = UUT.uut.acq2sh(cmd)
ans.append(a)
self.board_status.record = Data.compile('build_signal($,*, $)', a, cmds)
except Exception, e:
pass
complete = 0
tries = 0
while not complete and tries < 60 :
if UUT.get_state().split()[-1] == "ST_POSTPROCESS" :
tries +=1
sleep(1)
else:
complete=1
if UUT.get_state().split()[-1] != "ST_STOP" :
raise Exception, "Device not Triggered \n device returned -%s-" % UUT.get_state().split()[-1]
if debug:
print "about to get the vins\n"
vins = self.getVins(UUT)
self.ranges.record = vins
(tot, pre, post, run) = UUT.get_numSamples()
pre = int(pre)
post = int(post)
mask = UUT.uut.acqcmd('getChannelMask').split('=')[-1]
clock_src=self.check('self.clock_src.record.getOriginalPartName().getString()[1:]', "Clock source must be a string")
if clock_src == 'INT_CLOCK' :
self.clock.record = Range(delta=1./self.getInternalClock(UUT))
else:
self.clock.record = self.clock_src
clock = self.clock.record
if debug:
print "about to ask it to mdsconnect"
UUT.uut.acq2sh("mdsConnect %s" % str(self.hostip.record))
if debug:
print "about to ask it to mdsopen"
UUT.uut.acq2sh('mdsOpen %s %d' % (self.boardip.tree.name, self.boardip.tree.shot,))
for chan in range(32):
if debug:
print "working on channel %d" % chan
chan_node = eval('self.input_%2.2d' % (chan+1,))
chan_raw_node = eval('self.input_%2.2d_raw' % (chan+1,))
if chan_node.on :
if debug:
print "it is on so ..."
if mask[chan:chan+1] == '1' :
try:
start = eval('int(self.input_%2.2d:start_idx)'%chan+1)
except:
start = pre
try:
end = eval('int(self.input_%2.2d:end_idx)'%chan+1)
except:
end = post
try:
inc = eval('int(self.input_%2.2d:inc)'%chan+1)
except:
inc = 1
if debug:
print "build the command"
command = "mdsPutCh --field %s:raw --expr %%calsig --timebase %d,%d,%d %d" % (chan_node.getFullPath(), int(start), int(end), int(inc), chan+1)
command = command.replace('\\','\\\\')
if debug:
print "about to execute %s" % command
UUT.uut.acq2sh(command)
if inc > 1 :
clk=''
delta=''
begin=''
end=''
try :
clk = self.clock.evaluate()
delta = clk.delta
begin = clk.begin
ending = clk.end
except:
pass
if delta :
#.........这里部分代码省略.........