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


Python Flowchart.connectTerminals方法代码示例

本文整理汇总了Python中pyqtgraph.flowchart.Flowchart.connectTerminals方法的典型用法代码示例。如果您正苦于以下问题:Python Flowchart.connectTerminals方法的具体用法?Python Flowchart.connectTerminals怎么用?Python Flowchart.connectTerminals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph.flowchart.Flowchart的用法示例。


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

示例1: AppWindow

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
class AppWindow(QtGui.QMainWindow, hackYourOwn.Ui_MainWindow,utilitiesClass):
	def __init__(self, parent=None,**kwargs):
		super(AppWindow, self).__init__(parent)
		self.setupUi(self)
		self.I=kwargs.get('I',None)
		self.setWindowTitle('pyqtgraph example: FlowchartCustomNode')

		## Create an empty flowchart with a single input and output
		self.fc = Flowchart(terminals={
			'dataIn': {'io': 'in'},
			
		})
		self.w = self.fc.widget()
		self.WidgetLayout.addWidget(self.fc.widget())

		self.plot1 = self.add2DPlot(self.ExperimentLayout)
		self.plot2 = self.add2DPlot(self.ExperimentLayout)
		self.curve1 = self.addCurve(self.plot1)
		self.curve2 = self.addCurve(self.plot2)
		self.curve1.setData([1,2,3],[5,6,7])

		self.library = fclib.LIBRARY.copy() # start with the default node set
		self.library.addNodeType(PlotViewNode, [('Display',)])
		self.library.addNodeType(CaptureNode, [('Acquire',)])
		self.fc.setLibrary(self.library)


		## Now we will programmatically add nodes to define the function of the flowchart.
		## Normally, the user will do this manually or by loading a pre-generated
		## flowchart file.

		self.cap = self.fc.createNode('Capture', pos=(0, 0))
		self.cap.setI(self.I)

		self.v1Node = self.fc.createNode('PlotView', pos=(0, -150))
		self.v1Node.setView(self.curve1)

		self.v2Node = self.fc.createNode('PlotView', pos=(150, -150))
		self.v2Node.setView(self.curve2)

		self.fc.connectTerminals(self.fc['dataIn'], self.cap['dataIn'])
		self.fc.connectTerminals(self.cap['dataOut'], self.v1Node['data'])
		#self.fc.connectTerminals(self.fc['dataIn'], self.v2Node['data'])

		self.fc.setInput(dataIn=True)


	def run(self):
		self.fc.setInput(dataIn=True)

	def __del__(self):
		#self.looptimer.stop()
		print ('bye')

	def closeEvent(self, event):
		self.finished=True
开发者ID:fossasia,项目名称:pslab-apps,代码行数:58,代码来源:Z_hackyourown.py

示例2: __init__

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    def __init__(self, parent=None):
        super(Demo, self).__init__()

        self.setWindowTitle("Fourier Transformation")
        self.showFullScreen()

        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        fc = Flowchart(terminals={
            'dataIn': {'io': 'in'},
            'dataOut': {'io': 'out'}
        })

        self.layout.addWidget(fc.widget(), 0, 0, 2, 1)

        pw1 = pg.PlotWidget()
        pw2 = pg.PlotWidget()
        pw1.getPlotItem().setLabel('left', text='Amplitude')
        pw1.getPlotItem().setLabel('bottom', text='Time')
        pw2.getPlotItem().setLabel('left', text='Y(freq)')
        pw2.getPlotItem().setLabel('bottom', text='F(Hz)')
        self.layout.addWidget(pw1, 0, 1)
        self.layout.addWidget(pw2, 1, 1)

        sampling_rate = 150.0
        sampling_interval = 1.0 / sampling_rate; # Abtastfrequenz f = (1/t)
        time_vector = np.arange(0, 1, sampling_interval)

        signal_frequency = 10
        data = np.sin(2 * np.pi * signal_frequency * time_vector)

        print data

        fc.setInput(dataIn=data)

        pw1Node = fc.createNode('PlotWidget', pos=(0, -150))
        pw1Node.setPlot(pw1)

        pw2Node = fc.createNode('PlotWidget', pos=(150, -150))
        pw2Node.setPlot(pw2)

        fNode = fc.createNode('AnalyzeNode', pos=(0, 0))

        fc.connectTerminals(fc['dataIn'], fNode['dataIn'])
        fc.connectTerminals(fc['dataIn'], pw1Node['In'])
        fc.connectTerminals(fNode['dataOut'], pw2Node['In'])
        fc.connectTerminals(fNode['dataOut'], fc['dataOut'])
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:50,代码来源:fft.py

示例3: Demo

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
class Demo(QtGui.QWidget):
    def __init__(self, parent=None):
        super(Demo, self).__init__()

        self.setWindowTitle("Pointing Device")
        self.show()

        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.buffer_amount = 20

        self.fc = Flowchart(terminals={
            'dataIn': {'io': 'in'},
            'dataOut': {'io': 'out'}
        })
        self.layout.addWidget(self.fc.widget(), 0, 0, 2, 1)

        self.configNodes()
        self.configScatterPlot()

        self.getWiimote()

    def getWiimote(self):
        if len(sys.argv) == 1:
            addr, name = wiimote.find()[0]
        elif len(sys.argv) == 2:
            addr = sys.argv[1]
            name = None
        elif len(sys.argv) == 3:
            addr, name = sys.argv[1:3]
        print("Connecting to %s (%s)" % (name, addr))

        self.wiimoteNode.text.setText(addr)
        self.wiimoteNode.connect_wiimote()

    # create and connect nodes
    def configNodes(self):
        self.pointVisNode = self.fc.createNode('Vis3D', pos=(-150, 150))
        self.wiimoteNode = self.fc.createNode('Wiimote', pos=(0, 0), )
        self.bufferNode = self.fc.createNode('Buffer', pos=(0, -150))

        self.buffer_amount = self.bufferNode.getBufferSize()

        self.fc.connectTerminals(
            self.wiimoteNode['irVals'],
            self.bufferNode['dataIn'])
        self.fc.connectTerminals(
            self.bufferNode['dataOut'],
            self.pointVisNode['irVals'])

    # create and config scatter plot item
    def configScatterPlot(self):
        gview = pg.GraphicsLayoutWidget()
        self.layout.addWidget(gview, 0, 1, 2, 1)

        plot = gview.addPlot()
        self.scatter = pg.ScatterPlotItem(
            size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))
        plot.addItem(self.scatter)
        plot.setXRange(-1000, 200)
        plot.setYRange(-1000, 200)

    def keyPressEvent(self, ev):
        if ev.key() == QtCore.Qt.Key_Escape:
            self.close()

    # do actions in loop
    def update(self):
        outputValues = self.pointVisNode.outputValues()

        isX1Valid = outputValues['irX1'] is not None
        isY1Valid = outputValues['irY1'] is not None
        isX2Valid = outputValues['irX2'] is not None
        isY2Valid = outputValues['irY2'] is not None

        if isX1Valid and isX2Valid and isY1Valid and isY2Valid:
            distance = self.calcDistance(outputValues)
            if distance > 0:
                size = 3000 * (1 / distance * 2)

                self.scatter.setData(
                    pos=[[
                        -outputValues['irX1'],
                        -outputValues['irY1']],
                        [-outputValues['irX2'], -outputValues['irY2']]],
                    size=size, pxMode=True)

        # raise or lower buffer amount with +/- keys
        if self.wiimoteNode.wiimote is not None:
            if self.wiimoteNode.wiimote.buttons['Plus']:
                self.buffer_amount += 1
                self.bufferNode.setBufferSize(self.buffer_amount)
            elif self.wiimoteNode.wiimote.buttons['Minus']:
                if self.buffer_amount > 1:
                    self.buffer_amount -= 1
                    self.bufferNode.setBufferSize(self.buffer_amount)

        pyqtgraph.QtGui.QApplication.processEvents()

#.........这里部分代码省略.........
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:103,代码来源:wiipoint3d.py

示例4:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    pw1Node = fc.createNode('PlotWidget', pos=(300, 150))
    pw1Node.setPlot(pw1)

    pw2 = pg.PlotWidget()
    pw2.plot(pen='g')
    layout.addWidget(pw2, 1, 2)
    pw2.setYRange(0, 1024)

    pw2Node = fc.createNode('PlotWidget', pos=(450, 150))
    pw2Node.setPlot(pw2)

    wiimoteNode = fc.createNode('Wiimote', pos=(0, 0), )
    bufferNode = fc.createNode('Buffer', pos=(150, -150))
    noiseNode = fc.createNode('Noise', pos=(300, -150))    

    fc.connectTerminals(wiimoteNode['accelX'], bufferNode['dataIn'])
    fc.connectTerminals(bufferNode['dataOut'], noiseNode['dataIn'])
    fc.connectTerminals(bufferNode['dataOut'], pw1Node['In'])
    fc.connectTerminals(noiseNode['dataOut'], pw2Node['In'])
    
    pw3 = pg.PlotWidget()
    layout.addWidget(pw3, 0, 1)
    pw3.setYRange(0, 1024)
    convNode = fc.createNode('Convolution', pos=(450, -300))
    convNode.setPlot(pw3)
    fc.connectTerminals(bufferNode['dataOut'], convNode['origIn'])
    fc.connectTerminals(noiseNode['dataOut'], convNode['noiseIn'])
    
    pw4 = pg.PlotWidget()
    layout.addWidget(pw4, 0, 2)
    pw4.setYRange(0, 200)
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:33,代码来源:wiimote_node_noise.py

示例5:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    trainingFft = fc.createNode('Fft', pos=(450, -150))

    # creating a label for information
    text = "The tool predicts your activity while acting with the wiimote"
    text += "\nbased on trained data and a machine learning algorithm."
    infoText = QtGui.QLabel(text)
    infoText.setStyleSheet("font: 12pt; color:#000;")
    layout.addWidget(infoText, 2, 0)

    # creating label for recognized activity
    activityLabel = QtGui.QLabel("initializing")
    layout.addWidget(activityLabel, 3, 0)
    display.setLabel(activityLabel)

    # connect Nodes
    fc.connectTerminals(wiimoteNode['accelX'], xBufferNode['dataIn'])
    fc.connectTerminals(wiimoteNode['accelY'], yBufferNode['dataIn'])
    fc.connectTerminals(wiimoteNode['accelZ'], zBufferNode['dataIn'])
    # merge x,y,z values
    fc.connectTerminals(xBufferNode['dataOut'], mergeNode['xIn'])
    fc.connectTerminals(yBufferNode['dataOut'], mergeNode['yIn'])
    fc.connectTerminals(zBufferNode['dataOut'], mergeNode['zIn'])
    # fft nodes for live data and training data
    fc.connectTerminals(mergeNode['dataOut'], liveFft['dataIn'])
    fc.connectTerminals(fileReader['dataOut'], trainingFft['dataIn'])
    # connecting support vector machine
    fc.connectTerminals(fileReader['categoryOut'], svmClassifier['categoryIn'])
    fc.connectTerminals(liveFft['dataOut'], svmClassifier['classifyIn'])
    fc.connectTerminals(trainingFft['dataOut'], svmClassifier['dataIn'])
    # connecting visual output of prediction
    fc.connectTerminals(svmClassifier['prediction'], display['categoryIn'])
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:33,代码来源:classify.py

