calibrator.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pslab-desktop-apps 作者: fossasia 项目源码 文件源码
def __init__(self, parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I=kwargs.get('I',None)
        self.INPUTS=['CH1','CH2','CH3']
        self.calibrateOnlyADC = True #DACs will have to calibrated against the ADCs later
        self.type1text = 'PV3->(AN8 or CAP, AIN7), PV2->CH1,2,3,AIN6 , PV1->AIN5'
        self.type2text = 'PV3->(AN8 or CAP, AIN7), PV1->(AIN6, CH1,CH2,CH3), '

        self.setType(0)
        self.A = acquirer(self)
        self.INLBox.setCurrentIndex(1)
        self.typeSelectBox.setCurrentIndex(1)
        self.hexid = hex(self.I.device_id())
        self.savedir = os.path.join('.',self.hexid)

        self.setWindowTitle(self.I.generic_name + ' : '+self.I.H.version_string.decode("utf-8")+' : '+self.hexid)

        for a in range(8):
            item = QtGui.QTableWidgetItem()
            self.valueTable.setItem(0,a,item)
            item.setText('.')

        self.plot=self.add2DPlot(self.plot_area)
        labelStyle = {'color': 'rgb(255,255,255)', 'font-size': '11pt'}
        self.plot.setLabel('left','Read Voltages -->', units='V',**labelStyle)
        self.plot.setLabel('bottom','Actual Voltage -->', units='V',**labelStyle)
        #self.plot.setYRange(-.1,.1)
        self.curves={}

        self.curves['INL']=self.addCurve(self.plot,pen=pg.mkPen([255,255,255], width=1),name='INL')
        item = self.addLabel('INL',[255,255,255]);  self.curves['INL'].curve.setClickable(True);    self.curves['INL'].sigClicked.connect(functools.partial(self.selectItem,item))

        self.curves['PV3']=self.addCurve(self.plot,pen=pg.mkPen([255,255,255], width=1),name='PV3')
        item = self.addLabel('PV3',[255,255,255]); self.curves['PV3'].curve.setClickable(True); self.curves['PV3'].sigClicked.connect(functools.partial(self.selectItem,item))


        for a in self.INPUTS:
            self.curves[a]={}
            if self.I.analogInputSources[a].gainEnabled:
                for b in range(8):
                    col=QtGui.QColor(random.randint(20,255),random.randint(20,255),random.randint(20,255))
                    name = '%s:%dx'%(a,self.I.gain_values[b])
                    self.curves[a][b]=self.addCurve(self.plot,pen=pg.mkPen(col, width=1),name=name)
                    item = self.addLabel(name,col); self.curves[a][b].curve.setClickable(True); self.curves[a][b].sigClicked.connect(functools.partial(self.selectItem,item))
            else:
                col=QtGui.QColor(random.randint(20,255),random.randint(20,255),random.randint(20,255))
                name = '%s:1x'%(a)
                self.curves[a][0]=self.addCurve(self.plot,pen=pg.mkPen(col, width=1),name='%s:1x'%(a))
                item = self.addLabel(name,col); self.curves[a][0].curve.setClickable(True); self.curves[a][0].sigClicked.connect(functools.partial(self.selectItem,item))

        self.shortlist=[]
        self.menu_entries=[]
        self.menu_group=None
        self.timer = self.newTimer()
        self.timer.timeout.connect(self.locateDevices)
        self.timer.start(500)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号