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


Python ptime.time函数代码示例

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


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

示例1: update

    def update(self, image):

        peaks = maxima.Maxima(image, self.fwhm, self.kernel)
        peaks.find(float(self.main.alphaEdit.text()))
        nMaxima = len(peaks.positions)
        nOverlaps = peaks.overlaps

        if self.ptr < self.npoints:
            self.dataN[self.ptr] = nMaxima
            self.dataOverlaps[self.ptr] = nOverlaps
            self.time[self.ptr] = ptime.time() - self.startTime
            self.curve1.setData(self.time[1:self.ptr + 1],
                                self.dataN[1:self.ptr + 1])
            self.curve2.setData(self.time[1:self.ptr + 1],
                                self.dataOverlaps[1:self.ptr + 1])

        else:
            self.dataN[:-1] = self.dataN[1:]
            self.dataN[-1] = nMaxima
            self.dataOverlaps[:-1] = self.dataOverlaps[1:]
            self.dataOverlaps[-1] = nOverlaps
            self.time[:-1] = self.time[1:]
            self.time[-1] = ptime.time() - self.startTime

            self.curve1.setData(self.time, self.dataN)
            self.curve2.setData(self.time, self.dataOverlaps)

        self.ptr += 1
开发者ID:fedebarabas,项目名称:tormenta,代码行数:28,代码来源:molecules_counter.py

示例2: update

    def update(self):
        """ Update the data displayed in the graphs
        """
        self.focusSignal = self.focusWidget.ProcessData.focusSignal

        if self.ptr < self.npoints:
            self.data[self.ptr] = self.focusSignal
            self.time[self.ptr] = ptime.time() - self.startTime
            self.focusCurve.setData(self.time[1:self.ptr + 1],
                                    self.data[1:self.ptr + 1])

        else:
            self.data[:-1] = self.data[1:]
            self.data[-1] = self.focusSignal
            self.time[:-1] = self.time[1:]
            self.time[-1] = ptime.time() - self.startTime

            self.focusCurve.setData(self.time, self.data)

        self.ptr += 1

        if self.main is not None:

            if self.recButton.isChecked():
                self.savedDataSignal.append(self.focusSignal)
                self.savedDataTime.append(self.time[-1])

            if self.recButton.isChecked():
                self.analize()
开发者ID:fedebarabas,项目名称:tormenta,代码行数:29,代码来源:focus.py

示例3: setValue

 def setValue(self, value):
     now = time()
     self.values.append((now, value))
     cutoff = now - self.averageTime
     while len(self.values) > 0 and self.values[0][0] < cutoff:
         self.values.pop(0)
     self.update()
开发者ID:calanoue,项目名称:pyqtgraph,代码行数:7,代码来源:ValueLabel.py

示例4: updateData

 def updateData(self):
     #self.envEnergy()
     self.Producer()
     self.Consumer()
     self.Decomposer()
     #self.envEnergy()
     self.envEnergy() # add more envEnergy() to diffuse the energy the dead life left
     self.mergeData()
     self.updatePopulation()
     #img.setImage(self.envdata1)
     ##tft
     for i in self.mixenv:
         for j in i:
             if j[3] > 255:
                 print('orz: ', j)
                 print('PRODBIT: ',PRODBIT)
     #print(self.mixenv) ##tft
     img.setImage(self.mixenv)
     #for testing the speed of the program
     global updatect
     updatect += 1
     if updatect > 100:
         now = ptime.time()
         print('Run time: ', now - updatetime)
         app.timer.stop()
开发者ID:stbinan,项目名称:raw-world,代码行数:25,代码来源:grad_implmt_ver1.py

示例5: update

