コード例 #1
0
ファイル: system_control.py プロジェクト: mstrdm/RTL_projects
    def __init__(self, ser):
        self.app = pg.mkQApp()
        self.proc = mp.QtProcess()
        self.rpg = self.proc._import('pyqtgraph')

        self.plotwin = self.rpg.GraphicsWindow(title="Monitor")
        # self.plotwin = pg.GraphicsWindow(title="Monitor")
        self.plotwin.resize(1000, 600)
        self.plotwin.setWindowTitle('Activity Monitor')
        self.p1 = self.plotwin.addPlot(title="Neuron spikes vs. time")
        self.p1.setLabel('left', 'Neuron Id')
        self.p1.setLabel('bottom', 'Time [s]')
        self.p1.showGrid(x=True, y=True, alpha=0.5)
        self.spikes_curve = self.p1.plot(pen=None,
                                         symbol="o",
                                         symbolPen=None,
                                         symbolBrush='w',
                                         symbolSize=3)

        # self.app.exit(self.app.exec_()) # not sure if this is necessary

        self.on_screen = 400  # Number of events on the screen
        self.all_time_stamps = np.zeros(self.on_screen)
        self.all_addresses = np.zeros(self.on_screen, dtype=int)

        self.ser = ser

        self.old_stamp = 0
コード例 #2
0
 def _init_qt(cls):
     # starting the process for the pyqtgraph plotting
     # You do not want a new process to be created every time you start a
     # run, so this only starts once and stores the process in the class
     pg.mkQApp()
     cls.process = pgmp.QtProcess()  # pyqtgraph multiprocessing
     cls.rpg = cls.process._import("pyqtgraph")
コード例 #3
0
ファイル: pyqtgraph.py プロジェクト: xuexiao1992/Qcodes
 def _init_qt(self):
     # starting the process for the pyqtgraph plotting
     # You do not want a new process to be created every time you start a
     # run, so this only starts once and stores the process in the class
     pg.mkQApp()
     self.__class__.proc = pgmp.QtProcess()  # pyqtgraph multiprocessing
     self.__class__.rpg = self.proc._import('pyqtgraph')
コード例 #4
0
 def __init__(self, parent=None, *args, **kwds):
     self._img = None
     self._imgReq = None
     self._sizeHint = (640,480)  ## no clue why this is needed, but it seems to be the default sizeHint for GraphicsView.
                                 ## without it, the widget will not compete for space against another GraphicsView.
     QtGui.QWidget.__init__(self)
     self._proc = mp.QtProcess(debug=False)
     self.pg = self._proc._import('pyqtgraph')
     self.pg.setConfigOptions(**self.pg.CONFIG_OPTIONS)
     rpgRemote = self._proc._import('pyqtgraph.widgets.RemoteGraphicsView')
     self._view = rpgRemote.Renderer(*args, **kwds)
     self._view._setProxyOptions(deferGetattr=True)
     
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
     self.setMouseTracking(True)
     self.shm = None
     shmFileName = self._view.shmFileName()
     if sys.platform.startswith('win'):
         self.shmtag = shmFileName
     else:
         self.shmFile = open(shmFileName, 'r')
     
     self._view.sceneRendered.connect(mp.proxy(self.remoteSceneChanged)) #, callSync='off'))
                                                                         ## Note: we need synchronous signals
                                                                         ## even though there is no return value--
                                                                         ## this informs the renderer that it is 
                                                                         ## safe to begin rendering again. 
     
     for method in ['scene', 'setCentralItem']:
         setattr(self, method, getattr(self._view, method))
コード例 #5
0
def init_gui(list_of_projects):

    #Initialize Qt (only once per application)
    qapp = QtGui.QApplication([])

    # Create remote process with a plot window
    # This is how I have live-updating plots that keep a record of previous data points
    proc = mp.QtProcess()
    rpg = proc._import('pyqtgraph')
    win = rpg.GraphicsWindow(title='PUBS Monitoring GUI')
    win.resize(1000, 600)
    win.setWindowTitle('PUBS Monitoring GUI')
    rpg.setConfigOptions(antialias=True)

    #This is a dictionary with key==project name, val = [data, curve]
    datas_curves = {}
    # Loop over projects and add a plot for each in the window
    # For now, I will do a 2x2 grid of projects and ignore more than 4
    # This obviously needs to be tailored to the number of production PUBS projects
    counter = 0
    nrows = 3
    ncols = 3
    for iproj in list_of_projects:
        p = win.addPlot(title=iproj._project)
        curve = p.plot(pen='y')
        # Create an empty list in the remote process
        data = proc.transfer([])
        datas_curves[iproj._project] = (data, curve)
        counter += 1
        if counter == nrows * ncols - 1: break
        if (counter + 1) % ncols == 0: win.nextRow()

    return datas_curves
コード例 #6
0
ファイル: loggingGUI.py プロジェクト: keaton217/qtt
def start_logging_gui():
    """ Start logging GUI in the background """
    proc = mp.QtProcess()
    lp = proc._import('qtt.loggingGUI')
    mc = lp.zmqLoggingGUI()
    mc.show()
    mc.setup_monitor(port=5800)
    qtt._dummy_logging_gui = mc
コード例 #7
0
 def _init_qt(self):
     # starting the process for the pyqtgraph plotting
     # You do not want a new process to be created every time you start a
     # run, so this only starts once and stores the process in the class
     pg.mkQApp()
     self.__class__.proc = pgmp.QtProcess()  # pyqtgraph multiprocessing
     self.__class__.rpg = self.proc._import('pyqtgraph')
     ins_mon_mod = 'pycqed.instrument_drivers.virtual_instruments.ins_mon.qc_snapshot_widget'
     self.__class__.rpg = self.proc._import(ins_mon_mod)
コード例 #8
0
 def __init__(self):
     self.proc = mp.QtProcess()
     self.rpg = self.proc._import('pyqtgraph')
     self.rgl = self.proc._import('pyqtgraph.opengl')
     self.rview = self.rgl.GLViewWidget()
     self.rview.setBackgroundColor('k')
     self.rview.setCameraPosition(distance=10)
     self.grid = self.rgl.GLGridItem()
     self.rview.addItem(self.grid)
     self.rpg.setConfigOption('background', 'w')
     self.rpg.setConfigOption('foreground', 'k')
コード例 #9
0
 def __init__(self, filename=''):
     self.qapp = pg.mkQApp()
     self.proc = pgmp.QtProcess()
     # load required modules in the new process
     self.ada = self.proc._import(
         'pycqed.instrument_drivers.'
         'virtual_instruments.analysis_display.analysis_display_app')
     # start the app
     self.app = self.ada.AnalysisDisplayApp(filename)
     self.app.set_data_path(a_tools.datadir)
     self.update(force=True)
コード例 #10
0
    def __init__(self):
        self.__app__ = pg.mkQApp()

        # Create remote process with a plot window
        self.__proc__ = mp.QtProcess()
        self.__rpg__ = self.__proc__._import('pyqtgraph')
        self.__plotwin__ = self.__rpg__.plot()
        self.__curve__ = self.__plotwin__.plot(pen='y')

        self.__data__ = self.__proc__.transfer([])

        self.__max__ = 10_000
        self.__sliding__ = 2_500
コード例 #11
0
ファイル: live_plotting.py プロジェクト: RasmusBC59/qtt
def start_measurement_control(doexec=False):
    """ Start measurement control GUI

    Args:
        doexec(bool): if True run the event loop
    """
    _ = pyqtgraph.mkQApp()
    # import warnings
    # from pyqtgraph.multiprocess.remoteproxy import RemoteExceptionWarning
    # warnings.simplefilter('ignore', RemoteExceptionWarning)
    proc = mp.QtProcess()
    lp = proc._import('qtt.gui.live_plotting')
    mc = lp.MeasurementControl()
    app = pyqtgraph.mkQApp()
    if doexec:
        app.exec()
コード例 #12
0
    def __init__(self):
        BaseReporter.__init__(self)
        self.most_fit_genomes = []
        self.generation_statistics = []
        self.pens = 0

        #Create pyqt window
        pg.mkQApp()  #Must create a QApplication before starting QtProcess
        self.proc = mp.QtProcess()
        rpg = self.proc._import('pyqtgraph')

        self.app = rpg.Qt.QtGui.QApplication([])
        self.win = rpg.GraphicsWindow(title="Basic plotting examples")
        self.win.resize(2000, 1000)
        self.win.setWindowTitle('Test')
        rpg.setConfigOptions(antialias=True)  #enable antialiasing

        p1 = self.win.addPlot(title="Statistics")
        p1.addLegend()

        self.curve_up = p1.plot(pen='y')
        self.curve_down = p1.plot(pen='y', name='1 Std')
        fill = rpg.FillBetweenItem(self.curve_up, self.curve_down,
                                   (100, 100, 255, 150))
        p1.addItem(fill)

        self.curve = p1.plot(pen='g', symbol='x', name='Mean')
        self.curve_max = p1.plot(pen='r',
                                 symbol='o',
                                 symbolPen='r',
                                 symbolBrush=0.5,
                                 name='Max')

        self.p2 = self.win.addPlot(title="Species")

        #self.species_curves = self.p2.plot(pen='b', symbol='x', name='Test')
        self.species_curves = []  #Store pointers to curves in species graph

        #Allocates memory
        self.data = self.proc.transfer([])
        self.data_max = self.proc.transfer([])
        self.data_up = self.proc.transfer([])
        self.data_down = self.proc.transfer([])

        self.species_data = []

        rpg.Qt.QtGui.QApplication.instance().exec_()
