Esempio n. 1
0
    def __init__(self, parent=None, **kwargs):
        super(AppWindow, self).__init__(parent)
        self.setupUi(self)
        self.I = kwargs.get("I", None)
        self.CC = analyticsClass()

        self.setWindowTitle(self.I.generic_name + " : " + self.I.H.version_string)
        self.plot1 = self.add2DPlot(self.plot_area)
        self.plot2 = self.add2DPlot(self.plot_area)
        labelStyle = {"color": "rgb(255,255,255)", "font-size": "11pt"}
        self.plot1.setLabel("left", "Voltage -->", units="V", **labelStyle)
        self.plot1.setLabel("bottom", "Time -->", units="S", **labelStyle)
        self.plot2.setLabel("left", "Voltage -->", units="V", **labelStyle)
        self.plot2.setLabel("bottom", "Time -->", units="S", **labelStyle)

        self.plot1.setYRange(-8.5, 8.5)
        self.plot2.setYRange(-8.5, 8.5)
        self.I.set_gain("CH1", 1)
        self.I.configure_trigger(0, "CH1", 0)
        self.tg = 10
        self.x = []

        self.looptimer = QtCore.QTimer()
        self.curveCH1 = self.addCurve(self.plot1, "CH1", (255, 255, 255))
        self.CH1Fit = self.addCurve(self.plot2, "CH1 Fit", (255, 255, 255))
        self.region = pg.LinearRegionItem([self.tg * 50, self.tg * 800])
        self.region.setZValue(-10)
        self.plot1.addItem(self.region)
        self.lognum = 0
        self.ON = "background-color: rgb(0,255,0);"
        self.OFF = "background-color: rgb(255, 0, 0);"
        self.state = 0
        self.I.set_state(SQR1=0)
        self.indicator.setStyleSheet(self.OFF)
        self.msg.setText("Fitting fn :\noff+amp*exp(-damp*x)*sin(x*freq+ph)")
        self.Params = []
Esempio n. 2
0
	def __init__(self, parent=None,**kwargs):
		super(AppWindow, self).__init__(parent)
		self.setupUi(self)
		self.I=kwargs.get('I',None)
		self.math = analyticsClass()

		self.setWindowTitle(self.I.generic_name + ' : ' +self.I.H.version_string)
		self.plot=pg.PlotWidget()

		#cross hair
		self.vLine = pg.InfiniteLine(angle=90, movable=True)
		#self.vLine.setPen(color=(135,44,64,150), width=3)
		self.plot.addItem(self.vLine, ignoreBounds=False)

		self.proxy = pg.SignalProxy(self.vLine.scene().sigMouseMoved, rateLimit=60, slot=self.readCursor)
		
		self.fps=0
		self.max_samples_per_channel=[0,self.I.MAX_SAMPLES/4,self.I.MAX_SAMPLES/4,self.I.MAX_SAMPLES/4,self.I.MAX_SAMPLES/4]
		self.liss_win=None
		self.liss_ready=False
		self.liss_animate_arrow1=None
		self.liss_animate_arrow2=None
		self.liss_animate_arrow3=None
		self.liss_anim1=None
		self.liss_anim2=None
		self.liss_anim3=None
		self.samples=self.I.MAX_SAMPLES/4#self.sample_slider.value()
		self.active_channels=1
		self.channel_states=np.array([1,0,0,0])
		self.channels_in_buffer=1
		self.chan1remap='CH1'
		self.ch123sa = 0
		g=1.75
		self.timebase = g
		self.lastTime=time.time()

		self.trace_colors=[(0,255,20),(255,255,0),(255,10,100),(10,255,255)]

		self.plot.setLabel('bottom', 'Time -->>', units='S')
		labelStyle = {'color': 'rgb%s'%(str(self.trace_colors[0])), 'font-size': '11pt'}
		self.plot.setLabel('left','CH1', units='V',**labelStyle)
		self.plot.addLegend(offset=(-10,30))

		self.plot2 = pg.ViewBox()
		self.ax2 = pg.AxisItem('right')
		self.plot.plotItem.layout.addItem(self.ax2, 2, 3)
		self.plot.plotItem.scene().addItem(self.plot2)
		self.ax2.linkToView(self.plot2)
		self.plot2.setXLink(self.plot.plotItem)
		self.ax2.setZValue(-10000)
		labelStyle = {'color': 'rgb%s'%(str(self.trace_colors[1])), 'font-size': '13pt'}
		self.ax2.setLabel('CH2', units='V', **labelStyle)

		self.plot2.setGeometry(self.plot.plotItem.vb.sceneBoundingRect())
		self.plot2.linkedViewChanged(self.plot.plotItem.vb, self.plot2.XAxis)
		## Handle view resizing 
		self.plot.getViewBox().sigStateChanged.connect(self.updateViews)

		self.curve1 = self.plot.plot(name='CH1'); self.curve1.setPen(color=self.trace_colors[0], width=1)
		self.curve2 = self.plot.plot(name='CH2'); self.curve2.setPen(color=self.trace_colors[1], width=1)
		self.curve3 = self.plot.plot(name='CH3'); self.curve3.setPen(color=self.trace_colors[2], width=1)
		self.curve4 = self.plot.plot(name='CH4'); self.curve4.setPen(color=self.trace_colors[3], width=1)
		self.curve_lis = self.plot.plot(); self.curve_lis.setPen(color=(255,255,255), width=1)

		self.curveF=[]
		for a in range(2):
			self.curveF.append( self.plot.plot() ); self.curveF[-1].setPen(color=(255,255,255), width=1)


		self.curveB = pg.PlotDataItem(name='CH2')
		self.plot2.addItem(self.curveB)
		self.curveB.setPen(color=self.trace_colors[1], width=1)

		self.curveFR = pg.PlotDataItem()
		self.plot2.addItem(self.curveFR); self.curveFR.setPen(color=(255,255,255), width=1)

		self.CH1_ENABLE.setStyleSheet('background-color:rgba'+str(self.trace_colors[0])[:-1]+',3);color:(0,0,0);')
		self.CH2_ENABLE.setStyleSheet('background-color:rgba'+str(self.trace_colors[1])[:-1]+',3);color:(0,0,0);')
		for a in range(4):
			self.trigger_select_box.setItemData(a, QtGui.QColor(*self.trace_colors[a]), QtCore.Qt.BackgroundRole);

		self.triggerChannelName='CH1'
		self.arrow = pg.ArrowItem(pos=(0, 0), angle=0)
		self.plot.addItem(self.arrow)
		#markings every 5 Volts
		self.voltsperdiv = ['5V/div','3V/div','2V/div','1V/div','500mV/div','400mV/div','300mV/div','100mV/div']
		self.trigger_channel=0
		self.trigger_level = 0
		self.trigtext = pg.TextItem(html=self.trigger_text('CH1'), anchor=(1.2,0.5), border='w', fill=(0, 0, 255, 100),angle=0)
		self.plot.addItem(self.trigtext)
		self.plot.showGrid(True,False,0.4)
		self.scope_type=0
		self.plot_area.addWidget(self.plot)
		self.CH1_REMAPS.addItems(self.I.allAnalogChannels)
		self.showgrid()
		self.trigtext.setParentItem(self.arrow)
		self.I.configure_trigger(self.trigger_channel,self.triggerChannelName,0)
		
		self.autoRange()
		self.timer = QtCore.QTimer()
		self.finished=False
		self.timer.singleShot(500,self.start_capture)