当前位置: 首页>>代码示例>>Python>>正文


Python MDSplus.Data类代码示例

本文整理汇总了Python中MDSplus.Data的典型用法代码示例。如果您正苦于以下问题:Python Data类的具体用法?Python Data怎么用?Python Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getValue

 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
开发者ID:LucyScott,项目名称:mdsplus,代码行数:31,代码来源:mdspluswindowwidget.py

示例2: init

 def init(self,arg):
     """Initialize digital outputs of CP7452 cpci board.
     Connects to the host and for each of the DIGITAL_OUTS nodes which are turned on, write the value to the digital output.
     """
     import os
     from MDSplus import Uint32
     debug=os.getenv("DEBUG_DEVICES")
     try:
         host=str(self.node.record.data())
     except:
         host='local'
     if Data.execute('mdsconnect($)',host) == 0:
         raise Exception,"Error connecting to host: "+host
     board=int(self.board.record)
     for i in range(4):
         do_nid=self.__getattr__('digital_outs_do%d'%(i,))
         if do_nid.on:
             try:
                 exp='MdsValue("_lun=fopen(\\\"/sys/module/cp7452_drv/parameters/format\\\",\\\"r+\\"); write(_lun,\\\"1\\\"); fclose(_lun);'
                 exp=exp+'_lun=fopen(\\\"/dev/cp7452.%d/DO%d\\\",\\\"r+\\\"); write(_lun,\\\"%x\\\"); fclose(_lun)")' % (board,i,int(Uint32(do_nid.record.data()).data()))
                 if debug:
                     print exp
                 Data.execute(exp)
             except Exception,e:
                 print "Error outputing to DO%d\n\t%s" % (i,str(e),)
开发者ID:LucyScott,项目名称:mdsplus,代码行数:25,代码来源:cp7452.py

示例3: getValue

 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
开发者ID:MDSplus,项目名称:Python-TDISHR,代码行数:27,代码来源:mdsplussequentialwidget.py

示例4: store

 def store(self,arg):
     """Stores the digital input values into the tree.
     Connects to the host and for each of the DIGITAL_INS nodes which are turned on, read the digital input and store the value in the node.
     """
     import os
     debug=os.getenv("DEBUG_DEVICES")
     try:
         host=str(self.node.record.data())
     except:
         host='local'
     if Data.execute('mdsconnect($)',host) == 0:
         raise Exception,"Error connecting to host: "+host
     board=int(self.board.record)
     for i in range(4):
         di_nid=self.__getattr__('digital_ins_di%d'%(i,1))
         if di_nid.on:
             try:
                 exp='MdsValue("_lun=fopen(\\\"/sys/module/cp7452_drv/parameters/format\\\",\\\"r+\\\"); write(_lun,\\\"1\\\"); fclose(_lun);'
                 exp=exp+'_lun=fopen(\\\"/dev/cp7452.%d/DI%d\\\",\\\"r\\\"); _ans=read(_lun); fclose(_lun),_ans")' % (board,i)
                 if debug:
                     print exp
                 value=eval('0x'+str(Data.execute(exp)))
                 di_nid.record=value
             except Exception,e:
                 print "Error inputting from DI%d\n\t%s" % (i,str(e),)
开发者ID:LucyScott,项目名称:mdsplus,代码行数:25,代码来源:cp7452.py

示例5: getValue

 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
开发者ID:MDSplus,项目名称:Python-TDISHR,代码行数:31,代码来源:mdsplusrangewidget.py

示例6: getValue

 def getValue(self):
     ans=Routine()
     ans.image=self.image.get_text()
     try:
         ans.image=Data.compile(ans.image)
     except Exception,e:
         pass
开发者ID:dgarnier,项目名称:MDSplus-forked,代码行数:7,代码来源:mdsplusroutinewidget.py

示例7: getValue

 def getValue(self):
     ans=Method()
     ans.method=self.method.get_text()
     try:
         ans.method=Data.compile(ans.method)
     except Exception,e:
         pass
开发者ID:dgarnier,项目名称:MDSplus-forked,代码行数:7,代码来源:mdsplusmethodwidget.py

示例8: getValue

 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
开发者ID:dgarnier,项目名称:MDSplus-forked,代码行数:7,代码来源:mdsplussequentialwidget.py

示例9: execPy

def execPy(varname=None,traceback=False):
    """Get array of python commands from tdi public variable ___TDI___cmds
    and execute them. The ___TDI___cmds variable should be either a scalar string
    or a string array. If varname is defined
    then set the tdi public variable ___TDI___answer to the value of the variable
    with the name specified in varname. If varname is not defined
    then set public variable ___TDI___answer to 1 if there is no exception. If there
    is an exception then set public variable ___TDI___exception to be the
    exception string.
    """
    from MDSplus import Data as ___TDI___Data,makeData as ___TDI___makeData,String as ___TDI___String
    try:
        cmds=list()
        for cmd in ___TDI___Data.getTdiVar('___TDI___cmds'):
            cmds.append(str(cmd))
        cmds="\n".join(cmds)
        isglobal=False
        try:
          if int(___TDI___Data.getTdiVar('___TDI___global_ns'))==1:
            isglobal=True
        except:
            pass
        ans=1
        if isglobal:
          exec( cmds) in globals()
          if varname is not None:
            if varname in globals():
              ans=globals()[varname]
            else:
              ans=None
        else:
       	  ns={}
          exec( cmds) in ns
          if varname is not None:
            if varname in ns:
              ans=ns[varname]
            else:
              ans=None

        ___TDI___makeData(ans).setTdiVar("___TDI___answer")
    except Exception:
        if traceback:
          _tb.print_exc()
        import sys
        e=sys.exc_info()[1]    
        ___TDI___String("Error: "+str(e)).setTdiVar("___TDI___exception")
开发者ID:LucyScott,项目名称:mdsplus,代码行数:46,代码来源:tdipy.py

示例10: getValue

 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
开发者ID:dgarnier,项目名称:MDSplus-forked,代码行数:12,代码来源:mdsplusrangewidget.py

示例11: getValue

 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
开发者ID:dgarnier,项目名称:MDSplus-forked,代码行数:12,代码来源:mdspluswindowwidget.py

示例12: getValue

 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
开发者ID:LucyScott,项目名称:mdsplus,代码行数:40,代码来源:mdsplusmethodwidget.py

示例13: getValue

 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
开发者ID:LucyScott,项目名称:mdsplus,代码行数:39,代码来源:mdsplusroutinewidget.py

示例14: applyPart

 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()))
开发者ID:LucyScott,项目名称:mdsplus,代码行数:15,代码来源:mdsplusdigchans.py

示例15: do1darray

def do1darray(self):
    if len(self.path_parts) > 2:
        self.openTree(self.path_parts[1],self.path_parts[2])
    expr=self.args['expr'][-1]
    try:
        a=makeData(Data.execute(expr).data())
    except Exception:
        raise Exception("Error evaluating expression: '%s', error: %s" % (expr,sys.exc_info()))
    response_headers=list()
    response_headers.append(('Cache-Control','no-store, no-cache, must-revalidate'))
    response_headers.append(('Pragma','no-cache'))
    response_headers.append(('DTYPE',a.__class__.__name__))
    response_headers.append(('LENGTH',str(len(a))))
    if self.tree is not None:
        response_headers.append(('TREE',self.tree))
        response_headers.append(('SHOT',self.shot))
    output=str(a.data().data)
    status = '200 OK'
    return (status, response_headers, output)
开发者ID:LucyScott,项目名称:mdsplus,代码行数:19,代码来源:do1darray.py


注:本文中的MDSplus.Data类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。