コード例 #13
0
    def __init__(self, server_address, handler_class, max_cache_size, h5_key, h5_path, time_window ):
        self.logger = logging.getLogger('MonitorServer')
        self.logger.debug('__init__')
        SocketServer.UDPServer.__init__(self, server_address, handler_class)

        # stuff for data handling
        pd.options.mode.chained_assignment = None
        self.cache = defaultdict(list)
        self.max_cache_size = max_cache_size
        self.h5_key = h5_key
        self.h5_path = h5_path
        self.logger.debug("Opening h5 store as: %s", h5_path)
        self.h5_store = pd.HDFStore(h5_path,'w', libver='latest')
        self.time_window = time_window

        # stuff for plotting
        pg.mkQApp()
        self.proc = mp.QtProcess()
        self.rpg = self.proc._import('pyqtgraph')
        
        self.plotwin = self.rpg.GraphicsWindow(title="Monitor")
        self.plotwin.resize(1000,600)
        self.plotwin.setWindowTitle('Activity Monitor')

        self.p1 = self.plotwin.addPlot(title="Neuron spikes vs. time")
        self.p1.setLabel('left', 'Neuron Id')
        self.p1.setLabel('bottom', 'Time [s]')
        self.spikes_curve = self.p1.plot(pen=None, symbol = "+")
        self.plotwin.nextRow()

        self.p2 = self.plotwin.addPlot(title="Firing rates")
        self.p2.setLabel('left', 'Firing rate [events/period]')
        self.p2.setLabel('bottom', 'Neuron Id')
        self.spikes_rate_curve = self.p2.plot(pen=None, symbol = "+")

        self.plotwin.nextRow()
        self.p3 = self.plotwin.addPlot(title="Histogram of firing rates")
        self.p3.setLabel('left', 'Firing events')
        self.p3.setLabel('bottom', 'Firing rate [events/period]')
        self.spikes_histogram_curve = self.p3.plot(stepMode=True, fillLevel=0, brush=(0,0,255,150))

        return
コード例 #14
0
ファイル: test_appel_Mm.py プロジェクト: MarchianoR/MegaPropa
import pylab as plt
import datetime
import signal
import pyqtgraph.multiprocess as mp

# permet d interrompre le mode interactif avec un CTRL+C
def signal_handler(signal, frame):
    print 'You pressed Ctrl+C!'
    print 'Lavu is stopped'
    Mm.stop()
# Init Affichage

pg.mkQApp()
# Create remote process with a plot window

proc = mp.QtProcess()
rpg = proc._import('pyqtgraph')



list_res = []
list_time = []

def processing(Mm):
    global curve, MicStateWin
    
    
    i = 0
    nb_acqui = 0
    while(Mm.num_pkt < Mm.n_pkt and Mm.last_pkt==0):
    
コード例 #15
0
    for point in frame.points:
        y, x = pol2cart(point['range'], point['angle'])
        vel = point['doppler']
        colors.append([0, 0, 0, .5])
        points.append(np.array([x, y, vel]))

    #[print(c.points, flush=True) for c in frame.clusters]
    points = np.array(points)
    scatterplot.setData(pos=points, color=np.array(colors), _callSync='off')


# SET UP GRAPHING

import pyqtgraph.multiprocess as mp

proc = mp.QtProcess(processRequests=False)
rpg = proc._import('pyqtgraph')
gl = proc._import('pyqtgraph.opengl')
view = gl.GLViewWidget()
view.show()
grid = gl.GLGridItem()
scatterplot = gl.GLScatterPlotItem()
scatter2 = gl.GLScatterPlotItem(color=[1.0, 0, 0, 0.2], size=50)
#Draw the area we are viewing.
background = gl.GLLinePlotItem(pos=np.array([[-5, 0, 0], [5, 0, 0],
                                             [10, 25, 0], [-10, 25, 0],
                                             [-5, 0, 0]]),
                               color=(1, 1, 1, 1),
                               width=2,
                               antialias=True,
                               mode='line_strip')