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


Python Flowchart.setInput方法代码示例

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


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

示例1: AppWindow

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setInput [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 setInput [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: len

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setInput [as 别名]
layout.addWidget(v1, 0, 1)
layout.addWidget(v2, 1, 1)

win.show()

## generate random input data
data = np.random.normal(size=(100,100))
data = 25 * pg.gaussianFilter(data, (5,5))
data += np.random.normal(size=(100,100))
data[40:60, 40:60] += 15.0
data[30:50, 30:50] += 15.0
#data += np.sin(np.linspace(0, 100, 1000))
#data = metaarray.MetaArray(data, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data))}, {}])

## Set the raw data as the input value to the flowchart
fc.setInput(dataIn=data)


## At this point, we need some custom Node classes since those provided in the library
## are not sufficient. Each node will define a set of input/output terminals, a 
## processing function, and optionally a control widget (to be displayed in the 
## flowchart control panel)

class ImageViewNode(Node):
    """Node that displays image data in an ImageView widget"""
    nodeName = 'ImageView'
    
    def __init__(self, name):
        self.view = None
        ## Initialize node with only a single input terminal
        Node.__init__(self, name, terminals={'data': {'io':'in'}})
开发者ID:acrsilva,项目名称:animated-zZz-machine,代码行数:33,代码来源:FlowchartCustomNode.py

示例4: process

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setInput [as 别名]
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)

fc.setInput(dataIn=3)

s = fc.saveState()
fc.clear()

fc.restoreState(s)

fc.setInput(dataIn=3)

#f.NodeMod.TETRACYCLINE = False

if sys.flags.interactive == 0:
    app.exec_()

开发者ID:emayssat,项目名称:sandbox,代码行数:31,代码来源:Flowchart.py

示例5: loadcv

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setInput [as 别名]
## and color control.
v1 = pg.ImageView()
v2 = pg.ImageView()
layout.addWidget(v1, 0, 1)
layout.addWidget(v2, 1, 1)

win.show()

import cv2
def loadcv(pth,mode=-1,shape=None):
    im = cv2.imread(pth,mode)
    if shape:
        im = cv2.resize(im,shape)
    return im
## Set the raw data as the input value to the flowchart
fc.setInput(dataIn=loadcv(r"/mnt/4E443F99443F82AF/Dropbox/PYTHON/RRtoolbox/tests/im1_3.png",mode=0,shape=(300,300)))


## At this point, we need some custom Node classes since those provided in the library
## are not sufficient. Each node will define a set of input/output terminals, a
## processing function, and optionally a control widget (to be displayed in the
## flowchart control panel)

class ImageViewNode(Node):
    """Node that displays image data in an ImageView widget"""
    nodeName = 'ImageView'

    def __init__(self, name):
        self.view = None
        ## Initialize node with only a single input terminal
        Node.__init__(self, name, terminals={'data': {'io':'in'}},allowAddInput=False,allowAddOutput=False,allowRemove=False)
开发者ID:davtoh,项目名称:RRtools,代码行数:33,代码来源:flowchart.py

示例6: Demo

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

        self.setWindowTitle("Plotting the Wiimote")
        self.showFullScreen()

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

        self.flowchart = Flowchart(terminals={
            'xDataIn': {'io': 'in'},
            'yDataIn': {'io': 'in'},
            'zDataIn': {'io': 'in'},
            'xDataOut': {'io': 'out'},
            'yDataOut': {'io': 'out'},
            'zDataOut': {'io': 'out'}
        })

        self.layout.addWidget(self.flowchart.widget(), 0, 0, 3, 1)

        fclib.registerNodeType(WiimoteNode, [('Display',)])
        self.wii_node = self.flowchart.createNode('Wiimote', pos=(0, 0))

        self.axes = ['x', 'y', 'z']

        # positions for all nodes; order:
        # raw_node xpos, raw_node ypos, filtered_node xpos, filtered_node ypos,
        # filter_node xpos, filter_node ypos
        self.positions = {
            'x': [-450, -350, -300, -350, -375, -150],
            'y': [-150, -350, 0, -350, -75, -150],
            'z': [150, -350, 300, -350, 225, -150],
        }

        # create, style, config and connect the elements for every axis
        for axis in self.axes:
            index = self.axes.index(axis)

            plot_raw = pyqtgraph.PlotWidget()
            plot_filtered = pyqtgraph.PlotWidget()

            # add widget for this axis in next row
            self.layout.addWidget(plot_filtered, index, 2, 1, 2)

            self.configPlotItems(axis, plot_raw, plot_filtered)

            self.createNodes(axis, plot_raw, plot_filtered)

            self.connectNodes(axis)

        pyqtgraph.setConfigOptions(antialias=True)

        self.flowchart.setInput(xDataIn=0)
        self.flowchart.setInput(yDataIn=0)
        self.flowchart.setInput(zDataIn=0)

    # create raw, filter and filtered node
    def createNodes(self, axis, plot_raw, plot_filtered):

        # create filtered node
        self.plot_filtered_node = self.flowchart.createNode(
            'PlotWidget', pos=(
                self.positions[axis][2],
                self.positions[axis][3]))
        self.plot_filtered_node.setPlot(plot_filtered)

        # create gaussian filter
        self.filter_node = self.flowchart.createNode(
            'GaussianFilter', pos=(
                self.positions[axis][4],
                self.positions[axis][5]))
        self.filter_node.ctrls['sigma'].setValue(5)

    # connect nodes: flowchart -> wiinode -> plot_raw +  filter_node
    # -> filtered_node
    def connectNodes(self, axis):
        self.flowchart.connectTerminals(
            self.flowchart[axis + 'DataIn'], self.wii_node[axis + 'DataIn'])

        self.flowchart.connectTerminals(
            self.wii_node[axis + 'DataOut'], self.filter_node['In'])

        self.flowchart.connectTerminals(
            self.filter_node['Out'], self.plot_filtered_node['In'])

        #self.flowchart.connectTerminals(
        #    self.filter_node['Out'], self.flowchart[axis + 'DataOut'])

    # config plot items
    def configPlotItems(self, axis, plot_raw, plot_filtered):
        plot_raw.getPlotItem().setTitle("The " + axis + " Accelerometer")
        plot_raw.getPlotItem().setMenuEnabled(False)
        plot_raw.getPlotItem().setClipToView(False)
        plot_raw.getPlotItem().hideAxis('bottom')
        plot_raw.getPlotItem().showGrid(x=True, y=True, alpha=0.5)

        plot_filtered.getPlotItem().setTitle(
            "The " + axis + " Accelerometer - Filtered")
        plot_filtered.getPlotItem().setMenuEnabled(False)
#.........这里部分代码省略.........
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:103,代码来源:analyze.py

示例7: len

# 需要导入模块: from pyqtgraph.flowchart import Flowchart [as 别名]
# 或者: from pyqtgraph.flowchart.Flowchart import setInput [as 别名]
pw2 = pg.PlotWidget()
layout.addWidget(pw1, 0, 1)
layout.addWidget(pw2, 1, 1)

win.show()

## generate signal data to pass through the flowchart
data = np.random.normal(size=1000)
data[200:300] += 1
data += np.sin(np.linspace(0, 100, 1000))
data2 = -data
data = metaarray.MetaArray(data, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data))}, {}])
data2 = metaarray.MetaArray(data2, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data2))}, {}])

## Feed data into the input terminal of the flowchart
fc.setInput(dataIn1=data)
data = np.random.normal(size=1000)
data[200:300] += 1
data += np.sin(np.linspace(0, 100, 1000))
data2 = -data
data = metaarray.MetaArray(data, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data))}, {}])
data2 = metaarray.MetaArray(data2, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data2))}, {}])

fc.setInput(dataIn2=data)
data = np.random.normal(size=1000)
data[200:300] += 1
data += np.sin(np.linspace(0, 100, 1000))
data2 = -data
data = metaarray.MetaArray(data, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data))}, {}])
data2 = metaarray.MetaArray(data2, info=[{'name': 'Time', 'values': np.linspace(0, 1.0, len(data2))}, {}])
开发者ID:rubendegroote,项目名称:CRISTALCLEAR,代码行数:32,代码来源:temp2.py


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