示例6:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    # buffer node
    bufferNode_accelX = fc.createNode('Buffer', pos=(150, 0))

    # standard deviation node
    stdDevNode_accelX = fc.createNode('StdDevNode', pos=(300, 0))

    # number display node
    numberDisplayNode = fc.createNode('NumberDisplayNode', pos=(450, 0))

    # second buffer node for plotting
    bufferNode_STD_to_Plot = fc.createNode('Buffer', pos=(500, -140))

    # QLCD Number Display:
    numberDisplayWidget = QtGui.QLCDNumber(win)
    numberDisplayWidget.setGeometry(600, 0, 350, 50)

    # connect all nodes
    fc.connectTerminals(wiimoteNode['accelX'], bufferNode_accelX['dataIn'])
    fc.connectTerminals(bufferNode_accelX['dataOut'],
                        stdDevNode_accelX['dataInX'])
    fc.connectTerminals(stdDevNode_accelX['dataOutX'],
                        numberDisplayNode['numberIn'])
    fc.connectTerminals(numberDisplayNode['numberOut'],
                        bufferNode_STD_to_Plot['dataIn'])
    fc.connectTerminals(bufferNode_STD_to_Plot['dataOut'], pw_x_Node['In'])

    win.show()
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
开发者ID:Gr4ni,项目名称:ITT-SS15,代码行数:31,代码来源:noisalyzer.py

示例7: Flowchart

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
#TETRACYCLINE = True

fc = Flowchart(terminals={
    'dataIn': {'io': 'in'},
    'dataOut': {'io': 'out'}    
})
w = fc.widget()
w.resize(400,200)
w.show()

n1 = fc.createNode('Add')
n2 = fc.createNode('Subtract')
n3 = fc.createNode('Abs')
n4 = fc.createNode('Add')

fc.connectTerminals(fc.dataIn, n1.A)
fc.connectTerminals(fc.dataIn, n1.B)
fc.connectTerminals(fc.dataIn, n2.A)
fc.connectTerminals(n1.Out, n4.A)
fc.connectTerminals(n1.Out, n2.B)
fc.connectTerminals(n2.Out, n3.In)
fc.connectTerminals(n3.Out, n4.B)
fc.connectTerminals(n4.Out, fc.dataOut)


def process(**kargs):
    return fc.process(**kargs)

    
print process(dataIn=7)
开发者ID:emayssat,项目名称:sandbox,代码行数:32,代码来源:Flowchart.py

示例8: Pointer

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
class Pointer(QtGui.QWidget):
    '''
    This class reads WiiMote IR data and provides
    them on output.
    '''
    def __init__(self, useWiiMote, parent=None):
        super(Pointer, self).__init__()

        self.useWiiMote = useWiiMote

        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.buffer_amount = 20

        self.fc = Flowchart(terminals={
            'dataIn': {'io': 'in'},
            'dataOut': {'io': 'out'}
        })
        self.layout.addWidget(self.fc.widget(), 0, 0, 2, 1)

        self.configNodes()

        if self.useWiiMote:
            self.getWiimote()

        self.outputCounter = 0

    # connect to wiimoet
    def getWiimote(self):
        if len(sys.argv) == 1:
            addr, name = wiimote.find()[0]
        elif len(sys.argv) == 2:
            addr = sys.argv[1]
            name = None
        elif len(sys.argv) == 3:
            addr, name = sys.argv[1:3]
        print("Connecting to %s (%s)" % (name, addr))

        self.wiimoteNode.text.setText(addr)
        self.wiimoteNode.connect_wiimote()

    # create and connect nodes
    def configNodes(self):
        self.pointVisNode = self.fc.createNode('Vis3D', pos=(-150, 150))
        self.wiimoteNode = self.fc.createNode('Wiimote', pos=(0, 0), )
        self.bufferNode = self.fc.createNode('Buffer', pos=(0, -150))

        self.buffer_amount = self.bufferNode.getBufferSize()

        self.fc.connectTerminals(
            self.wiimoteNode['irVals'],
            self.bufferNode['dataIn'])
        self.fc.connectTerminals(
            self.bufferNode['dataOut'],
            self.pointVisNode['irVals'])

    # create and config scatter plot item
    def configScatterPlot(self):
        gview = pg.GraphicsLayoutWidget()
        self.layout.addWidget(gview, 0, 1, 2, 1)

        plot = gview.addPlot()
        self.scatter = pg.ScatterPlotItem(
            size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))
        plot.addItem(self.scatter)
        plot.setXRange(-1000, 200)
        plot.setYRange(-1000, 200)

    def keyPressEvent(self, ev):
        if ev.key() == QtCore.Qt.Key_Escape:
            self.close()

    # do actions in loop
    def update(self):
        self.outputValues = self.pointVisNode.outputValues()

        if self.useWiiMote is False:
            # use simulated data if WiiMote shall not
            # be used
            self.outputValues = {
                'irX0': 30, 'irY0': 120,
                'irX1': 40, 'irY1': 130,
                'irX2': 400, 'irY2': 400,
                'irX3': 410, 'irY3': 410
                }

            self.outputCounter = self.outputCounter + 2

            for key in self.outputValues:
                if 'X' in key:
                    self.outputValues[key] = self.outputValues[key] + \
                        self.outputCounter
                else:
                    self.outputValues[key] = self.outputValues[key] + \
                        self.outputCounter

        # raise or lower buffer amount with +/- keys
        if self.wiimoteNode.wiimote is not None:
            if self.wiimoteNode.wiimote.buttons['Plus']:
#.........这里部分代码省略.........
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:103,代码来源:twohands.py

示例9: Flowchart

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    layout = QtGui.QGridLayout()
    cw.setLayout(layout)

    ## Create an empty flowchart with a single input and output
    fc = Flowchart(terminals={
    })
    w = fc.widget()

    layout.addWidget(fc.widget(), 0, 0, 2, 1)

    wiimoteNode = fc.createNode('Wiimote', pos=(-150, 150))
    normalNode = fc.createNode('NormalVector', pos=( 0, 150))
    plotCurve = fc.createNode('PlotCurve', pos=(150, 150))

    pw1 = pg.PlotWidget()
    pw1.setYRange(-1, 1)
    pw1.setXRange(-1, 1)
    layout.addWidget(pw1, 0, 1)
    pw1Node = fc.createNode('PlotWidget', pos=(300, 150))
    pw1Node.setPlot(pw1)
    
    fc.connectTerminals(wiimoteNode['accelX'], normalNode['Xnormal'])
    fc.connectTerminals(wiimoteNode['accelZ'], normalNode['Znormal'])
    fc.connectTerminals(normalNode['VectorX'], plotCurve['x'])
    fc.connectTerminals(normalNode['VectorY'], plotCurve['y'])
    fc.connectTerminals(plotCurve['plot'], pw1Node['In'])

    win.show()
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
开发者ID:MaxSchu,项目名称:NotTheDroidsYouWereLookingFor,代码行数:32,代码来源:normal_vector.py

示例10:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    pw_x_Node = fc.createNode('PlotWidget', pos=(370, -140))
    pw_x_Node.setPlot(pw_accelX)

    # Buffer Node:
    bufferNode_accelX = fc.createNode('Buffer', pos=(150, -140))

    # Plot Curve:
    pw_plot_curve_Node_x = fc.createNode('PlotCurve', pos=(0, 120))

    # FFT Node:
    FFTNode_x = fc.createNode('FFTNode', pos=(0, 120))

    # Connect all together:
    # (WiiMoteNode -> BufferNode -> FFTNode -> PlotCurve
    # -> PlotWidget)
    fc.connectTerminals(wiimoteNode['accelX'],
                        bufferNode_accelX['dataIn'])
    fc.connectTerminals(bufferNode_accelX['dataOut'],
                        FFTNode_x['dataIn'])
    fc.connectTerminals(FFTNode_x['X'],
                        pw_plot_curve_Node_x['x'])
    fc.connectTerminals(FFTNode_x['Y'],
                        pw_plot_curve_Node_x['y'])
    fc.connectTerminals(pw_plot_curve_Node_x['plot'],
                        pw_x_Node['In'])

    # Y accelerator axis:
    # Plots Widget:
    pw_accelY = pg.PlotWidget(name="Y accelerator")
    layout.addWidget(pw_accelY, 0, 2)
    pw_accelY.setYRange(-15, 55)
    pw_accelY.setXRange(0, 40)
开发者ID:Gr4ni,项目名称:ITT-SS15,代码行数:34,代码来源:frequalyzer.py

示例11: len

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
              "Press <return> once the Wiimote's LEDs start blinking.")

    if len(sys.argv) == 1:
        addr, name = find()[0]
    elif len(sys.argv) == 2:
        addr = sys.argv[1]
        name = None
    elif len(sys.argv) == 3:
        addr, name = sys.argv[1:3]
    print("Connecting to %s (%s)" % (name, addr))
    wm = connect(addr, name)

    #
    fclib.registerNodeType(WiiMoteNode, [('Display',)])
    wiiMoteNode = fc.createNode('WiiMote', pos=(0, 0))
    fc.connectTerminals(fc['dataIn'], wiiMoteNode['dataIn'])
    data = wm.accelerometer

    # three widgets for x-, y- & z-Axis
    xPlot = pg.PlotWidget()
    yPlot = pg.PlotWidget()
    zPlot = pg.PlotWidget()
    # add widgets to grid layout
    layout.addWidget(xPlot, 0, 1)
    layout.addWidget(yPlot, 0, 2)
    layout.addWidget(zPlot, 0, 3)

    xGaussianNode = fc.createNode('GaussianFilter', pos=(150, -150))
    yGaussianNode = fc.createNode('GaussianFilter', pos=(300, -150))
    zGaussianNode = fc.createNode('GaussianFilter', pos=(450, -150))
    xGaussianNode.ctrls['sigma'].setValue(1.3)
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:33,代码来源:analyze.py

示例12:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    pw3Node = fc.createNode('PlotWidget', pos=(0, -450))
    pw3Node.setPlot(pw3)
    pw4Node = fc.createNode('PlotWidget', pos=(0, -600))
    pw4Node.setPlot(pw4)
    pw5Node = fc.createNode('PlotWidget', pos=(0, -750))
    pw5Node.setPlot(pw5)

    wiimoteNode = fc.createNode('Wiimote', pos=(0, 0))
    bufferNodeX = fc.createNode('Buffer', pos=(150, 0))
    bufferNodeY = fc.createNode('Buffer', pos=(150, -150))
    bufferNodeZ = fc.createNode('Buffer', pos=(150, -300))
    filterNode = fc.createNode('MeanFilter', pos=(150, -450))
    normalVectorNode = fc.createNode('NormalVector', pos=(150, -300))
    curveNode = fc.createNode('PlotCurve', pos=(300, -300))

    fc.connectTerminals(wiimoteNode['accelX'], bufferNodeX['dataIn'])
    fc.connectTerminals(wiimoteNode['accelY'], bufferNodeY['dataIn'])
    fc.connectTerminals(wiimoteNode['accelZ'], bufferNodeZ['dataIn'])
    fc.connectTerminals(wiimoteNode['accelX'], normalVectorNode['xIn'])
    fc.connectTerminals(wiimoteNode['accelZ'], normalVectorNode['zIn'])
    fc.connectTerminals(normalVectorNode['xOut'], curveNode['x'])
    fc.connectTerminals(normalVectorNode['yOut'], curveNode['y'])
    fc.connectTerminals(bufferNodeX['dataOut'], filterNode['In'])
    fc.connectTerminals(bufferNodeX['dataOut'], pw1Node['In'])
    fc.connectTerminals(bufferNodeY['dataOut'], pw2Node['In'])
    fc.connectTerminals(bufferNodeZ['dataOut'], pw3Node['In'])
    fc.connectTerminals(filterNode['Out'], pw4Node['In'])
    fc.connectTerminals(curveNode['plot'], pw5Node['In'])

    win.show()
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
开发者ID:MaxSchu,项目名称:NotTheDroidsYouWereLookingFor,代码行数:33,代码来源:analyze.py

示例13:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    view = pg.GraphicsLayoutWidget()
    layout.addWidget(view, 0, 1, 2, 1)

    wiimoteNode = fc.createNode('Wiimote', pos=(0, 0), )
    bn = fc.createNode('Buffer', pos=(150, 150))
    irn = fc.createNode('IrLightNode', pos=(300, 150))
    gn = fc.createNode('GestureNode', pos=(300, 300))
    gpn = fc.createNode('GesturePlotNode', pos=(450, 150))

    # connect ir camera
    plotter = view.addPlot()
    gpn.setPlot(plotter)

    # creating label for recognized gesture
    gestureLabel = QtGui.QLabel("please connect WiiMote")
    layout.addWidget(gestureLabel, 2, 0)
    gn.setLabel(gestureLabel)

    fc.connectTerminals(wiimoteNode['ir'], bn['dataIn'])
    fc.connectTerminals(wiimoteNode['buttons'], bn['buttons'])
    fc.connectTerminals(wiimoteNode['buttons'], gn['buttons'])
    fc.connectTerminals(bn['dataOut'], irn['In'])
    fc.connectTerminals(irn['Out'], gpn['positionIn'])
    fc.connectTerminals(irn['Out'], gn['In'])
    fc.connectTerminals(gn['pathOut'], gpn['pathIn'])
    fc.connectTerminals(gn['templateOut'], gpn['templateIn'])

    win.showMaximized()
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:32,代码来源:gestures.py

示例14:

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
    # X Axis:
    pw_accelX = pg.PlotWidget()
    layout.addWidget(pw_accelX, 0, 1)
    pw_accelX.setYRange(0, 1024)

    pw_x_Node = fc.createNode('PlotWidget', pos=(370, -140))
    pw_x_Node.setPlot(pw_accelX)

    bufferNode_accelX = fc.createNode('Buffer', pos=(150, -140))

    # add Filter for X axis:
    gauss_filter_node = fc.createNode('GaussianFilter', pos=(260, -140))
    gauss_filter_node.ctrls['sigma'].setValue(1)

    fc.connectTerminals(wiimoteNode['accelX'], bufferNode_accelX['dataIn'])
    fc.connectTerminals(bufferNode_accelX['dataOut'], gauss_filter_node['In'])
    fc.connectTerminals(gauss_filter_node['Out'], pw_x_Node['In'])

    # Y Axis:
    pw_accelY = pg.PlotWidget()
    layout.addWidget(pw_accelY, 0, 2)
    pw_accelY.setYRange(0, 1024)

    pw_y_Node = fc.createNode('PlotWidget', pos=(260, 230))
    pw_y_Node.setPlot(pw_accelY)

    bufferNode_accelY = fc.createNode('Buffer', pos=(150, 120))

    fc.connectTerminals(wiimoteNode['accelY'], bufferNode_accelY['dataIn'])
    fc.connectTerminals(bufferNode_accelY['dataOut'], pw_y_Node['In'])
开发者ID:Gr4ni,项目名称:ITT-SS15,代码行数:32,代码来源:analyze.py