def update():
    global ui, ptr, lastTime, fps, LUT, img
    if ui.lutCheck.isChecked():
        useLut = LUT
    else:
        useLut = None

    if ui.scaleCheck.isChecked():
        if ui.rgbLevelsCheck.isChecked():
            useScale = [
                [ui.minSpin1.value(), ui.maxSpin1.value()], 
                [ui.minSpin2.value(), ui.maxSpin2.value()], 
                [ui.minSpin3.value(), ui.maxSpin3.value()]]
        else:
            useScale = [ui.minSpin1.value(), ui.maxSpin1.value()]
    else:
        useScale = None

    if ui.rawRadio.isChecked():
        ui.rawImg.setImage(data[ptr%data.shape[0]], lut=useLut, levels=useScale)
    else:
        img.setImage(data[ptr%data.shape[0]], autoLevels=False, levels=useScale, lut=useLut)
        #img.setImage(data[ptr%data.shape[0]], autoRange=False)
        
    ptr += 1
    now = ptime.time()
    dt = now - lastTime
    lastTime = now
    if fps is None:
        fps = 1.0/dt
    else:
        s = np.clip(dt*3., 0, 1)
        fps = fps * (1-s) + (1.0/dt) * s
    ui.fpsLabel.setText('%0.2f fps' % fps)
    app.processEvents()  ## force complete redraw for every plot
开发者ID:cycomanic,项目名称:pyqtgraph,代码行数:35,代码来源:VideoSpeedTest.py

示例6: capture

def capture():
    global i, updateTime, fps, bCaptureContinuous
    #camimg=cam.get_image()
    #arr=pygame.surfarray.pixels3d(camimg)
    ## Display the data
    frame=cam.get_frame_bw()
    #img.setImage(arr[:,:,:])
    #arr=np.random.normal(size=(640,480))**2
    main.updateFrame(frame)
    crp.updateFrame(main.subFrame)
    #img.setImage(frame)
    #print("maj: {}, min: {}".format(outD['major_axis'], outD['minor_axis']))
    #img2.setImage(outD['frame'])
    #updateFit()


    
    if bCaptureContinuous:
        QtCore.QTimer.singleShot(1, capture)
        now = ptime.time()
        fps2 = 1.0 / (now-updateTime)
        updateTime = now
        fps = fps * 0.9 + fps2 * 0.1
    
    print("%0.1f fps" % fps)
开发者ID:morgatron,项目名称:pgBeams,代码行数:25,代码来源:main.py

示例7: update

def update():
    global p,img, cnt, chart, chartSize, updateTime, fps, logdata, fptr, buf,darks, flatField, seq_count,plot1,plot2
    Tacq = p.param('Tacq').value()
    x = buf.coincidences(Tacq, CoincidenceWindow)
    y = buf.singles(Tacq)
    cnt += 1 
    print "Herald Singles: ", y[0]
    print "Signal Singles: ", y[1]
    print "Coincidences: ", x[0,1]
    efficiency_herald = x[0,1]/float(y[1])
    efficiency_signal = x[0,1]/float(y[0])
    efficiency_sum = x[0,1]/(0.5*(y[0] + y[1]))
    efficiency_geo = x[0,1]/((y[0]*y[1])**0.5)
    print "Efficiency_herald: ", efficiency_herald
    print "Efficiency_signal: ", efficiency_signal
    print "Efficiency_sum: ", efficiency_sum
    print "Efficiency_geo: ", efficiency_geo
    print "\n"
    image = np.zeros(64)
    image = np.reshape(x[0:8,8::],(1,64))
    if p.param('Use Darkfield').value():
      imageCorrected = image-darks[8,:]
    else:
      imageCorrected = image
    if p.param('Use Flatfield').value():
      imageCorrected = imageCorrected/flatField
    
    displayimage = np.reshape(imageCorrected,(8,8))[::-1,:].T # This works

    level=(p.param('min').value(), p.param('max').value() )
    img.setImage(displayimage,autoLevels=False,levels=level)
    now = ptime.time()
    fps2 = 1.0 / (now-updateTime)
    updateTime = now
    fps = fps * 0.9 + fps2 * 0.1
    if p.param('Plot row').value()>0:
      row = p.param('Plot row').value()-1
      idx = np.arange(8) + row*8
#      curve1.setData(image[0,idx])
      curve1.setData(getChart(x,y,cnt)[0,:])
#      curve1.setData(np.log10(imageCorrected[0,idx]))
    if p.param('Plot col').value()>0:
      col = p.param('Plot col').value()-1
      idx = np.arange(8)*8 + col 
      curve2.setData(getChart(x,y,cnt)[1,:])
#      curve2.setData(image[0,idx])
    #print logdata
    if logdata==True:
      print 'logging data'
      fptr.write('%f '%Tacq) 
      image.tofile(fptr,sep=' ')
      fptr.write('\n')
      fptr.flush() 
    #print "%0.1f fps" % fps

    if p.param('Save Sequence').value():
      print "saving image"
      fname = sequencepath + '/' + basename + '%05d.png'%seq_count
      img.save(fname) 
      seq_count = seq_count + 1
开发者ID:mallman777,项目名称:ttag,代码行数:60,代码来源:StripChart.py

示例8: getTime

 def getTime(self):
     if self.main.enabled:
         self.ptr = 0
         self.dataN = np.zeros(self.npoints, dtype=np.int)
         self.dataOverlaps = np.zeros(self.npoints, dtype=np.int)
         self.time = np.zeros(self.npoints)
         self.startTime = ptime.time()
开发者ID:fedebarabas,项目名称:tormenta,代码行数:7,代码来源:molecules_counter.py

示例9: update_monitor

 def update_monitor(self, timestamp_start, timestamp_stop, readout_error, scan_parameters, n_hits, n_events):
     self.timestamp_label.setText("Data Timestamp\n%s" % time.asctime(time.localtime(timestamp_stop)))
     self.scan_parameter_label.setText("Scan Parameters\n%s" % ', '.join('%s: %s' % (str(key), str(val)) for key, val in scan_parameters.iteritems()))
     now = ptime.time()
     recent_total_hits = n_hits
     recent_total_events = n_events
     self.plot_delay = self.plot_delay * 0.9 + (now - timestamp_stop) * 0.1
     self.plot_delay_label.setText("Plot Delay\n%s" % ((time.strftime('%H:%M:%S', time.gmtime(self.plot_delay))) if self.plot_delay > 5 else "%1.2f ms" % (self.plot_delay * 1.e3)))
     recent_fps = 1.0 / (now - self.updateTime)  # calculate FPS
     recent_hps = (recent_total_hits - self.total_hits) / (now - self.updateTime)
     recent_eps = (recent_total_events - self.total_events) / (now - self.updateTime)
     self.updateTime = now
     self.total_hits = recent_total_hits
     self.total_events = recent_total_events
     self.fps = self.fps * 0.7 + recent_fps * 0.3
     self.hps = self.hps + (recent_hps - self.hps) * 0.3 / self.fps
     self.eps = self.eps + (recent_eps - self.eps) * 0.3 / self.fps
     self.rate_label.setText("Readout Rate\n%d Hz" % self.fps)
     if self.spin_box.value() == 0:  # show number of hits, all hits are integrated
         self.hit_rate_label.setText("Total Hits\n%d" % int(recent_total_hits))
     else:
         self.hit_rate_label.setText("Hit Rate\n%d Hz" % int(self.hps))
     if self.spin_box.value() == 0:  # show number of events
         self.event_rate_label.setText("Total Events\n%d" % int(recent_total_events))
     else:
         self.event_rate_label.setText("Event Rate\n%d Hz" % int(self.eps))
开发者ID:CARIBOuSystem,项目名称:pyBAR,代码行数:26,代码来源:online_monitor.py

示例10: update_monitor

 def update_monitor(self, timestamp_start, timestamp_stop, readout_error, scan_parameters, n_hits, n_events):
     self.timestamp_label.setText("Data Timestamp\n%s" % time.asctime(time.localtime(timestamp_stop)))
     self.scan_parameter_label.setText(
         "Scan Parameters\n%s"
         % ", ".join("%s: %s" % (str(key), str(val)) for key, val in scan_parameters.iteritems())
     )
     now = ptime.time()
     recent_total_hits = n_hits
     recent_total_events = n_events
     self.plot_delay = self.plot_delay * 0.9 + (now - timestamp_stop) * 0.1
     self.plot_delay_label.setText(
         "Plot Delay\n%s"
         % (
             (time.strftime("%H:%M:%S", time.gmtime(self.plot_delay)))
             if abs(self.plot_delay) > 5
             else "%1.2f ms" % (self.plot_delay * 1.0e3)
         )
     )
     recent_fps = 1.0 / (now - self.updateTime)  # calculate FPS
     recent_hps = (recent_total_hits - self.total_hits) / (now - self.updateTime)
     recent_eps = (recent_total_events - self.total_events) / (now - self.updateTime)
     self.updateTime = now
     self.total_hits = recent_total_hits
     self.total_events = recent_total_events
     self.fps = self.fps * 0.7 + recent_fps * 0.3
     self.hps = self.hps + (recent_hps - self.hps) * 0.3 / self.fps
     self.eps = self.eps + (recent_eps - self.eps) * 0.3 / self.fps
     self.update_rate(self.fps, self.hps, recent_total_hits, self.eps, recent_total_events)
