本文整理汇总了Python中pyqtgraph.mkQApp函数的典型用法代码示例。如果您正苦于以下问题:Python mkQApp函数的具体用法?Python mkQApp怎么用?Python mkQApp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mkQApp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show
def show(self):
if self._view is None:
pg.mkQApp()
self._view_widget = pg.GraphicsLayoutWidget()
self._view = self._view_widget.addViewBox(0, 0)
v = self._view
cell_ids = sorted(self.cells.keys())
pos = np.array([self.cells[i].position[:2] for i in cell_ids])
if len(self.connections) == 0:
adj = np.empty((0,2), dtype='int')
else:
adj = np.array(self.connections) - 1
colors = []
for cid in cell_ids:
cell = self.cells[cid]
color = [0, 0, 0]
for i,cre in enumerate(self.cre_types):
if cell.labels[cre] == '+':
color[i] = 255
colors.append(color)
brushes = [pg.mkBrush(c) for c in colors]
print(pos)
print(adj)
print(colors)
self._graph = pg.GraphItem(pos=pos, adj=adj, size=30, symbolBrush=brushes)
v.addItem(self._graph)
self._view_widget.show()
示例2: figure
def figure(title = None, background='w'):
if background == 'w':
pg.setConfigOption('background', 'w') # set background to white
pg.setConfigOption('foreground', 'k')
pg.mkQApp()
win = pg.GraphicsWindow(title=title)
return win
示例3: main
def main(modelFile=None, weightsFile=None, solverFile=None, filePath=None):
pg.mkQApp()
win = MainView(modelFile=modelFile, weightsFile=weightsFile, solverFile=solverFile, directory=filePath)
win.show()
if (sys.flags.interactive != 1) or not hasattr(QtCore, "PYQT_VERSION"):
QtGui.QApplication.instance().exec_()
示例4: affichage
def affichage(name, shareddic):
""" Ploting and Display """
pg.mkQApp()
pg.setConfigOptions(antialias=True) ## this will be expensive for the local plot
force = pg.SpinBox(value=0, int=True, minStep=1, step=10, bounds=(-128, 128))#QtGui.QLineEdit()
phase = pg.SpinBox(value=1, minStep=0.1, step=0.1, bounds=(0, 2))#QtGui.QLineEdit()
freq = pg.SpinBox(value=55, minStep=1, step=1, dec=True, bounds=(0, 900))#QtGui.QLineEdit()
label = QtGui.QLabel()
#self.data = data
#self.fps = fps
labelf = QtGui.QLabel()
labelf.setText('Force')
labelp = QtGui.QLabel()
labelp.setText('Phase')
labelfr = QtGui.QLabel()
labelfr.setText('Frequence')
lcheck = QtGui.QCheckBox('plot local')
lcheck.setChecked(True)
lplt = pg.PlotWidget()
lplt.setYRange(-45, 45)
lplt.setTitle('Position')
fplt = pg.PlotWidget()
fplt.setYRange(-150, 150)
fplt.setTitle('Forces')
fplt.getAxis('bottom').setScale(1.0/RESANG)
layout = pg.LayoutWidget()
layout.addWidget(labelf)
layout.addWidget(labelp)
layout.addWidget(labelfr)
layout.addWidget(force, row=2, col=0)
layout.addWidget(phase, row=2, col=1)
layout.addWidget(freq, row=2, col=2)
layout.addWidget(lcheck, row=3, col=0)
layout.addWidget(label, row=3, col=1)
layout.addWidget(lplt, row=4, col=0, colspan=3)
layout.addWidget(fplt, row=5, col=0, colspan=3)
layout.resize(800, 800)
layout.setWindowTitle('Timon 12: Demo')
layout.show()
def update(shareddic):
""" Every refresh of the display """
localdata = [0]*1000
taille = 0#shareddic['taille']
localdata = shareddic['data']
localvitesse = shareddic['vitesse']
lplt.plot(localdata, clear=True)
lplt.plot(localvitesse, pen=(0, 0, 255))
fps = shareddic['fps']
label.setText("Communication %0.2f Hz Taille buffer: %0.2f" % (fps, taille/3.0))
force = shareddic['force']
degre = shareddic['degre']
forcenow = shareddic['forcenow']
fplt.plot(range(-ANGLEMAX*RESANG, ANGLEMAX*RESANG), force, clear=True)
fplt.plot([degre*RESANG], [forcenow], pen=(0, 0, 255), symbolBrush=(255, 0, 0), symbolPen='r')
timer = QtCore.QTimer()
timer.timeout.connect(lambda: update(shareddic))
timer.start(50)
QtGui.QApplication.instance().exec_()
示例5: __init__
def __init__(self, ui, view, parent=None):
logger.debug(' ImageDisplay::__init__(%s)' % view)
pg.mkQApp()
self.COMData = None
self.CCOMData = None
self.cData = None
self.imgData = None
self.isocurve = 0
self.overlays = {}
self.vblist = []
self.itemList = {
'COM':[None, True],
'Movement':[None, True],
'Spiral':[None, True],
'spots':[None, True],
'TRACK':[None, True],
'MASK':[None, True],
'CALIBA':[None, True],
'CALIBB':[None, True],
'ROTATE':[None, True],
'INSIDE':[None, True],
'ISOCURVE':[None, True],
'SPLOT':[None, False]
}
self.overlayDict = dict(COM=None, TRACK=None, MASK=None, CALIBA=None, CALIBB=None, ROTATE=None, SIZE=None)
self.vb = pg.ViewBox(enableMenu=False)
self.vb.setAspectLocked()
self.img = pg.ImageItem()
#self.img = pg.ImageView()
self.rotImg = None
self.rotROI = None
#self.addDisplayItem('IMG', self.img)
self.vb.addItem(self.img)
self.sp = pg.ScatterPlotItem()
self.addDisplayItem('SPLOT', self.sp)
self.hist = None
if view != "Dummy":
getattr(ui, view).setCentralItem(self.vb)
#getattr(ui, view).setCentralItem(self.img)
self.isRendered = False
self.enabledOverlays = {}
self.validOverlays = {}
self.showCOMOverlay = False
self.mousePos = (0, 0)
self.saveMouseFlag = False
#self.maskROI = None
#self.trackingROI = None
#self.calibROIa = None
#self.calibROIb = None
#print (self.vb.allChildren())
#pl = self.ui.graphicsView.addPlot()
#proxy = pg.SignalProxy(pl.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
if view != "Dummy":
self.vb.scene().sigMouseMoved.connect(self.mouseMoved)
示例6: __init__
def __init__(self, points, title = None):
pg.mkQApp();
self.w = gl.GLViewWidget()
self.w.opts['distance'] = 20
self.w.show()
self.w.setWindowTitle(title)
self.g = gl.GLGridItem()
self.w.addItem(self.g)
self.sp = gl.GLScatterPlotItem(pos=points, color=(1,1,1,1), pxMode= True)
self.w.addItem(self.sp);
示例7: testRun
def testRun(self, title='testing...', initfile=None):
if initfile is None:
raise ValueError('generate_run:testRun needs initfile name')
self._prepareRun(inj=0.0)
self.run_initialized = cellInit.init_model(self.cell, filename=initfile, restore_from_file=True)
self.hf.h.t = 0.
self.hf.h.tstop = 10
#self.hf.h.run()
self._executeRun(testPlot=True)
pg.mkQApp()
pl = pg.plot(np.array(self.monitor['time']), np.array(self.monitor['postsynapticV']))
pl.setTitle(title)
QtGui.QApplication.instance().exec_()
示例8: __init__
def __init__(self, func):
self.func = func
app = pg.mkQApp()
self.win = pg.GraphicsWindow(title="Bar learning")
self.win.resize(800,800)
self.win.addLabel("Input")
self.win.addLabel("Feature")
self.win.nextRow()
box = self.win.addViewBox(lockAspect=True)
self.input_vis = pg.ImageItem()
box.addItem(self.input_vis)
box = self.win.addViewBox(lockAspect=True)
self.feature_vis = pg.ImageItem()
box.addItem(self.feature_vis)
self.win.nextRow()
self.win.addLabel("Receptive fields", colspan=2)
self.win.nextRow()
box = self.win.addViewBox(lockAspect=True, colspan=2)
self.rv_vis = pg.ImageItem()
box.addItem(self.rv_vis)
self.win.show()
示例9: test_stream_between_local_nodes
def test_stream_between_local_nodes():
# create local nodes in QApplication
app = pg.mkQApp()
sender = FakeSender()
stream_spec = dict(protocol = 'tcp', interface = '127.0.0.1', port = '*',
transfertmode = 'plaindata', streamtype = 'analogsignal',
dtype = 'float32', shape = (-1, 16), compression ='',
scale = None, offset = None, units = '' )
sender.configure(sample_interval = 0.001)
sender.outputs['signals'].configure(**stream_spec)
#sender.output.configure(**stream_spec)
sender.initialize()
receiver = FakeReceiver()
receiver.configure()
receiver.inputs['signals'].connect(sender.outputs['signals'])
#receiver.input.connect(sender.output)
receiver.initialize()
# start them for a while
sender.start()
receiver.start()
def terminate():
sender.stop()
receiver.stop()
app.quit()
timer = QtCore.QTimer(singleShot = True, interval = 3000)
timer.timeout.connect(terminate)
timer.start()
app.exec_()
示例10: test_ThreadPollInput
def test_ThreadPollInput():
app = pg.mkQApp()
outstream = OutputStream()
outstream.configure(**stream_spec)
instream = InputStream()
instream.connect(outstream)
sender = ThreadSender(output_stream=outstream)
poller = ThreadPollInput(input_stream=instream, return_data=True)
global last_pos
last_pos= 0
def on_new_data(pos, arr):
assert arr.shape==(chunksize, nb_channel)
global last_pos
last_pos += chunksize
assert last_pos==pos
def terminate():
sender.wait()
poller.stop()
poller.wait()
app.quit()
sender.finished.connect(terminate)
poller.new_data.connect(on_new_data)
poller.start()
sender.start()
app.exec_()
示例11: __init__
def __init__(self, hoc, camerapos=[200., 45., 45.],):
if not isinstance(hoc, HocReader):
hoc = HocReader(hoc)
self.hr = hoc
self.graphics = []
self.video_file = None
pg.mkQApp() # make sure there is a QApplication before instantiating any QWidgets.
super(HocViewer, self).__init__()
self.resize(720,720)
# self.setBackgroundColor(pg.glColor(pg.mkColor(255, 255, 255, 255)))
# self.setBackgroundColor(pg.glColor(pg.mkColor(0, 0, 0, 0)))
# color='w'
# self.setBackgroundColor(color)
self.show()
self.setWindowTitle('hocViewer')
self.setCameraPosition(distance=camerapos[0], elevation=camerapos[1], azimuth=camerapos[2])
示例12: check_trigger
def check_trigger(debounce_time, debounce_mode, targeted_trigs, detected_triggers):
app = pg.mkQApp()
dev, trigger = setup_nodes()
trigger.params['debounce_time'] = debounce_time
trigger.params['debounce_mode'] = debounce_mode
def on_new_trigger(pos, indexes):
#~ print(pos, indexes)
detected_triggers.extend(indexes)
poller = ThreadPollOutput(trigger.output, return_data=True)
poller.new_data.connect(on_new_trigger)
poller.start()
trigger.start()
dev.start()
def terminate():
dev.stop()
trigger.stop()
poller.stop()
poller.wait()
assert np.array_equal(detected_triggers, targeted_trigs), '{} should be {}'.format(detected_triggers, targeted_trigs)
app.quit()
# start for a while
timer = QtCore.QTimer(singleShot=True, interval=5000)
timer.timeout.connect(terminate)
timer.start()
app.exec_()
示例13: open_catalogue_window
def open_catalogue_window():
dataio = DataIO(dirname='test_peeler')
catalogueconstructor = CatalogueConstructor(dataio=dataio)
app = pg.mkQApp()
win = CatalogueWindow(catalogueconstructor)
win.show()
app.exec_()
示例14: test_eeg_emotiv_direct
def test_eeg_emotiv_direct():
# Look for emotiv usb device
all_devices = get_available_devices()
device_handle = all_devices[0]
# in main App
app = pg.mkQApp()
dev = Emotiv(name='Emotiv0')
dev.configure(device_handle=device_handle)
dev.outputs['signals'].configure(
protocol='tcp', interface='127.0.0.1', transfermode='plaindata',)
dev.outputs['impedances'].configure(
protocol='tcp', interface='127.0.0.1', transfermode='plaindata',)
dev.outputs['gyro'].configure(
protocol='tcp', interface='127.0.0.1', transfermode='plaindata',)
dev.initialize()
viewer = QOscilloscope()
viewer.configure(with_user_dialog=True)
viewer.input.connect(dev.outputs['signals'])
viewer.initialize()
viewer.show()
dev.start()
viewer.start()
def terminate():
dev.stop()
app.quit()
# start for a while
timer = QtCore.QTimer(singleShot=True, interval=3000)
timer.timeout.connect(terminate)
#~ timer.start()
app.exec_()
示例15: test_AnalogTrigger_after_stable
def test_AnalogTrigger_after_stable():
app = pg.mkQApp()
dev, trigger = setup_nodes()
trigger.params['debounce_time'] = 0.1
trigger.params['debounce_mode'] = 'after-stable'
all_triggers = []
def on_new_trigger(pos, indexes):
#~ print(pos, indexes)
all_triggers.extend(indexes)
poller = ThreadPollOutput(trigger.output)
poller.new_data.connect(on_new_trigger)
dev.start()
trigger.start()
poller.start()
def terminate():
dev.stop()
trigger.stop()
poller.stop()
poller.wait()
app.quit()
# start for a while
timer = QtCore.QTimer(singleShot=True, interval=5000)
timer.timeout.connect(terminate)
timer.start()
app.exec_()
#~ print(all_triggers)
assert np.array_equal(all_triggers, [1001, 2001, 3025, 4001])