简体   繁体   中英

How to show the framerate in PyQTgraph?

I am doing some live data updating using some external hardware. I need to know the framerate of the animation, to know if the problem is my potato computer or the sampling rate of the hardware.

Is there a way to display the framerate in pyqtgraph?
i am using it in combination with openGL and am displaying a heatmap that changes live based on touch to the hardware. However i have the feeling it is lagging a bit.

I am imagining something inside the update.self routine.

My code is not really relevant, as it is working. I just need some (probably very obvious) way to read the update rate.

I already looked into realtime imaging, but it is not worth designing a multiple thread approach...

This works somewhat, not sure if it does what i want... I define in the start

   import datetime 
   def __init__(self):
     self.start_time=0 

for the first loop. And then i read the frame rate like this:

def update:

    #some code
    frames= datetime.datetime.now().time()
    frames=frames.second-self.start_time.second + (frames.microsecond-self.start_time.microsecond)/1000000
    print(1/frames)
    self.start_time = datetime.datetime.now().time()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM