
    e                     N   d Z ddlZddlZddlZddlmZ ddlZddl	m
Z
mZ  ej                         Zej                  d ed      ed       ej!                         Z ej$                         Z ej(                         Zej,                  j.                  j/                         Z ej2                  d	
       ej                  j3                  d	
       ej5                  d       ej6                  j9                  ej:                          ej<                         Z ej@                  d      Z!e!jE                  d	        ej@                  d      Z# ejH                         Z% ejL                         Z'e'jQ                  e!       e'jQ                  e#       e'jQ                  e       e'jQ                  eddd       e'jQ                  e%ddd       e'jS                  dd       e'jU                          ej                  jW                         Z,e,j[                  d	       ej]                  e,       d Z/ e
j`                         Z1e1jd                  j9                  e/       e1jg                  d        e       Z4e4jj                  j9                  d        e6dk(  r ejn                          yy)aV  
This example demonstrates the use of RemoteGraphicsView to improve performance in
applications with heavy load. It works by starting a second process to handle 
all graphics rendering, thus freeing up the main process to do its work.

In this example, the update() function is very expensive and is called frequently.
After update() generates a new set of data, it can either plot directly to a local
plot (bottom) or remotely via a RemoteGraphicsView (top), allowing speed comparison
between the two cases. IF you have a multi-core CPU, it should be obvious that the 
remote case is much faster.
    N)FrameCounter)QtCore	QtWidgetsz--iterationsinfz*Number of iterations to run before exiting)defaulttypehelpT)	antialiasz"pyqtgraph example: RemoteSpeedTestzplot remotez
plot local      )rowcolcolspan   i   )deferGetattrc            
      F   t        t              t        j                  kD  r)t        j                          t        j                          y t        j                  j                  d      j                  d      } | dt        j                  t        j                  dd| j                  d               z  z  } t        j!                         rt"        j%                  | dd	
       t&        j!                         rt(        j%                  | d       t*        j-                          y )N)i'  2   )sizer   )axis   r   
   Toff)clear	_callSync)r   )nextiterations_counterargs
iterationstimerstopappquitnprandomnormalsumsinlinspaceshapercheck	isCheckedrpltplotlchecklpltframecntupdate)datas    D/usr/lib/python3/dist-packages/pyqtgraph/examples/RemoteSpeedTest.pyr1   r1   9   s    $//1


99,00a08DAr{{1b$**Q-8999D		$de	4
 		$d	#OO    c                 4    t         j                  d| d      S )NzGenerating z.1f)labelsetText)fpss    r3   <lambda>r9   R   s    5==;s3i9P+Q r4   __main__)8__doc__argparse	itertoolsnumpyr#   utilsr   	pyqtgraphpgpyqtgraph.Qtr   r   ArgumentParserparseradd_argumentfloat
parse_argsr   countr   mkQAppr!   widgetsRemoteGraphicsViewviewsetConfigOptionssetWindowTitleaboutToQuitconnectcloseQLabelr6   	QCheckBoxr*   
setCheckedr.   
PlotWidgetr/   LayoutWidgetlayout	addWidgetresizeshowPlotItemr,   _setProxyOptionssetCentralItemr1   QTimerr   timeoutstartr0   sigFpsUpdate__name__exec r4   r3   <module>re      s@  
      *	 	 	 	"   NE%Lu	5   $Y__& biik	zz$$779   d #   4  (   8 9   

 #				]	+   $ 			\	*r}}		               1!Q  /   1!Q  / c#   ww   4  (   D ( 	   f  A>     Q RzBGGI r4   