开发者ID:makoc,项目名称:pyBAR,代码行数:28,代码来源:online_monitor.py

示例11: handle_data

 def handle_data(self, data):
     def update_rate(fps, hps, recent_total_hits, eps, recent_total_events):
         self.rate_label.setText("Readout Rate\n%d Hz" % fps)
         if self.spin_box.value() == 0:  # show number of hits, all hits are integrated
             self.hit_rate_label.setText("Total Hits\n%d" % int(recent_total_hits))
         else:
             self.hit_rate_label.setText("Hit Rate\n%d Hz" % int(hps))
         if self.spin_box.value() == 0:  # show number of events
             self.event_rate_label.setText("Total Events\n%d" % int(recent_total_events))
         else:
             self.event_rate_label.setText("Event Rate\n%d Hz" % int(eps))
     if 'meta_data' not in data:
         self.occupancy_img.setImage(data['occupancy'][:, :, 0], autoDownsample=True)
         self.tot_plot.setData(x=np.linspace(-0.5, 15.5, 17), y=data['tot_hist'], fillLevel=0, brush=(0, 0, 255, 150))
         self.tdc_plot.setData(x=np.linspace(-0.5, 4096.5, 4097), y=data['tdc_counters'], fillLevel=0, brush=(0, 0, 255, 150))
         self.event_status_plot.setData(x=np.linspace(-0.5, 15.5, 17), y=data['error_counters'], stepMode=True, fillLevel=0, brush=(0, 0, 255, 150))
         self.service_record_plot.setData(x=np.linspace(-0.5, 31.5, 33), y=data['service_records_counters'], stepMode=True, fillLevel=0, brush=(0, 0, 255, 150))
         self.trigger_status_plot.setData(x=np.linspace(-0.5, 7.5, 9), y=data['trigger_error_counters'], stepMode=True, fillLevel=0, brush=(0, 0, 255, 150))
         self.hit_timing_plot.setData(x=np.linspace(-0.5, 15.5, 17), y=data['rel_bcid_hist'][:16], stepMode=True, fillLevel=0, brush=(0, 0, 255, 150))
     else:
         update_rate(data['meta_data']['fps'], data['meta_data']['hps'], data['meta_data']['total_hits'], data['meta_data']['eps'], data['meta_data']['total_events'])
         self.timestamp_label.setText("Data Timestamp\n%s" % time.asctime(time.localtime(data['meta_data']['timestamp_stop'])))
         self.scan_parameter_label.setText("Scan Parameters\n%s" % ', '.join('%s: %s' % (str(key), str(val)) for key, val in data['meta_data']['scan_parameters'].iteritems()))
         now = ptime.time()
         self.plot_delay = self.plot_delay * 0.9 + (now - data['meta_data']['timestamp_stop']) * 0.1
         self.plot_delay_label.setText("Plot Delay\n%s" % 'not realtime' if abs(self.plot_delay) > 5 else "%1.2f ms" % (self.plot_delay * 1.e3))
开发者ID:SiLab-Bonn,项目名称:silab_online_monitor,代码行数:26,代码来源:pybar_fei4.py

示例12: __init__

    def __init__(self, *args, **kwargs): #, source, destination, fps, size, gui, serial

        if 'logger' in kwargs:
            self.logger = kwargs['logger']
        if 'app' in kwargs:
            self.app = kwargs['app']

        QtGui.QMainWindow.__init__(self)    
#        mw = QtGui.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.resize(800,800)
        self.show()
        
        self.vb = pg.ViewBox()
        self.ui.graphicsView.setCentralItem(self.vb)
        self.vb.setAspectLocked()
        self.img = pg.ImageItem()
        self.vb.addItem(self.img)
        self.vb.setRange(QtCore.QRectF(0, 0, 512, 512))
#        self.img.setPxMode(True)
        
        self.logger.info('%s starting spotter', self)
        self.spotter = Spotter(*args, **kwargs)    
        self.spotter.gui_grabber.displayTarget = self.img
        self.logger.info('%s spotter instantiated', self)

        self.lastTime = ptime.time()
        self.fps = None

        # main window refresh timer
#        self.timer = QtCore.QTimer()
#        self.timer.timeout.connect(self.update)
#        self.timer.start(0)
        self.update()
开发者ID:wonkoderverstaendige,项目名称:SpotterArchitecture,代码行数:35,代码来源:main.py

示例13: update

def update():
	global curve, data, ptr, p, lastTime, fps, lr
	p.clear()
	p_imu2.clear()
	socks = dict(poller.poll(0))
	if m_sockets[0] in socks and socks[m_sockets[0]]==zmq.POLLIN:
		data['imu1'] = data['imu1'].append(get_data_imu(m_sockets[0]))
	if m_sockets[1] in socks and socks[m_sockets[1]]==zmq.POLLIN:
		data['imu2'] = data['imu2'].append(get_data_imu(m_sockets[1]))
	if m_sockets[2] in socks and socks[m_sockets[2]]==zmq.POLLIN:
		data['pressure'] = data['pressure'].append(get_data_pressure(m_sockets[2]))

	curve = pg.PlotCurveItem(data['imu1']['az'].as_matrix(),pen="r")
	curve_imu2 = pg.PlotCurveItem(data['imu2']['az'].as_matrix(),pen="r")
	p.addItem(curve)
	p_imu2.addItem(curve_imu2)
	p.addItem(lr)
	p_imu2.addItem(lr2)
	ptr += 1
	now = time()
	dt = now - lastTime
	lastTime = now
	if fps is None:
		fps = 1.0/dt
	else:
		s = np.clip(dt*3., 0, 1)
		fps = fps * (1-s) + (1.0/dt) * s
		p.setTitle('%0.2f fps' % fps)
开发者ID:jvsd,项目名称:zlogger,代码行数:28,代码来源:qt_graph.py

示例14: mouseMoveEvent

 def mouseMoveEvent(self, ev):
     self.sigMouseMoved.emit(ev.scenePos())
     
     ## First allow QGraphicsScene to deliver hoverEnter/Move/ExitEvents
     QtGui.QGraphicsScene.mouseMoveEvent(self, ev)
     
     ## Next deliver our own HoverEvents
     self.sendHoverEvents(ev)
     
     if int(ev.buttons()) != 0:  ## button is pressed; send mouseMoveEvents and mouseDragEvents
         QtGui.QGraphicsScene.mouseMoveEvent(self, ev)
         if self.mouseGrabberItem() is None:
             now = ptime.time()
             init = False
             ## keep track of which buttons are involved in dragging
             for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MidButton, QtCore.Qt.RightButton]:
                 if int(ev.buttons() & btn) == 0:
                     continue
                 if int(btn) not in self.dragButtons:  ## see if we've dragged far enough yet
                     cev = [e for e in self.clickEvents if int(e.button()) == int(btn)][0]
                     dist = Point(ev.screenPos() - cev.screenPos())
                     if dist.length() < self._moveDistance and now - cev.time() < 0.5:
                         continue
                     init = init or (len(self.dragButtons) == 0)  ## If this is the first button to be dragged, then init=True
                     self.dragButtons.append(int(btn))
                     
             ## If we have dragged buttons, deliver a drag event
             if len(self.dragButtons) > 0:
                 if self.sendDragEvent(ev, init=init):
                     ev.accept()
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:30,代码来源:GraphicsScene.py

示例15: movie_play

 def movie_play(self):
     self.play = True
     print('loading image sequence')
     self.load_image_sequence()
 
     print('playing movie')
     self.updateTime = ptime.time()
     self.updateData()
开发者ID:florisvb,项目名称:multi_tracker,代码行数:8,代码来源:trajectory_viewer_gui_v2.py


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