示例15: Demo

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import connectTerminals [as 别名]
class Demo(QtGui.QWidget):
    """
    The main class which controls initialization and
    processing.
    """

    def __init__(self, parent=None):
        super(Demo, self).__init__()

        self.setWindowTitle("Wiimote Activity")
        self.showFullScreen()

        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.fc = Flowchart(terminals={"dataIn": {"io": "in"}, "dataOut": {"io": "out"}})

        self.layout.addWidget(self.fc.widget(), 0, 0, 4, 1)

        self.createNodes()

        self.getWiimote()

    # connect to wiimote with an address given as argument
    def getWiimote(self):
        if len(sys.argv) == 1:
            addr, name = wiimote.find()[0]
        elif len(sys.argv) == 2:
            addr = sys.argv[1]
            name = None
        elif len(sys.argv) == 3:
            addr, name = sys.argv[1:3]
        print ("Connecting to %s (%s)" % (name, addr))

        self.wiimoteNode.text.setText(addr)
        self.wiimoteNode.connect_wiimote()

    def update(self):
        # let the app process events
        pg.QtGui.QApplication.processEvents()

    # create and config the nodes needed to recognize activities
    def createNodes(self):
        pwX = pg.PlotWidget()
        pwY = pg.PlotWidget()
        pwZ = pg.PlotWidget()
        pwX.getPlotItem().hideAxis("bottom")
        pwX.setYRange(300, 700)
        pwY.getPlotItem().hideAxis("bottom")
        pwY.setYRange(300, 700)
        pwZ.getPlotItem().hideAxis("bottom")
        pwZ.setYRange(300, 700)

        self.layout.addWidget(pwX, 0, 1)
        self.layout.addWidget(pwY, 1, 1)
        self.layout.addWidget(pwZ, 2, 1)

        # create nodes
        pwXNode = self.fc.createNode("PlotWidget", pos=(-150, -150))
        pwXNode.setPlot(pwX)

        pwYNode = self.fc.createNode("PlotWidget", pos=(0, -150))
        pwYNode.setPlot(pwY)

        pwZNode = self.fc.createNode("PlotWidget", pos=(150, -150))
        pwZNode.setPlot(pwZ)

        self.fileReaderNode = self.fc.createNode("FileReaderNode", pos=(0, 150))
        self.fftNode = self.fc.createNode("LiveFFTNode", pos=(0, 300))
        self.classifierNode = self.fc.createNode("SvmClassifierNode", pos=(150, 150))
        self.visualizerNode = self.fc.createNode("CategoryVisualizerNode", pos=(300, 150))

        self.wiimoteNode = self.fc.createNode("Wiimote", pos=(-300, 0))
        self.bufferXNode = self.fc.createNode("Buffer", pos=(-150, -300))
        self.bufferYNode = self.fc.createNode("Buffer", pos=(0, -300))
        self.bufferZNode = self.fc.createNode("Buffer", pos=(150, -300))

        self.fc.connectTerminals(self.wiimoteNode["accelX"], self.bufferXNode["dataIn"])
        self.fc.connectTerminals(self.wiimoteNode["accelY"], self.bufferYNode["dataIn"])
        self.fc.connectTerminals(self.wiimoteNode["accelZ"], self.bufferZNode["dataIn"])

        self.fc.connectTerminals(self.bufferXNode["dataOut"], pwXNode["In"])
        self.fc.connectTerminals(self.bufferYNode["dataOut"], pwYNode["In"])
        self.fc.connectTerminals(self.bufferZNode["dataOut"], pwZNode["In"])

        self.fc.connectTerminals(self.fileReaderNode["data"], self.fftNode["samples"])
        self.fc.connectTerminals(self.fileReaderNode["categories"], self.classifierNode["categories"])

        self.fc.connectTerminals(self.bufferXNode["dataOut"], self.fftNode["accelX"])
        self.fc.connectTerminals(self.bufferYNode["dataOut"], self.fftNode["accelY"])
        self.fc.connectTerminals(self.bufferZNode["dataOut"], self.fftNode["accelZ"])

        self.fc.connectTerminals(self.fftNode["samplesFrequencies"], self.classifierNode["trainingData"])
        self.fc.connectTerminals(self.fftNode["testFrequencies"], self.classifierNode["testData"])

        self.fc.connectTerminals(self.classifierNode["classification"], self.visualizerNode["classification"])

        self.fileReaderNode.update()

    def keyPressEvent(self, ev):
#.........这里部分代码省略.........
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:103,代码来源:classifier.py


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