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


Python CAClient.cagetArrayByte方法代码示例

本文整理汇总了Python中gda.epics.CAClient.cagetArrayByte方法的典型用法代码示例。如果您正苦于以下问题:Python CAClient.cagetArrayByte方法的具体用法?Python CAClient.cagetArrayByte怎么用?Python CAClient.cagetArrayByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gda.epics.CAClient的用法示例。


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

示例1: WaveformPlotterClass

# 需要导入模块: from gda.epics import CAClient [as 别名]
# 或者: from gda.epics.CAClient import cagetArrayByte [as 别名]
class WaveformPlotterClass(object):
    def __init__(self, name, waveformPV, viewPanelName="Plot 2"):
        self.name = name;
        self.delay=1;
        self.chData=CAClient(waveformPV);
        self.configChannel(self.chData);

        self.width = 1024;
        self.height=768;
        self.panel=viewPanelName
        
    def __del__(self):
        self.cleanChannel(self.chData);

    def configChannel(self, channel):
        if not channel.isConfigured():
            channel.configure();

    def cleanChannel(self, channel):
        if channel.isConfigured():
            channel.clearup();
            
    def setShape(self, width, height):
        self.width = width
        self.height = height
    
    # Data from EPICS is signed 
    def imagePlot0(self, panel=None):
        if panel is None:
            panel=self.panel;
            
        da=self.chData.cagetArrayByte()
        ds = ByteDataset.createFromObject(da);
    
        newds=ds.reshape([self.height, self.width]);
    
        SDAPlotter.imagePlot(panel, newds);
    
    
    #Fast to get unsigned Byte from EPICS and plot
    def imagePlot(self, panel=None):
        if panel is None:
            panel=self.panel;
            
        da=self.chData.cagetArrayUnsigned();
        ds = IntegerDataset.createFromObject(da);
        newds=ds.reshape([self.height, self.width]);
    
        SDAPlotter.imagePlot(panel, newds);
    
    
    #Slow because of the signed to unsigned conversion
    def imagePlot2(self, panel=None):
        if panel is None:
            panel=self.panel;
            
        da=self.chData.cagetArrayByte();
        
        #To convert from singed to unsigned
        #method 2
        da=[x&0xff for x in da]
        
    #method 3
    #    ds1=array.array('B' [x&0xff for x in ds1] )
            
        ds = IntegerDataset.createFromObject(da);
        newds=ds.reshape([self.height, self.width]);
        
        SDAPlotter.imagePlot(panel, newds);
开发者ID:jjkraken,项目名称:gda-epics,代码行数:71,代码来源:EpicsWaveform.py


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