Beispiel #1
0
 def __init__(self, title=None, **kargs):
     self.win = QtGui.QMainWindow()
     PlotWidget.__init__(self, **kargs)
     self.win.setCentralWidget(self)
     for m in ['resize']:
         setattr(self, m, getattr(self.win, m))
     if title is not None:
         self.win.setWindowTitle(title)
Beispiel #2
0
 def __init__(self, *args, **kwargs):
     '''
     Constructor
     '''
     View.__init__(self,*args,**kwargs)
     self._plot = PlotWidget()
     self.addWidget(self._plot)
     self.setTitle("PlotView")
     self._pen = {'width':5}
Beispiel #3
0
    def __init__(self, args, parent=None):
        self.args = args
        QMainWindow.__init__(self, parent)
        self.mcount = 0

        self.osc_sock = QUdpSocket(self)
        logger.info("osc bind localhost %d", self.args.client_port)
        self.osc_sock.bind(QHostAddress(self.args.client_host), self.args.client_port)
        self.osc_sock.readyRead.connect(self.got_message)
        self.osc_sock.error.connect(self.handle_osc_error)
        self.subscribe()

        self.plot_widget = PlotWidget()
        self.setCentralWidget(self.plot_widget)
        self.resize(args.client_width, args.client_height)
        colors = ["r", "g", "b"]
        self.active_actors = list()
        self.actors = dict()
        self.max_value = 255
        actor_names = ["merle", "uwe", "bjoern"]
        self.max_actors = len(actor_names)
        self.actor_height = self.max_value / self.max_actors
        self.fps = 12.5
        self.num_data = 100
        self.plot_widget.showGrid(False, False)
        self.plot_widget.setYRange(0, 255)
        self.plot_widget.setXRange(0, self.num_data)
        self.plot_widget.resize(args.client_width, args.client_height)

        bottom_axis = self.plot_widget.getAxis("bottom")
        left_axis = self.plot_widget.getAxis("left")
        bottom_axis.setTicks([])
        left_axis.setTicks([])
        bottom_axis.hide()
        left_axis.hide()

        for ix, (actor_name, color) in enumerate(zip(actor_names, colors)):
            self.add_actor(actor_name, self.num_data, color, ix, self.max_actors, self.actor_height)

        self.set_positions()
        self.ekg_regex = re.compile("^/(.*?)/ekg$")
        self.heartbeat_regex = re.compile("^/(.*?)/heartbeat$")

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.render_image)
        self.timer.start(50)
Beispiel #4
0
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(726, 588)

        self.splitter = QtGui.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName(_fromUtf8("splitter"))

        self.layoutWidget = QtGui.QWidget(self.splitter)
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))

        self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))

        self.plotwidget = PlotWidget(self.layoutWidget)
        self.plotwidget.setObjectName(_fromUtf8("plotView"))
        self.gridLayout.addWidget(self.plotwidget, 0, 1, 3, 3)
Beispiel #5
0
 def __init__(self, parent=None):
     pg.QtGui.QSplitter.__init__(self, pg.QtCore.Qt.Horizontal)
     self.ctrlPanel = pg.QtGui.QSplitter(pg.QtCore.Qt.Vertical)
     self.addWidget(self.ctrlPanel)
     self.fieldList = pg.QtGui.QListWidget()
     self.fieldList.setSelectionMode(self.fieldList.ExtendedSelection)
     self.ptree = pg.parametertree.ParameterTree(showHeader=False)
     self.filter = DataFilterParameter()
     self.colorMap = ColorMapParameter()
     self.style = StyleMapParameter()
     self.params = pg.parametertree.Parameter.create(name='params', type='group', children=[self.filter, self.colorMap, self.style])
     self.ptree.setParameters(self.params, showTop=False)
     
     self.plot = PlotWidget()
     self.ctrlPanel.addWidget(self.fieldList)
     self.ctrlPanel.addWidget(self.ptree)
     self.addWidget(self.plot)
     
     fg = pg.mkColor(pg.getConfigOption('foreground'))
     fg.setAlpha(150)
     self.filterText = pg.TextItem(border=pg.getConfigOption('foreground'), color=fg)
     self.filterText.setPos(60,20)
     self.filterText.setParentItem(self.plot.plotItem)
     
     self.data = None
     self.indices = None
     self.mouseOverField = None
     self.scatterPlot = None
     self.selectionScatter = None
     self.selectedIndices = []
     self._visibleXY = None  # currently plotted points
     self._visibleData = None  # currently plotted records
     self._visibleIndices = None
     self._indexMap = None
     
     self.fieldList.itemSelectionChanged.connect(self.fieldSelectionChanged)
     self.filter.sigFilterChanged.connect(self.filterChanged)
     self.colorMap.sigColorMapChanged.connect(self.updatePlot)
     self.style.sigStyleChanged.connect(self.updatePlot)
Beispiel #6
0
class PlotView(View):
    '''
    classdocs
    '''


    def __init__(self, *args, **kwargs):
        '''
        Constructor
        '''
        View.__init__(self,*args,**kwargs)
        self._plot = PlotWidget()
        self.addWidget(self._plot)
        self.setTitle("PlotView")
        self._pen = {'width':5}
        
    def update_slot(self, args):
        '''
        Method called to update the plot. In this case, arguments to specify how to draw a line plot.
        
        Parameters:
        
        - args (:class:`dict`) : a `dict` with at least two fields - "xAxis" and "yAxis". "yAxis" may be a list, in which case all the arrays within will be overlaid. Any extra fields within `args` will be passed along to the :class:`PlotWidget.plot` function.
        
        Returns:
        
        - N/A
        
    
        '''
        assert type(args) is dict, 'PlotView did not receive a dict while calling update.'
        assert 'xAxis' in args, 'PlotView did not receive an x-axis'
        assert 'yAxis' in args, 'PlotView did not receive any y-axis'
        xAxis = args['xAxis']
        yAxis = args['yAxis']
        del args['xAxis']
        del args['yAxis']
        if 'pen' not in args:
            args['pen'] = self._pen
        if type(yAxis) is list:
            self._plot.clear()
            for dset in yAxis:
                self._plot.plot(xAxis,dset,**args)
        else:
            self._plot.plot(xAxis,yAxis,clear=True,**args)
Beispiel #7
0
 def create_widget(self):
     self.widget = PlotWidget(self.parent_widget(), background='w')
Beispiel #8
0
class QtPlotView(QtControl, ProxyPlotView):
    __weakref__ = None
    widget = Typed(PlotWidget)
    _views = List()
    _colors = List(default=['r', 'g', 'b'])

    def create_widget(self):
        self.widget = PlotWidget(self.parent_widget(), background='w')

    def init_widget(self):
        super(QtPlotView, self).init_widget()
        d = self.declaration
        #self.widget.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
        self.set_data(d.data)
        self.set_antialiasing(d.antialiasing)
        self.set_aspect_locked(d.aspect_locked)
        self.set_axis_scales(d.axis_scales)
        self.set_labels(d.labels)
        self.widget.showGrid(d.grid[0], d.grid[1], d.grid_alpha)

        d.setup(self.widget)

    def set_title(self, title):
        self.set_labels(self.declaration.labels)

    def set_labels(self, labels):
        if self.declaration.title:
            labels['title'] = self.declaration.title
        self.widget.setLabels(**labels)

    def set_antialiasing(self, enabled):
        self.widget.setAntialiasing(enabled)

    def set_aspect_locked(self, locked):
        self.widget.setAspectLocked(locked)

    def set_axis_scales(self, scales):
        if not scales:
            return
        for k, v in scales.items():
            if k in self.widget.plotItem.axes:
                self.widget.plotItem.axes[k]['item'].setScale(v)

    def set_grid(self, grid):
        d = self.declaration
        self.widget.showGrid(grid[0], grid[1], d.grid_alpha)

    def set_grid_alpha(self, alpha):
        d = self.declaration
        self.widget.showGrid(d.grid[0], d.grid[1], alpha)

    def set_data(self, data):
        self.widget.clear()
        if not data:
            return

        if isinstance(data, (list, tuple)) and \
                isinstance(data[0], GraphicsObject):
            self._set_graphic_items(data)
        else:
            self._set_numeric_data(data)

    def _set_graphic_items(self, items):
        self.widget.clear()
        for item in items:
            self.widget.addItem(item)

    def _set_numeric_data(self, data):
        self.widget.plotItem.clear()
        if self._views:
            for view in self._views:
                view.clear()

        views = []
        i = 0
        if self.declaration.multi_axis:
            for i, plot in enumerate(data):
                if i > 3:
                    break
                if 'pen' not in plot:
                    plot['pen'] = self._colors[i]
                if i > 0:
                    view = ViewBox()
                    views.append(view)
                    self.widget.plotItem.scene().addItem(view)
                    if i == 1:
                        axis = self.widget.plotItem.getAxis('right')
                    elif i > 1:
                        axis = AxisItem('right')
                        axis.setZValue(-10000)
                        self.widget.plotItem.layout.addItem(axis, 2, 3)
                    axis.linkToView(view)
                    view.setXLink(self.widget.plotItem)
                    view.addItem(PlotCurveItem(**plot))
                else:
                    self.widget.plot(**plot)
        if i > 0:

            def syncViews():
                for v in views:
                    v.setGeometry(self.widget.plotItem.vb.sceneBoundingRect())
                    v.linkedViewChanged(self.widget.plotItem.vb, v.XAxis)

            syncViews()
            self.widget.plotItem.vb.sigResized.connect(syncViews)
        self._views = views
Beispiel #9
0
 def create_widget(self):
     self.widget = PlotWidget(self.parent_widget(), background='w')
Beispiel #10
0
class QtPlotView(QtControl, ProxyPlotView):
    __weakref__ = None
    widget = Typed(PlotWidget)
    _views = List()
    _colors = List(default=['r', 'g', 'b'])

    def create_widget(self):
        self.widget = PlotWidget(self.parent_widget(), background='w')

    def init_widget(self):
        super(QtPlotView, self).init_widget()
        d = self.declaration
        #self.widget.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
        self.set_data(d.data)
        self.set_antialiasing(d.antialiasing)
        self.set_aspect_locked(d.aspect_locked)
        self.set_axis_scales(d.axis_scales)
        self.set_labels(d.labels)
        self.widget.showGrid(d.grid[0], d.grid[1], d.grid_alpha)
        
        d.setup(self.widget)
        
    def set_title(self, title):
        self.set_labels(self.declaration.labels)
        
    def set_labels(self, labels):
        if self.declaration.title:
            labels['title'] = self.declaration.title
        self.widget.setLabels(**labels)
        
    def set_antialiasing(self,enabled):
        self.widget.setAntialiasing(enabled)
        
    def set_aspect_locked(self,locked):
        self.widget.setAspectLocked(locked)
        
    def set_axis_scales(self,scales):
        if not scales:
            return
        for k, v in scales.items():
            if k in self.widget.plotItem.axes:
                self.widget.plotItem.axes[k]['item'].setScale(v)
        
    def set_data(self, data):
        self.widget.clear()
        if not data:
            return
        
        if isinstance(data, (list, tuple)) and isinstance(data[0],
                                                          GraphicsObject):
            self._set_graphic_items(data)
        else:
            self._set_numeric_data(data)
        
    def _set_graphic_items(self, items):
        self.widget.clear()
        for item in items:
            self.widget.addItem(item)
        
    def _set_numeric_data(self,data):
        self.widget.plotItem.clear()
        if self._views:
            for view in self._views:
                view.clear()
            
        views = []
        i = 0
        if self.declaration.multi_axis:
            for i,plot in enumerate(data):
                if i>3:
                    break
                if 'pen' not in plot:
                    plot['pen'] = self._colors[i]
                if i>0:
                    view = ViewBox()
                    views.append(view)
                    self.widget.plotItem.scene().addItem(view)
                    if i==1:
                        axis = self.widget.plotItem.getAxis('right')
                    elif i>1:
                        axis = AxisItem('right')
                        axis.setZValue(-10000)
                        self.widget.plotItem.layout.addItem(axis,2,3)
                    axis.linkToView(view)
                    view.setXLink(self.widget.plotItem)
                    view.addItem(PlotCurveItem(**plot))
                else:    #view.setYLink(self.widget.plotItem)
                    self.widget.plot(**plot)
        if i>0:
            def syncViews():
                for v in views:
                    v.setGeometry(self.widget.plotItem.vb.sceneBoundingRect())
                    v.linkedViewChanged(self.widget.plotItem.vb,v.XAxis)
            syncViews()
            self.widget.plotItem.vb.sigResized.connect(syncViews)
        self._views = views
Beispiel #11
0
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(726, 588)
        self.gridLayout_3 = QtGui.QGridLayout(Form)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.splitter = QtGui.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName(_fromUtf8("splitter"))
        self.layoutWidget = QtGui.QWidget(self.splitter)
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
        self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.graphicsView = GraphicsView(self.layoutWidget)
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.gridLayout.addWidget(self.graphicsView, 0, 0, 2, 1)
        self.histogram = HistogramLUTWidget(self.layoutWidget)
        self.histogram.setObjectName(_fromUtf8("histogram"))
        self.gridLayout.addWidget(self.histogram, 0, 1, 1, 2)
        self.roiBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.roiBtn.sizePolicy().hasHeightForWidth())
        self.roiBtn.setSizePolicy(sizePolicy)
        self.roiBtn.setCheckable(True)
        self.roiBtn.setObjectName(_fromUtf8("roiBtn"))
        self.gridLayout.addWidget(self.roiBtn, 1, 1, 1, 1)
        self.normBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.normBtn.sizePolicy().hasHeightForWidth())
        self.normBtn.setSizePolicy(sizePolicy)
        self.normBtn.setCheckable(True)
        self.normBtn.setObjectName(_fromUtf8("normBtn"))
        self.gridLayout.addWidget(self.normBtn, 1, 2, 1, 1)
        self.roiPlot = PlotWidget(self.splitter)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.roiPlot.sizePolicy().hasHeightForWidth())
        self.roiPlot.setSizePolicy(sizePolicy)
        self.roiPlot.setMinimumSize(QtCore.QSize(0, 40))
        self.roiPlot.setObjectName(_fromUtf8("roiPlot"))
        self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1)
        self.normGroup = QtGui.QGroupBox(Form)
        self.normGroup.setObjectName(_fromUtf8("normGroup"))
        self.gridLayout_2 = QtGui.QGridLayout(self.normGroup)
        self.gridLayout_2.setMargin(0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.normSubtractRadio = QtGui.QRadioButton(self.normGroup)
        self.normSubtractRadio.setObjectName(_fromUtf8("normSubtractRadio"))
        self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1)
        self.normDivideRadio = QtGui.QRadioButton(self.normGroup)
        self.normDivideRadio.setChecked(False)
        self.normDivideRadio.setObjectName(_fromUtf8("normDivideRadio"))
        self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1)
        self.label_5 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_5.setFont(font)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1)
        self.label_3 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1)
        self.label_4 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1)
        self.normROICheck = QtGui.QCheckBox(self.normGroup)
        self.normROICheck.setObjectName(_fromUtf8("normROICheck"))
        self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1)
        self.normXBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normXBlurSpin.setObjectName(_fromUtf8("normXBlurSpin"))
        self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1)
        self.label_8 = QtGui.QLabel(self.normGroup)
        self.label_8.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.gridLayout_2.addWidget(self.label_8, 2, 1, 1, 1)
        self.label_9 = QtGui.QLabel(self.normGroup)
        self.label_9.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.gridLayout_2.addWidget(self.label_9, 2, 3, 1, 1)
        self.normYBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normYBlurSpin.setObjectName(_fromUtf8("normYBlurSpin"))
        self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1)
        self.label_10 = QtGui.QLabel(self.normGroup)
        self.label_10.setAlignment(QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignTrailing
                                   | QtCore.Qt.AlignVCenter)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.gridLayout_2.addWidget(self.label_10, 2, 5, 1, 1)
        self.normOffRadio = QtGui.QRadioButton(self.normGroup)
        self.normOffRadio.setChecked(True)
        self.normOffRadio.setObjectName(_fromUtf8("normOffRadio"))
        self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1)
        self.normTimeRangeCheck = QtGui.QCheckBox(self.normGroup)
        self.normTimeRangeCheck.setObjectName(_fromUtf8("normTimeRangeCheck"))
        self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1)
        self.normFrameCheck = QtGui.QCheckBox(self.normGroup)
        self.normFrameCheck.setObjectName(_fromUtf8("normFrameCheck"))
        self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1)
        self.normTBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normTBlurSpin.setObjectName(_fromUtf8("normTBlurSpin"))
        self.gridLayout_2.addWidget(self.normTBlurSpin, 2, 6, 1, 1)
        self.gridLayout_3.addWidget(self.normGroup, 1, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
Beispiel #12
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1268, 2100)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1268, 26))
        self.menubar.setObjectName("menubar")
        self.menu = QtWidgets.QMenu(self.menubar)
        self.menu.setObjectName("menu")
        self.menu_3 = QtWidgets.QMenu(self.menu)
        self.menu_3.setObjectName("menu_3")
        self.menu_5 = QtWidgets.QMenu(self.menu)
        self.menu_5.setObjectName("menu_5")
        self.menu_2 = QtWidgets.QMenu(self.menubar)
        self.menu_2.setObjectName("menu_2")
        self.menu_4 = QtWidgets.QMenu(self.menubar)
        self.menu_4.setObjectName("menu_4")
        self.menu_6 = QtWidgets.QMenu(self.menubar)
        self.menu_6.setObjectName("menu_6")
        self.menu_7 = QtWidgets.QMenu(self.menu_6)
        self.menu_7.setObjectName("menu_7")
        MainWindow.setMenuBar(self.menubar)
        self.dockWidget = QtWidgets.QDockWidget(MainWindow)
        self.dockWidget.setMinimumSize(QtCore.QSize(629, 424))
        self.dockWidget.setFeatures(QtWidgets.QDockWidget.DockWidgetClosable
                                    | QtWidgets.QDockWidget.DockWidgetMovable)
        self.dockWidget.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea)
        self.dockWidget.setObjectName("dockWidget")
        self.dockWidgetContents = QtWidgets.QWidget()
        self.dockWidgetContents.setObjectName("dockWidgetContents")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.tableWidget = ExtendedTableWidget(self.dockWidgetContents)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.gridLayout.addWidget(self.tableWidget, 0, 0, 1, 1)
        self.groupBox = QtWidgets.QGroupBox(self.dockWidgetContents)
        self.groupBox.setObjectName("groupBox")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout_4.setObjectName("gridLayout_4")
        spacerItem = QtWidgets.QSpacerItem(20, 270,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_4.addItem(spacerItem, 1, 0, 1, 1)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setContentsMargins(5, 5, 5, 5)
        self.verticalLayout.setObjectName("verticalLayout")
        self.radioButtonOriData = QtWidgets.QRadioButton(self.groupBox)
        self.radioButtonOriData.setObjectName("radioButtonOriData")
        self.verticalLayout.addWidget(self.radioButtonOriData)
        self.radioButton_ProcessData = QtWidgets.QRadioButton(self.groupBox)
        self.radioButton_ProcessData.setObjectName("radioButton_ProcessData")
        self.verticalLayout.addWidget(self.radioButton_ProcessData)
        self.gridLayout_4.addLayout(self.verticalLayout, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 1)
        self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1)
        self.dockWidget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
        self.dockWidget_2 = QtWidgets.QDockWidget(MainWindow)
        self.dockWidget_2.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable)
        self.dockWidget_2.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea
                                          | QtCore.Qt.RightDockWidgetArea)
        self.dockWidget_2.setObjectName("dockWidget_2")
        self.dockWidgetContents_2 = QtWidgets.QWidget()
        self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
        self.gridLayout_7 = QtWidgets.QGridLayout(self.dockWidgetContents_2)
        self.gridLayout_7.setObjectName("gridLayout_7")
        self.frame_2 = QtWidgets.QFrame(self.dockWidgetContents_2)
        self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.frame_2.setLineWidth(2)
        self.frame_2.setObjectName("frame_2")
        self.gridLayout_5 = QtWidgets.QGridLayout(self.frame_2)
        self.gridLayout_5.setObjectName("gridLayout_5")
        self.ori_plot_win = PlotWidget(self.frame_2)
        self.ori_plot_win.setObjectName("ori_plot_win")
        self.gridLayout_5.addWidget(self.ori_plot_win, 0, 0, 1, 1)
        self.gridLayout_7.addWidget(self.frame_2, 0, 0, 1, 1)
        self.groupBox_2 = QtWidgets.QGroupBox(self.dockWidgetContents_2)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.groupBox_2.sizePolicy().hasHeightForWidth())
        self.groupBox_2.setSizePolicy(sizePolicy)
        self.groupBox_2.setObjectName("groupBox_2")
        self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_2)
        self.gridLayout_6.setObjectName("gridLayout_6")
        self.gridLayout_8 = QtWidgets.QGridLayout()
        self.gridLayout_8.setObjectName("gridLayout_8")
        self.gridLayout_9 = QtWidgets.QGridLayout()
        self.gridLayout_9.setObjectName("gridLayout_9")
        self.label = QtWidgets.QLabel(self.groupBox_2)
        self.label.setObjectName("label")
        self.gridLayout_9.addWidget(self.label, 0, 0, 1, 1)
        self.lineEdit_horizontalAxisTitle = QtWidgets.QLineEdit(
            self.groupBox_2)
        self.lineEdit_horizontalAxisTitle.setObjectName(
            "lineEdit_horizontalAxisTitle")
        self.gridLayout_9.addWidget(self.lineEdit_horizontalAxisTitle, 0, 1, 1,
                                    1)
        self.label_2 = QtWidgets.QLabel(self.groupBox_2)
        self.label_2.setObjectName("label_2")
        self.gridLayout_9.addWidget(self.label_2, 1, 0, 1, 1)
        self.lineEdit_horizontalAxisUnits = QtWidgets.QLineEdit(
            self.groupBox_2)
        self.lineEdit_horizontalAxisUnits.setObjectName(
            "lineEdit_horizontalAxisUnits")
        self.gridLayout_9.addWidget(self.lineEdit_horizontalAxisUnits, 1, 1, 1,
                                    1)
        self.label_3 = QtWidgets.QLabel(self.groupBox_2)
        self.label_3.setObjectName("label_3")
        self.gridLayout_9.addWidget(self.label_3, 2, 0, 1, 1)
        self.lineEdit_verticalAxisTitle = QtWidgets.QLineEdit(self.groupBox_2)
        self.lineEdit_verticalAxisTitle.setObjectName(
            "lineEdit_verticalAxisTitle")
        self.gridLayout_9.addWidget(self.lineEdit_verticalAxisTitle, 2, 1, 1,
                                    1)
        self.label_4 = QtWidgets.QLabel(self.groupBox_2)
        self.label_4.setObjectName("label_4")
        self.gridLayout_9.addWidget(self.label_4, 3, 0, 1, 1)
        self.lineEdit_verticalAxisUnits = QtWidgets.QLineEdit(self.groupBox_2)
        self.lineEdit_verticalAxisUnits.setObjectName(
            "lineEdit_verticalAxisUnits")
        self.gridLayout_9.addWidget(self.lineEdit_verticalAxisUnits, 3, 1, 1,
                                    1)
        self.checkBox_reverseAxis = QtWidgets.QCheckBox(self.groupBox_2)
        self.checkBox_reverseAxis.setObjectName("checkBox_reverseAxis")
        self.gridLayout_9.addWidget(self.checkBox_reverseAxis, 4, 0, 1, 2)
        self.gridLayout_8.addLayout(self.gridLayout_9, 0, 0, 1, 1)
        self.gridLayout_10 = QtWidgets.QGridLayout()
        self.gridLayout_10.setObjectName("gridLayout_10")
        self.pushButton_draw = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_draw.setObjectName("pushButton_draw")
        self.gridLayout_10.addWidget(self.pushButton_draw, 0, 0, 1, 1)
        self.pushButton_reset = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_reset.setObjectName("pushButton_reset")
        self.gridLayout_10.addWidget(self.pushButton_reset, 0, 1, 1, 1)
        self.pushButton_clearPicture = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_clearPicture.setObjectName("pushButton_clearPicture")
        self.gridLayout_10.addWidget(self.pushButton_clearPicture, 0, 2, 1, 1)
        self.gridLayout_8.addLayout(self.gridLayout_10, 1, 0, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_8.addItem(spacerItem1, 2, 0, 1, 1)
        self.gridLayout_6.addLayout(self.gridLayout_8, 0, 0, 2, 2)
        self.label_5 = QtWidgets.QLabel(self.groupBox_2)
        self.label_5.setText("")
        self.label_5.setObjectName("label_5")
        self.gridLayout_6.addWidget(self.label_5, 1, 1, 1, 1)
        self.gridLayout_7.addWidget(self.groupBox_2, 0, 1, 1, 1)
        self.dockWidget_2.setWidget(self.dockWidgetContents_2)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1),
                                 self.dockWidget_2)
        self.dockWidget_3 = QtWidgets.QDockWidget(MainWindow)
        self.dockWidget_3.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable)
        self.dockWidget_3.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea
                                          | QtCore.Qt.RightDockWidgetArea)
        self.dockWidget_3.setObjectName("dockWidget_3")
        self.dockWidgetContents_3 = QtWidgets.QWidget()
        self.dockWidgetContents_3.setObjectName("dockWidgetContents_3")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents_3)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.splitter_3 = QtWidgets.QSplitter(self.dockWidgetContents_3)
        self.splitter_3.setOrientation(QtCore.Qt.Vertical)
        self.splitter_3.setObjectName("splitter_3")
        self.splitter_2 = QtWidgets.QSplitter(self.splitter_3)
        self.splitter_2.setOrientation(QtCore.Qt.Horizontal)
        self.splitter_2.setObjectName("splitter_2")
        self.groupBox_3 = QtWidgets.QGroupBox(self.splitter_2)
        self.groupBox_3.setObjectName("groupBox_3")
        self.gridLayout_11 = QtWidgets.QGridLayout(self.groupBox_3)
        self.gridLayout_11.setObjectName("gridLayout_11")
        self.tableWidget_SettlementDisplay = ExtendedTableWidget(
            self.groupBox_3)
        self.tableWidget_SettlementDisplay.setObjectName(
            "tableWidget_SettlementDisplay")
        self.tableWidget_SettlementDisplay.setColumnCount(0)
        self.tableWidget_SettlementDisplay.setRowCount(0)
        self.gridLayout_11.addWidget(self.tableWidget_SettlementDisplay, 0, 0,
                                     1, 1)
        self.groupBox_4 = QtWidgets.QGroupBox(self.splitter_2)
        self.groupBox_4.setObjectName("groupBox_4")
        self.gridLayout_12 = QtWidgets.QGridLayout(self.groupBox_4)
        self.gridLayout_12.setObjectName("gridLayout_12")
        self.predictPlotWin = PlotWidget(self.groupBox_4)
        self.predictPlotWin.setObjectName("predictPlotWin")
        self.gridLayout_12.addWidget(self.predictPlotWin, 0, 0, 1, 1)
        self.groupBox_5 = QtWidgets.QGroupBox(self.splitter_3)
        self.groupBox_5.setObjectName("groupBox_5")
        self.gridLayout_13 = QtWidgets.QGridLayout(self.groupBox_5)
        self.gridLayout_13.setObjectName("gridLayout_13")
        self.textBrowser = CustomTextBrowser(self.groupBox_5)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout_13.addWidget(self.textBrowser, 0, 0, 1, 1)
        self.gridLayout_2.addWidget(self.splitter_3, 0, 0, 1, 1)
        self.dockWidget_3.setWidget(self.dockWidgetContents_3)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1),
                                 self.dockWidget_3)
        self.dockWidget_4 = QtWidgets.QDockWidget(MainWindow)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dockWidget_4.sizePolicy().hasHeightForWidth())
        self.dockWidget_4.setSizePolicy(sizePolicy)
        self.dockWidget_4.setMinimumSize(QtCore.QSize(386, 135))
        self.dockWidget_4.setMaximumSize(QtCore.QSize(386, 524287))
        self.dockWidget_4.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable)
        self.dockWidget_4.setAllowedAreas(QtCore.Qt.RightDockWidgetArea)
        self.dockWidget_4.setObjectName("dockWidget_4")
        self.dockWidgetContents_7 = QtWidgets.QWidget()
        self.dockWidgetContents_7.setObjectName("dockWidgetContents_7")
        self.gridLayout_17 = QtWidgets.QGridLayout(self.dockWidgetContents_7)
        self.gridLayout_17.setObjectName("gridLayout_17")
        self.scrollArea = QtWidgets.QScrollArea(self.dockWidgetContents_7)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(
            0, 0, 373, 2003))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.gridLayout_26 = QtWidgets.QGridLayout(
            self.scrollAreaWidgetContents)
        self.gridLayout_26.setObjectName("gridLayout_26")
        self.gridLayout_25 = QtWidgets.QGridLayout()
        self.gridLayout_25.setObjectName("gridLayout_25")
        self.groupBox_6 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.groupBox_6.sizePolicy().hasHeightForWidth())
        self.groupBox_6.setSizePolicy(sizePolicy)
        self.groupBox_6.setObjectName("groupBox_6")
        self.gridLayout_15 = QtWidgets.QGridLayout(self.groupBox_6)
        self.gridLayout_15.setObjectName("gridLayout_15")
        self.gridLayout_16 = QtWidgets.QGridLayout()
        self.gridLayout_16.setObjectName("gridLayout_16")
        self.checkBox_MetabolismModel = QtWidgets.QCheckBox(self.groupBox_6)
        self.checkBox_MetabolismModel.setObjectName("checkBox_MetabolismModel")
        self.gridLayout_16.addWidget(self.checkBox_MetabolismModel, 3, 0, 1, 1)
        self.checkBox_SupplementModel = QtWidgets.QCheckBox(self.groupBox_6)
        self.checkBox_SupplementModel.setObjectName("checkBox_SupplementModel")
        self.gridLayout_16.addWidget(self.checkBox_SupplementModel, 2, 0, 1, 1)
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
        self.formLayout.setObjectName("formLayout")
        self.labelTrainCount = QtWidgets.QLabel(self.groupBox_6)
        self.labelTrainCount.setObjectName("labelTrainCount")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.labelTrainCount)
        self.SpinBoxTrainCount = QtWidgets.QSpinBox(self.groupBox_6)
        self.SpinBoxTrainCount.setObjectName("SpinBoxTrainCount")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.SpinBoxTrainCount)
        self.LabelTestCount = QtWidgets.QLabel(self.groupBox_6)
        self.LabelTestCount.setObjectName("LabelTestCount")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.LabelTestCount)
        self.SpinBoxPredictCount = QtWidgets.QSpinBox(self.groupBox_6)
        self.SpinBoxPredictCount.setObjectName("SpinBoxPredictCount")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.SpinBoxPredictCount)
        self.gridLayout_16.addLayout(self.formLayout, 0, 0, 1, 1)
        self.checkBox_CommonGrayModel = QtWidgets.QCheckBox(self.groupBox_6)
        self.checkBox_CommonGrayModel.setObjectName("checkBox_CommonGrayModel")
        self.gridLayout_16.addWidget(self.checkBox_CommonGrayModel, 1, 0, 1, 1)
        self.gridLayout_15.addLayout(self.gridLayout_16, 0, 0, 1, 1)
        self.gridLayout_25.addWidget(self.groupBox_6, 0, 0, 1, 1)
        self.groupBox_7 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.groupBox_7.sizePolicy().hasHeightForWidth())
        self.groupBox_7.setSizePolicy(sizePolicy)
        self.groupBox_7.setObjectName("groupBox_7")
        self.gridLayout_14 = QtWidgets.QGridLayout(self.groupBox_7)
        self.gridLayout_14.setObjectName("gridLayout_14")
        self.gridLayout_18 = QtWidgets.QGridLayout()
        self.gridLayout_18.setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.gridLayout_18.setObjectName("gridLayout_18")
        self.lineEdit_FinalSettlement = QtWidgets.QLineEdit(self.groupBox_7)
        self.lineEdit_FinalSettlement.setObjectName("lineEdit_FinalSettlement")
        self.gridLayout_18.addWidget(self.lineEdit_FinalSettlement, 0, 2, 1, 1)
        self.lineEdit_DigSpeed = QtWidgets.QLineEdit(self.groupBox_7)
        self.lineEdit_DigSpeed.setObjectName("lineEdit_DigSpeed")
        self.gridLayout_18.addWidget(self.lineEdit_DigSpeed, 1, 2, 1, 1)
        self.label_8 = QtWidgets.QLabel(self.groupBox_7)
        self.label_8.setObjectName("label_8")
        self.gridLayout_18.addWidget(self.label_8, 2, 0, 1, 2)
        self.lineEdit_AverageDigDepth = QtWidgets.QLineEdit(self.groupBox_7)
        self.lineEdit_AverageDigDepth.setObjectName("lineEdit_AverageDigDepth")
        self.gridLayout_18.addWidget(self.lineEdit_AverageDigDepth, 2, 2, 1, 1)
        self.lineEdit_OffsetDistance = QtWidgets.QLineEdit(self.groupBox_7)
        self.lineEdit_OffsetDistance.setObjectName("lineEdit_OffsetDistance")
        self.gridLayout_18.addWidget(self.lineEdit_OffsetDistance, 3, 2, 1, 1)
        self.lineEdit_MainInfluentialAngel = QtWidgets.QLineEdit(
            self.groupBox_7)
        self.lineEdit_MainInfluentialAngel.setObjectName(
            "lineEdit_MainInfluentialAngel")
        self.gridLayout_18.addWidget(self.lineEdit_MainInfluentialAngel, 4, 2,
                                     1, 1)
        self.lineEdit_GroundMoveTotalTime = QtWidgets.QLineEdit(
            self.groupBox_7)
        self.lineEdit_GroundMoveTotalTime.setObjectName(
            "lineEdit_GroundMoveTotalTime")
        self.gridLayout_18.addWidget(self.lineEdit_GroundMoveTotalTime, 5, 2,
                                     1, 1)
        self.lineEdit_CoalVerticalThickness = QtWidgets.QLineEdit(
            self.groupBox_7)
        self.lineEdit_CoalVerticalThickness.setObjectName(
            "lineEdit_CoalVerticalThickness")
        self.gridLayout_18.addWidget(self.lineEdit_CoalVerticalThickness, 6, 2,
                                     1, 1)
        self.lineEdit_CoalAngel = QtWidgets.QLineEdit(self.groupBox_7)
        self.lineEdit_CoalAngel.setObjectName("lineEdit_CoalAngel")
        self.gridLayout_18.addWidget(self.lineEdit_CoalAngel, 7, 2, 1, 1)
        self.lineEdit_GetDataTimeInterval = QtWidgets.QLineEdit(
            self.groupBox_7)
        self.lineEdit_GetDataTimeInterval.setText("")
        self.lineEdit_GetDataTimeInterval.setObjectName(
            "lineEdit_GetDataTimeInterval")
        self.gridLayout_18.addWidget(self.lineEdit_GetDataTimeInterval, 9, 2,
                                     1, 1)
        self.label_6 = QtWidgets.QLabel(self.groupBox_7)
        self.label_6.setObjectName("label_6")
        self.gridLayout_18.addWidget(self.label_6, 0, 0, 1, 2)
        self.label_7 = QtWidgets.QLabel(self.groupBox_7)
        self.label_7.setObjectName("label_7")
        self.gridLayout_18.addWidget(self.label_7, 1, 0, 1, 2)
        self.label_9 = QtWidgets.QLabel(self.groupBox_7)
        self.label_9.setObjectName("label_9")
        self.gridLayout_18.addWidget(self.label_9, 3, 0, 1, 2)
        self.label_10 = QtWidgets.QLabel(self.groupBox_7)
        self.label_10.setObjectName("label_10")
        self.gridLayout_18.addWidget(self.label_10, 4, 0, 1, 2)
        self.label_11 = QtWidgets.QLabel(self.groupBox_7)
        self.label_11.setObjectName("label_11")
        self.gridLayout_18.addWidget(self.label_11, 5, 0, 1, 2)
        self.label_12 = QtWidgets.QLabel(self.groupBox_7)
        self.label_12.setObjectName("label_12")
        self.gridLayout_18.addWidget(self.label_12, 6, 0, 1, 2)
        self.label_13 = QtWidgets.QLabel(self.groupBox_7)
        self.label_13.setObjectName("label_13")
        self.gridLayout_18.addWidget(self.label_13, 7, 0, 1, 2)
        self.lineEdit_DownCoefficient = QtWidgets.QLineEdit(self.groupBox_7)
        self.lineEdit_DownCoefficient.setText("")
        self.lineEdit_DownCoefficient.setObjectName("lineEdit_DownCoefficient")
        self.gridLayout_18.addWidget(self.lineEdit_DownCoefficient, 8, 2, 1, 1)
        self.label_14 = QtWidgets.QLabel(self.groupBox_7)
        self.label_14.setObjectName("label_14")
        self.gridLayout_18.addWidget(self.label_14, 8, 0, 1, 2)
        self.label_15 = QtWidgets.QLabel(self.groupBox_7)
        self.label_15.setObjectName("label_15")
        self.gridLayout_18.addWidget(self.label_15, 9, 0, 1, 2)
        self.gridLayout_14.addLayout(self.gridLayout_18, 0, 0, 1, 1)
        self.gridLayout_25.addWidget(self.groupBox_7, 1, 0, 1, 1)
        self.groupBox_8 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
        self.groupBox_8.setObjectName("groupBox_8")
        self.gridLayout_20 = QtWidgets.QGridLayout(self.groupBox_8)
        self.gridLayout_20.setObjectName("gridLayout_20")
        self.gridLayout_19 = QtWidgets.QGridLayout()
        self.gridLayout_19.setObjectName("gridLayout_19")
        self.label_18 = QtWidgets.QLabel(self.groupBox_8)
        self.label_18.setObjectName("label_18")
        self.gridLayout_19.addWidget(self.label_18, 2, 0, 1, 2)
        self.lineEdit_3 = QtWidgets.QLineEdit(self.groupBox_8)
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.gridLayout_19.addWidget(self.lineEdit_3, 2, 2, 1, 1)
        self.lineEdit_2 = QtWidgets.QLineEdit(self.groupBox_8)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.gridLayout_19.addWidget(self.lineEdit_2, 1, 2, 1, 1)
        self.lineEdit = QtWidgets.QLineEdit(self.groupBox_8)
        self.lineEdit.setObjectName("lineEdit")
        self.gridLayout_19.addWidget(self.lineEdit, 0, 2, 1, 1)
        self.label_16 = QtWidgets.QLabel(self.groupBox_8)
        self.label_16.setObjectName("label_16")
        self.gridLayout_19.addWidget(self.label_16, 0, 0, 1, 2)
        self.label_17 = QtWidgets.QLabel(self.groupBox_8)
        self.label_17.setObjectName("label_17")
        self.gridLayout_19.addWidget(self.label_17, 1, 0, 1, 2)
        self.gridLayout_20.addLayout(self.gridLayout_19, 0, 0, 1, 1)
        self.gridLayout_25.addWidget(self.groupBox_8, 2, 0, 1, 1)
        self.groupBox_9 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
        self.groupBox_9.setObjectName("groupBox_9")
        self.gridLayout_24 = QtWidgets.QGridLayout(self.groupBox_9)
        self.gridLayout_24.setObjectName("gridLayout_24")
        self.gridLayout_23 = QtWidgets.QGridLayout()
        self.gridLayout_23.setObjectName("gridLayout_23")
        self.gridLayout_21 = QtWidgets.QGridLayout()
        self.gridLayout_21.setObjectName("gridLayout_21")
        self.doubleSpinBox_taoEnd = QtWidgets.QDoubleSpinBox(self.groupBox_9)
        self.doubleSpinBox_taoEnd.setObjectName("doubleSpinBox_taoEnd")
        self.gridLayout_21.addWidget(self.doubleSpinBox_taoEnd, 7, 1, 1, 1)
        self.label_27 = QtWidgets.QLabel(self.groupBox_9)
        self.label_27.setObjectName("label_27")
        self.gridLayout_21.addWidget(self.label_27, 8, 0, 1, 1)
        self.doubleSpinBox_taoChangeStep = QtWidgets.QDoubleSpinBox(
            self.groupBox_9)
        self.doubleSpinBox_taoChangeStep.setObjectName(
            "doubleSpinBox_taoChangeStep")
        self.gridLayout_21.addWidget(self.doubleSpinBox_taoChangeStep, 8, 1, 1,
                                     1)
        self.doubleSpinBox_CChangeStep = QtWidgets.QDoubleSpinBox(
            self.groupBox_9)
        self.doubleSpinBox_CChangeStep.setObjectName(
            "doubleSpinBox_CChangeStep")
        self.gridLayout_21.addWidget(self.doubleSpinBox_CChangeStep, 5, 1, 1,
                                     1)
        self.label_25 = QtWidgets.QLabel(self.groupBox_9)
        self.label_25.setObjectName("label_25")
        self.gridLayout_21.addWidget(self.label_25, 6, 0, 1, 1)
        self.label_22 = QtWidgets.QLabel(self.groupBox_9)
        self.label_22.setObjectName("label_22")
        self.gridLayout_21.addWidget(self.label_22, 3, 0, 1, 1)
        self.doubleSpinBox_CBegin = QtWidgets.QDoubleSpinBox(self.groupBox_9)
        self.doubleSpinBox_CBegin.setObjectName("doubleSpinBox_CBegin")
        self.gridLayout_21.addWidget(self.doubleSpinBox_CBegin, 3, 1, 1, 1)
        self.label_23 = QtWidgets.QLabel(self.groupBox_9)
        self.label_23.setObjectName("label_23")
        self.gridLayout_21.addWidget(self.label_23, 4, 0, 1, 1)
        self.doubleSpinBox_CEnd = QtWidgets.QDoubleSpinBox(self.groupBox_9)
        self.doubleSpinBox_CEnd.setObjectName("doubleSpinBox_CEnd")
        self.gridLayout_21.addWidget(self.doubleSpinBox_CEnd, 4, 1, 1, 1)
        self.label_24 = QtWidgets.QLabel(self.groupBox_9)
        self.label_24.setObjectName("label_24")
        self.gridLayout_21.addWidget(self.label_24, 5, 0, 1, 1)
        self.label_26 = QtWidgets.QLabel(self.groupBox_9)
        self.label_26.setObjectName("label_26")
        self.gridLayout_21.addWidget(self.label_26, 7, 0, 1, 1)
        self.doubleSpinBox_taoBegin = QtWidgets.QDoubleSpinBox(self.groupBox_9)
        self.doubleSpinBox_taoBegin.setObjectName("doubleSpinBox_taoBegin")
        self.gridLayout_21.addWidget(self.doubleSpinBox_taoBegin, 6, 1, 1, 1)
        self.label_19 = QtWidgets.QLabel(self.groupBox_9)
        self.label_19.setObjectName("label_19")
        self.gridLayout_21.addWidget(self.label_19, 0, 0, 1, 1)
        self.doubleSpinBox_W0Begin = QtWidgets.QDoubleSpinBox(self.groupBox_9)
        self.doubleSpinBox_W0Begin.setObjectName("doubleSpinBox_W0Begin")
        self.gridLayout_21.addWidget(self.doubleSpinBox_W0Begin, 0, 1, 1, 1)
        self.label_20 = QtWidgets.QLabel(self.groupBox_9)
        self.label_20.setObjectName("label_20")
        self.gridLayout_21.addWidget(self.label_20, 1, 0, 1, 1)
        self.doubleSpinBox_W0End = QtWidgets.QDoubleSpinBox(self.groupBox_9)
        self.doubleSpinBox_W0End.setObjectName("doubleSpinBox_W0End")
        self.gridLayout_21.addWidget(self.doubleSpinBox_W0End, 1, 1, 1, 1)
        self.label_21 = QtWidgets.QLabel(self.groupBox_9)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_21.sizePolicy().hasHeightForWidth())
        self.label_21.setSizePolicy(sizePolicy)
        self.label_21.setObjectName("label_21")
        self.gridLayout_21.addWidget(self.label_21, 2, 0, 1, 1)
        self.doubleSpinBox_W0ChangeStep = QtWidgets.QDoubleSpinBox(
            self.groupBox_9)
        self.doubleSpinBox_W0ChangeStep.setObjectName(
            "doubleSpinBox_W0ChangeStep")
        self.gridLayout_21.addWidget(self.doubleSpinBox_W0ChangeStep, 2, 1, 1,
                                     1)
        self.gridLayout_23.addLayout(self.gridLayout_21, 0, 0, 1, 1)
        self.gridLayout_22 = QtWidgets.QGridLayout()
        self.gridLayout_22.setObjectName("gridLayout_22")
        spacerItem2 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_22.addItem(spacerItem2, 0, 0, 1, 1)
        self.pushButton = QtWidgets.QPushButton(self.groupBox_9)
        self.pushButton.setObjectName("pushButton")
        self.gridLayout_22.addWidget(self.pushButton, 0, 1, 1, 1)
        spacerItem3 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_22.addItem(spacerItem3, 0, 2, 1, 1)
        self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_9)
        self.pushButton_2.setObjectName("pushButton_2")
        self.gridLayout_22.addWidget(self.pushButton_2, 0, 3, 1, 1)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_22.addItem(spacerItem4, 0, 4, 1, 1)
        self.pushButton_3 = QtWidgets.QPushButton(self.groupBox_9)
        self.pushButton_3.setObjectName("pushButton_3")
        self.gridLayout_22.addWidget(self.pushButton_3, 0, 5, 1, 1)
        spacerItem5 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_22.addItem(spacerItem5, 0, 6, 1, 1)
        self.gridLayout_23.addLayout(self.gridLayout_22, 1, 0, 1, 1)
        self.gridLayout_24.addLayout(self.gridLayout_23, 0, 0, 1, 1)
        self.gridLayout_25.addWidget(self.groupBox_9, 3, 0, 1, 1)
        self.gridLayout_26.addLayout(self.gridLayout_25, 0, 0, 1, 1)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.gridLayout_17.addWidget(self.scrollArea, 0, 0, 1, 1)
        self.dockWidget_4.setWidget(self.dockWidgetContents_7)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2),
                                 self.dockWidget_4)
        self.action_newTable = QtWidgets.QAction(MainWindow)
        self.action_newTable.setObjectName("action_newTable")
        self.action_exit = QtWidgets.QAction(MainWindow)
        self.action_exit.setObjectName("action_exit")
        self.action_6 = QtWidgets.QAction(MainWindow)
        self.action_6.setObjectName("action_6")
        self.action_7 = QtWidgets.QAction(MainWindow)
        self.action_7.setObjectName("action_7")
        self.action_copy = QtWidgets.QAction(MainWindow)
        self.action_copy.setObjectName("action_copy")
        self.action_paste = QtWidgets.QAction(MainWindow)
        self.action_paste.setObjectName("action_paste")
        self.action_shear = QtWidgets.QAction(MainWindow)
        self.action_shear.setObjectName("action_shear")
        self.action_selecteAll = QtWidgets.QAction(MainWindow)
        self.action_selecteAll.setObjectName("action_selecteAll")
        self.action_delete = QtWidgets.QAction(MainWindow)
        self.action_delete.setObjectName("action_delete")
        self.action_datafromExcel = QtWidgets.QAction(MainWindow)
        self.action_datafromExcel.setObjectName("action_datafromExcel")
        self.action_16 = QtWidgets.QAction(MainWindow)
        self.action_16.setText("")
        self.action_16.setObjectName("action_16")
        self.action_17 = QtWidgets.QAction(MainWindow)
        self.action_17.setCheckable(True)
        self.action_17.setObjectName("action_17")
        self.action_18 = QtWidgets.QAction(MainWindow)
        self.action_18.setCheckable(True)
        self.action_18.setObjectName("action_18")
        self.action_19 = QtWidgets.QAction(MainWindow)
        self.action_19.setCheckable(True)
        self.action_19.setObjectName("action_19")
        self.action_20 = QtWidgets.QAction(MainWindow)
        self.action_20.setObjectName("action_20")
        self.action_outputStrainData = QtWidgets.QAction(MainWindow)
        self.action_outputStrainData.setObjectName("action_outputStrainData")
        self.action_outputKnotheData = QtWidgets.QAction(MainWindow)
        self.action_outputKnotheData.setObjectName("action_outputKnotheData")
        self.action_outputGrayModelData = QtWidgets.QAction(MainWindow)
        self.action_outputGrayModelData.setObjectName(
            "action_outputGrayModelData")
        self.action_addRow = QtWidgets.QAction(MainWindow)
        self.action_addRow.setObjectName("action_addRow")
        self.action_addCol = QtWidgets.QAction(MainWindow)
        self.action_addCol.setObjectName("action_addCol")
        self.action_RunGrayTheory = QtWidgets.QAction(MainWindow)
        self.action_RunGrayTheory.setObjectName("action_RunGrayTheory")
        self.action_3 = QtWidgets.QAction(MainWindow)
        self.action_3.setText("")
        self.action_3.setObjectName("action_3")
        self.action_4 = QtWidgets.QAction(MainWindow)
        self.action_4.setText("")
        self.action_4.setObjectName("action_4")
        self.action_5 = QtWidgets.QAction(MainWindow)
        self.action_5.setObjectName("action_5")
        self.action_8 = QtWidgets.QAction(MainWindow)
        self.action_8.setObjectName("action_8")
        self.action_DynamicFit = QtWidgets.QAction(MainWindow)
        self.action_DynamicFit.setObjectName("action_DynamicFit")
        self.action_TheoryCalculationPrediction = QtWidgets.QAction(MainWindow)
        self.action_TheoryCalculationPrediction.setObjectName(
            "action_TheoryCalculationPrediction")
        self.action_CustomParameterFit = QtWidgets.QAction(MainWindow)
        self.action_CustomParameterFit.setObjectName(
            "action_CustomParameterFit")
        self.action_CalculateSettlement = QtWidgets.QAction(MainWindow)
        self.action_CalculateSettlement.setObjectName(
            "action_CalculateSettlement")
        self.menu_3.addAction(self.action_datafromExcel)
        self.menu_5.addAction(self.action_outputStrainData)
        self.menu_5.addAction(self.action_outputKnotheData)
        self.menu_5.addAction(self.action_outputGrayModelData)
        self.menu.addAction(self.action_newTable)
        self.menu.addAction(self.menu_3.menuAction())
        self.menu.addAction(self.menu_5.menuAction())
        self.menu.addSeparator()
        self.menu.addAction(self.action_exit)
        self.menu_2.addSeparator()
        self.menu_2.addAction(self.action_copy)
        self.menu_2.addAction(self.action_shear)
        self.menu_2.addAction(self.action_paste)
        self.menu_2.addSeparator()
        self.menu_2.addAction(self.action_addRow)
        self.menu_2.addAction(self.action_addCol)
        self.menu_2.addSeparator()
        self.menu_2.addAction(self.action_selecteAll)
        self.menu_2.addAction(self.action_delete)
        self.menu_4.addAction(self.action_17)
        self.menu_4.addAction(self.action_18)
        self.menu_4.addAction(self.action_19)
        self.menu_4.addSeparator()
        self.menu_4.addAction(self.action_20)
        self.menu_7.addAction(self.action_TheoryCalculationPrediction)
        self.menu_7.addAction(self.action_CustomParameterFit)
        self.menu_6.addAction(self.action_CalculateSettlement)
        self.menu_6.addAction(self.action_RunGrayTheory)
        self.menu_6.addAction(self.menu_7.menuAction())
        self.menu_6.addAction(self.action_DynamicFit)
        self.menubar.addAction(self.menu.menuAction())
        self.menubar.addAction(self.menu_2.menuAction())
        self.menubar.addAction(self.menu_4.menuAction())
        self.menubar.addAction(self.menu_6.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Beispiel #13
0
class EkgPlotWidget(QMainWindow):
    def __init__(self, args, parent=None):
        self.args = args
        QMainWindow.__init__(self, parent)
        self.mcount = 0

        self.osc_sock = QUdpSocket(self)
        logger.info("osc bind localhost %d", self.args.client_port)
        self.osc_sock.bind(QHostAddress(self.args.client_host), self.args.client_port)
        self.osc_sock.readyRead.connect(self.got_message)
        self.osc_sock.error.connect(self.handle_osc_error)
        self.subscribe()

        self.plot_widget = PlotWidget()
        self.setCentralWidget(self.plot_widget)
        self.resize(args.client_width, args.client_height)
        colors = ["r", "g", "b"]
        self.active_actors = list()
        self.actors = dict()
        self.max_value = 255
        actor_names = ["merle", "uwe", "bjoern"]
        self.max_actors = len(actor_names)
        self.actor_height = self.max_value / self.max_actors
        self.fps = 12.5
        self.num_data = 100
        self.plot_widget.showGrid(False, False)
        self.plot_widget.setYRange(0, 255)
        self.plot_widget.setXRange(0, self.num_data)
        self.plot_widget.resize(args.client_width, args.client_height)

        bottom_axis = self.plot_widget.getAxis("bottom")
        left_axis = self.plot_widget.getAxis("left")
        bottom_axis.setTicks([])
        left_axis.setTicks([])
        bottom_axis.hide()
        left_axis.hide()

        for ix, (actor_name, color) in enumerate(zip(actor_names, colors)):
            self.add_actor(actor_name, self.num_data, color, ix, self.max_actors, self.actor_height)

        self.set_positions()
        self.ekg_regex = re.compile("^/(.*?)/ekg$")
        self.heartbeat_regex = re.compile("^/(.*?)/heartbeat$")

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.render_image)
        self.timer.start(50)


    def subscribe(self):
        logger.info("subscribe")
        msg = OSCMessage("/subscribe")
        msg.appendTypedArg(self.args.client_host, "s")
        msg.appendTypedArg(self.args.client_port, "i")
        msg.appendTypedArg(self.args.authenticate, "s")
        if self.args.subscriber_label is not None:
            msg.appendTypedArg(self.args.subscriber_label, "s")
        self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host),
                                    self.args.chaosc_port)

    def unsubscribe(self):
        logger.info("unsubscribe")
        msg = OSCMessage("/unsubscribe")
        msg.appendTypedArg(self.args.client_host, "s")
        msg.appendTypedArg(self.args.client_port, "i")
        msg.appendTypedArg(self.args.authenticate, "s")
        self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host),
                                    self.args.chaosc_port)

    def handle_osc_error(self, error):
        logger.info("osc socket error %d", error)

    def closeEvent(self, event):
        logger.info("closeEvent %r", event)
        self.unsubscribe()
        event.accept()

    def pubdir(self):
        return os.path.dirname(os.path.abspath(__file__))

    def add_actor(self, actor_name, num_data, color, ix, max_actors, actor_height):
        actor_obj = Actor(actor_name, num_data, color, ix, max_actors, actor_height)
        self.actors[actor_name] = actor_obj
        self.plot_widget.addItem(actor_obj.plotItem)
        self.plot_widget.addItem(actor_obj.plotPoint)
        self.active_actors.append(actor_obj)

    def set_positions(self):
        for ix, actor_obj in enumerate(self.active_actors):
            actor_obj.plotItem.setPos(0, ix * 2)
            actor_obj.plotPoint.setPos(0, ix * 2)

    def active_actor_count(self):
        return self.max_actors

    def update(self, osc_address, args):
        res = self.ekg_regex.match(osc_address)
        if res:
            self.mcount += 1
            actor_name = res.group(1)
            actor_obj = self.actors[actor_name]
            actor_obj.add_value(args[0])
            logger.info("actor: %r, %r", actor_name, args)

    def render_image(self):
        for actor_obj in self.active_actors:
            actor_obj.add_value(actor_obj.osci.next())
            actor_obj.render()

    @QtCore.pyqtSlot()
    def render_image(self):
        for actor_obj in self.active_actors:
            actor_obj.render()
        print self.mcount

    def got_message(self):
        while self.osc_sock.hasPendingDatagrams():
            data, address, port = self.osc_sock.readDatagram(self.osc_sock.pendingDatagramSize())
            try:
                osc_address, typetags, args = decode_osc(data, 0, len(data))
                self.update(osc_address, args)
            except ValueError, error:
                logger.exception(error)
Beispiel #14
0
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(726, 588)
        self.gridLayout_3 = QtGui.QGridLayout(Form)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))

        self.splitter = QtGui.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName(_fromUtf8("splitter"))

        self.layoutWidget = QtGui.QWidget(self.splitter)
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))

        self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))

        #image view
        self.graphicsView = GraphicsView(self.layoutWidget)
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.gridLayout.addWidget(self.graphicsView, 0, 1, 3, 4)

        #intensity histogram
        self.histogram = HistogramLUTWidget(self.layoutWidget)
        self.histogram.setObjectName(_fromUtf8("histogram"))
        #self.histogram.setMinimumSize(QtCore.QSize(10, 40))
        self.histogram.setMaximumSize(QtCore.QSize(100, 1000))
        self.gridLayout.addWidget(self.histogram, 0, 5, 1, 1)

        #save roi
        self.saveROIBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.saveROIBtn.sizePolicy().hasHeightForWidth())
        self.saveROIBtn.setSizePolicy(sizePolicy)
        self.saveROIBtn.setCheckable(True)
        self.saveROIBtn.setObjectName(_fromUtf8("saveROIBtn"))
        self.gridLayout.addWidget(self.saveROIBtn, 1, 5, 1, 1)

        #load new image dalogue
        self.loadBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.loadBtn.sizePolicy().hasHeightForWidth())
        self.loadBtn.setSizePolicy(sizePolicy)
        self.loadBtn.setCheckable(True)
        self.loadBtn.setObjectName(_fromUtf8("loadBtn"))
        self.gridLayout.addWidget(self.loadBtn, 4, 5, 1, 1)

        self.menuBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.menuBtn.sizePolicy().hasHeightForWidth())
        self.menuBtn.setSizePolicy(sizePolicy)
        self.menuBtn.setObjectName(_fromUtf8("menuBtn"))
        self.gridLayout.addWidget(self.menuBtn, 2, 5, 1, 1)

        #add a radio button to turn off/on navigation with the mouse
        self.navRadio = QtGui.QRadioButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.menuBtn.sizePolicy().hasHeightForWidth())
        self.navRadio.setSizePolicy(sizePolicy)
        self.navRadio.setObjectName(_fromUtf8("navRadio"))
        self.gridLayout.addWidget(self.navRadio, 3, 1, 1, 1)

        #add radio button to select different rois
        #self.roiBox = QtGui.QButtonGroup()
        self.radioSinglePoint = QtGui.QRadioButton(self.layoutWidget)
        #self.roiBox.addButton(self.radioSinglePoint)
        #sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        #sizePolicy.setHorizontalStretch(0)
        #sizePolicy.setVerticalStretch(1)
        #sizePolicy.setHeightForWidth(self.menuBtn.sizePolicy().hasHeightForWidth())
        #self.roiBox.setSizePolicy(sizePolicy)
        self.radioSinglePoint.setObjectName(_fromUtf8("radioSinglePoint"))
        self.gridLayout.addWidget(self.radioSinglePoint, 3, 2, 1, 1)

        #add roi button to select areas
        self.radioAreaROI = QtGui.QRadioButton(self.layoutWidget)
        self.radioAreaROI.setObjectName(_fromUtf8("radioAreaROI"))
        self.gridLayout.addWidget(self.radioAreaROI, 3, 3, 1, 1)

        #add radio button to select plygon
        self.radioPolygon = QtGui.QRadioButton(self.layoutWidget)
        self.radioPolygon.setObjectName(_fromUtf8("radioPolygon"))
        self.gridLayout.addWidget(self.radioPolygon, 3, 4, 1, 1)

        #add radio button to edit rois
        self.radioEdit = QtGui.QRadioButton(self.layoutWidget)
        self.radioEdit.setObjectName(_fromUtf8("radioEdit"))
        self.gridLayout.addWidget(self.radioEdit, 3, 5, 1, 1)

        #add a textbox indicating where in z location
        self.ztext = QtGui.QLineEdit(self.layoutWidget)
        self.ztext.setObjectName(_fromUtf8("ztext"))
        self.ztext.setMinimumSize(QtCore.QSize(10, 40))
        self.ztext.setMaximumSize(QtCore.QSize(100, 100))
        self.gridLayout.addWidget(self.ztext, 3, 0, 1, 1)
        '''
        #box forms but cannot get in the correct
        self.radioGroup = QtGui.QGroupBox(Form)
        #self.radioGroup = QtGui.QGroupBox(self.layoutWidget)
        self.radioGroup.setObjectName(_fromUtf8("radioGroup"))
        self.gridLayoutR = QtGui.QGridLayout(self.radioGroup)
        #self.gridLayoutR = QtGui.QGridLayout(self.layoutWidget)
        self.gridLayoutR.setMargin(0)
        self.gridLayoutR.setSpacing(0)
        self.gridLayoutR.setObjectName(_fromUtf8("gridLayoutR"))
        self.navRadio = QtGui.QRadioButton(self.radioGroup)
        self.navRadio.setObjectName(_fromUtf8("navRadio"))
        self.gridLayoutR.addWidget(self.navRadio, 0, 0, 1, 1)
        self.singleRadio = QtGui.QRadioButton(self.radioGroup)
        self.singleRadio.setChecked(False)
        self.singleRadio.setObjectName(_fromUtf8("singleRadio"))
        self.gridLayoutR.addWidget(self.singleRadio, 0, 1, 1, 1)
        self.labelR = QtGui.QLabel(self.radioGroup)
        #self.gridLayout.addWidget(self.labelR, 4, 5, 1, 1)
        
        #this works better but radio buttons are on top of each other
        self.radioGroup = QtGui.QGroupBox(self.layoutWidget)
        self.navRadio = QtGui.QRadioButton(self.radioGroup, 0, 0)
        self.navRadio.setChecked(True)
        self.navRadio.setObjectName(_fromUtf8("navRadio"))
        self.singleRadio = QtGui.QRadioButton(self.radioGroup, 0,1)
        self.singleRadio.setChecked(False)
        self.gridLayout.addWidget(self.radioGroup, 4, 5, 1, 1)
        '''

        #self.layoutWidget
        #self.roiPlot = PlotWidget(self.splitter)
        self.timePlot = PlotWidget(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.timePlot.sizePolicy().hasHeightForWidth())
        self.timePlot.setSizePolicy(sizePolicy)
        self.timePlot.setMinimumSize(QtCore.QSize(0, 40))
        self.timePlot.setMaximumSize(QtCore.QSize(1000, 50))
        self.timePlot.setObjectName(_fromUtf8("roiPlot"))
        self.gridLayout.addWidget(self.timePlot, 4, 0, 1, 4)

        #self.zPlot = PlotWidget(self.splitter)
        self.zPlot = PlotWidget(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.timePlot.sizePolicy().hasHeightForWidth())
        self.zPlot.setSizePolicy(sizePolicy)
        #self.zPlot.setMinimumSize(QtCore.QSize(10, 40))
        #self.zPlot.setMaximumSize(QtCore.QSize(50,1000))
        self.zPlot.setObjectName(_fromUtf8("zPlot"))
        self.gridLayout.addWidget(self.zPlot, 0, 0, 3, 1)

        #Radio buttons to normalize data
        self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1)
        self.normGroup = QtGui.QGroupBox(Form)
        self.normGroup.setObjectName(_fromUtf8("normGroup"))
        self.gridLayout_2 = QtGui.QGridLayout(self.normGroup)
        self.gridLayout_2.setMargin(0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.normSubtractRadio = QtGui.QRadioButton(self.normGroup)
        self.normSubtractRadio.setObjectName(_fromUtf8("normSubtractRadio"))
        self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1)
        self.normDivideRadio = QtGui.QRadioButton(self.normGroup)
        self.normDivideRadio.setChecked(False)
        self.normDivideRadio.setObjectName(_fromUtf8("normDivideRadio"))
        self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1)
        self.label_5 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_5.setFont(font)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1)
        self.label_3 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1)
        self.label_4 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1)
        self.normROICheck = QtGui.QCheckBox(self.normGroup)
        self.normROICheck.setObjectName(_fromUtf8("normROICheck"))
        self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1)
        self.normXBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normXBlurSpin.setObjectName(_fromUtf8("normXBlurSpin"))
        self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1)
        self.label_8 = QtGui.QLabel(self.normGroup)
        self.label_8.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.gridLayout_2.addWidget(self.label_8, 2, 1, 1, 1)
        self.label_9 = QtGui.QLabel(self.normGroup)
        self.label_9.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.gridLayout_2.addWidget(self.label_9, 2, 3, 1, 1)
        self.normYBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normYBlurSpin.setObjectName(_fromUtf8("normYBlurSpin"))
        self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1)
        self.label_10 = QtGui.QLabel(self.normGroup)
        self.label_10.setAlignment(QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignTrailing
                                   | QtCore.Qt.AlignVCenter)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.gridLayout_2.addWidget(self.label_10, 2, 5, 1, 1)
        self.normOffRadio = QtGui.QRadioButton(self.normGroup)
        self.normOffRadio.setChecked(True)
        self.normOffRadio.setObjectName(_fromUtf8("normOffRadio"))
        self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1)
        self.normTimeRangeCheck = QtGui.QCheckBox(self.normGroup)
        self.normTimeRangeCheck.setObjectName(_fromUtf8("normTimeRangeCheck"))
        self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1)
        self.normFrameCheck = QtGui.QCheckBox(self.normGroup)
        self.normFrameCheck.setObjectName(_fromUtf8("normFrameCheck"))
        self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1)
        self.normTBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normTBlurSpin.setObjectName(_fromUtf8("normTBlurSpin"))
        self.gridLayout_2.addWidget(self.normTBlurSpin, 2, 6, 1, 1)
        self.gridLayout_3.addWidget(self.normGroup, 1, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
Beispiel #15
0
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(726, 588)
        self.gridLayout_3 = QtGui.QGridLayout(Form)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.splitter = QtGui.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName(_fromUtf8("splitter"))
        self.layoutWidget = QtGui.QWidget(self.splitter)
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
        self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.graphicsView = GraphicsView(self.layoutWidget)
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.gridLayout.addWidget(self.graphicsView, 0, 0, 2, 1)
        self.histogram = HistogramLUTWidget(self.layoutWidget)
        self.histogram.setObjectName(_fromUtf8("histogram"))
        self.gridLayout.addWidget(self.histogram, 0, 1, 1, 2)
        self.roiBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.roiBtn.sizePolicy().hasHeightForWidth())
        self.roiBtn.setSizePolicy(sizePolicy)
        self.roiBtn.setCheckable(True)
        self.roiBtn.setObjectName(_fromUtf8("roiBtn"))
        self.gridLayout.addWidget(self.roiBtn, 1, 1, 1, 1)
        self.normBtn = QtGui.QPushButton(self.layoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.normBtn.sizePolicy().hasHeightForWidth())
        self.normBtn.setSizePolicy(sizePolicy)
        self.normBtn.setCheckable(True)
        self.normBtn.setObjectName(_fromUtf8("normBtn"))
        self.gridLayout.addWidget(self.normBtn, 1, 2, 1, 1)
        self.roiPlot = PlotWidget(self.splitter)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.roiPlot.sizePolicy().hasHeightForWidth())
        self.roiPlot.setSizePolicy(sizePolicy)
        self.roiPlot.setMinimumSize(QtCore.QSize(0, 40))
        self.roiPlot.setObjectName(_fromUtf8("roiPlot"))
        self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1)
        self.normGroup = QtGui.QGroupBox(Form)
        self.normGroup.setObjectName(_fromUtf8("normGroup"))
        self.gridLayout_2 = QtGui.QGridLayout(self.normGroup)
        self.gridLayout_2.setMargin(0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.normSubtractRadio = QtGui.QRadioButton(self.normGroup)
        self.normSubtractRadio.setObjectName(_fromUtf8("normSubtractRadio"))
        self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1)
        self.normDivideRadio = QtGui.QRadioButton(self.normGroup)
        self.normDivideRadio.setChecked(False)
        self.normDivideRadio.setObjectName(_fromUtf8("normDivideRadio"))
        self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1)
        self.label_5 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_5.setFont(font)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1)
        self.label_3 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1)
        self.label_4 = QtGui.QLabel(self.normGroup)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1)
        self.normROICheck = QtGui.QCheckBox(self.normGroup)
        self.normROICheck.setObjectName(_fromUtf8("normROICheck"))
        self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1)
        self.normXBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normXBlurSpin.setObjectName(_fromUtf8("normXBlurSpin"))
        self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1)
        self.label_8 = QtGui.QLabel(self.normGroup)
        self.label_8.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.gridLayout_2.addWidget(self.label_8, 2, 1, 1, 1)
        self.label_9 = QtGui.QLabel(self.normGroup)
        self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.gridLayout_2.addWidget(self.label_9, 2, 3, 1, 1)
        self.normYBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normYBlurSpin.setObjectName(_fromUtf8("normYBlurSpin"))
        self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1)
        self.label_10 = QtGui.QLabel(self.normGroup)
        self.label_10.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.gridLayout_2.addWidget(self.label_10, 2, 5, 1, 1)
        self.normOffRadio = QtGui.QRadioButton(self.normGroup)
        self.normOffRadio.setChecked(True)
        self.normOffRadio.setObjectName(_fromUtf8("normOffRadio"))
        self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1)
        self.normTimeRangeCheck = QtGui.QCheckBox(self.normGroup)
        self.normTimeRangeCheck.setObjectName(_fromUtf8("normTimeRangeCheck"))
        self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1)
        self.normFrameCheck = QtGui.QCheckBox(self.normGroup)
        self.normFrameCheck.setObjectName(_fromUtf8("normFrameCheck"))
        self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1)
        self.normTBlurSpin = QtGui.QDoubleSpinBox(self.normGroup)
        self.normTBlurSpin.setObjectName(_fromUtf8("normTBlurSpin"))
        self.gridLayout_2.addWidget(self.normTBlurSpin, 2, 6, 1, 1)
        self.gridLayout_3.addWidget(self.normGroup, 1, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
Beispiel #16
0
    def do_GET(self):

        self.thread = thread = OSCThread()
        thread.daemon = True
        thread.start()

        actors = list()
        is_item1 = True
        is_item2 = True
        is_item3 = True

        def setPositions():
            for ix, item in enumerate(actors):
                item.setPos(0, ix * 6)

        def scale_data(data, ix, max_items):
            scale = 254 / max_items * ix
            return [value / max_items + scale for value in data]

        try:

            self.path = re.sub('[^.a-zA-Z0-9]', "", str(self.path))
            if self.path == "" or self.path == None or self.path[:1] == ".":
                return

            if self.path.endswith(".html"):
                f = open(curdir + sep + self.path)
                self.send_response(200)
                self.send_header('Content-type', 'text/html')
                self.end_headers()
                self.wfile.write(f.read())
                f.close()
            elif self.path.endswith(".mjpeg"):
                data_points = 1000

                self.send_response(200)
                plot_data1 = data = deque([0] * data_points)
                plot_data2 = data = deque([0] * data_points)
                plot_data3 = data = deque([0] * data_points)
                plt = PlotWidget(title="<h1>EKG</h1>", name="Merle")
                plt.hide()
                plotItem1 = pg.PlotCurveItem(pen=pg.mkPen('r', width=2),
                                             name="bjoern")
                plotItem2 = pg.PlotCurveItem(pen=pg.mkPen('g', width=2),
                                             name="merle")
                plotItem3 = pg.PlotCurveItem(pen=pg.mkPen('b', width=2),
                                             name="uwe")
                print type(plotItem1)
                pen = pg.mkPen(254, 254, 254)
                plotItem1.setShadowPen(pen=pen, width=6, cosmetic=True)
                plotItem2.setShadowPen(pen=pen, width=6, cosmetic=True)
                plotItem3.setShadowPen(pen=pen, width=6, cosmetic=True)
                actors.append(plotItem1)
                actors.append(plotItem2)
                actors.append(plotItem3)
                plotItem1.setPos(0, 0 * 6)
                plotItem2.setPos(0, 1 * 6)
                plotItem3.setPos(0, 2 * 6)
                plt.addItem(plotItem1)
                plt.addItem(plotItem2)
                plt.addItem(plotItem3)

                plt.setLabel('left', "<h2>Amplitude</h2>")
                plt.setLabel('bottom', "<h2>Time</h2>")
                plt.showGrid(True, True)
                ba = plt.getAxis("bottom")
                bl = plt.getAxis("left")
                ba.setTicks([])
                bl.setTicks([])
                plt.setYRange(0, 254)

                self.wfile.write(
                    "Content-Type: multipart/x-mixed-replace; boundary=--aaboundary"
                )
                self.wfile.write("\r\n\r\n")

                plt.resize(1280, 720)

                while 1:
                    while 1:
                        try:
                            osc_address, args = queue.get_nowait()
                        except Queue.Empty:
                            break

                        value = args[0]
                        if osc_address == "/bjoern/ekg":
                            plot_data1.append(value)
                            plot_data1.popleft()
                            try:
                                plotItem1.setData(y=np.array(
                                    scale_data(plot_data1,
                                               actors.index(plotItem1),
                                               len(actors))),
                                                  clear=True)
                            except ValueError:
                                pass
                        elif osc_address == "/merle/ekg":
                            plot_data2.append(value)
                            plot_data2.popleft()
                            try:
                                plotItem2.setData(y=np.array(
                                    scale_data(plot_data2,
                                               actors.index(plotItem2),
                                               len(actors))),
                                                  clear=True)
                            except ValueError:
                                pass
                        elif osc_address == "/uwe/ekg":
                            plot_data3.append(value)
                            plot_data3.popleft()
                            try:
                                plotItem3.setData(y=np.array(
                                    scale_data(plot_data3,
                                               actors.index(plotItem3),
                                               len(actors))),
                                                  clear=True)
                            except ValueError:
                                pass
                        elif osc_address == "/plot/uwe":
                            if value == 1 and is_item3 == False:
                                print "uwe on"
                                plt.addItem(plotItem3)
                                is_item3 = True
                                actors.append(plotItem3)
                                setPositions()
                            elif value == 0 and is_item3 == True:
                                print "uwe off"
                                plt.removeItem(plotItem3)
                                is_item3 = False
                                actors.remove(plotItem3)
                                setPositions()
                        elif osc_address == "/plot/merle":
                            if value == 1 and is_item2 == False:
                                print "merle on"
                                plt.addItem(plotItem2)
                                is_item2 = True
                                actors.append(plotItem2)
                                setPositions()
                            elif value == 0 and is_item2 == True:
                                print "merle off"
                                plt.removeItem(plotItem2)
                                is_item2 = False
                                actors.remove(plotItem2)
                                setPositions()
                        elif osc_address == "/plot/bjoern":
                            if value == 1 and is_item1 == False:
                                print "bjoern on"
                                plt.addItem(plotItem1)
                                is_item1 = True
                                actors.append(plotItem1)
                                setPositions()
                            elif value == 0 and is_item1 == True:
                                print "bjoern off"
                                plt.removeItem(plotItem1)
                                is_item1 = False
                                actors.remove(plotItem1)
                                setPositions()

                    exporter = pg.exporters.ImageExporter.ImageExporter(
                        plt.plotItem)
                    img = exporter.export("tmpfile", True)
                    buffer = QBuffer()
                    buffer.open(QIODevice.WriteOnly)
                    img.save(buffer, "JPG", 100)
                    JpegData = buffer.data()
                    del buffer
                    self.wfile.write(
                        "--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n"
                        % (len(JpegData), JpegData))

            elif self.path.endswith(".jpeg"):
                f = open(curdir + sep + self.path)
                self.send_response(200)
                self.send_header('Content-type', 'image/jpeg')
                self.end_headers()
                self.wfile.write(f.read())
                f.close()
            return
        except (KeyboardInterrupt, SystemError):
            thread.running = False
            thread.join()
        except IOError:
            self.send_error(404, 'File Not Found: %s' % self.path)
Beispiel #17
0
class ScatterPlotWidget(pg.QtGui.QSplitter):
    """
    This is a high-level widget for exploring relationships in tabular data.
        
    Given a multi-column record array, the widget displays a scatter plot of a
    specific subset of the data. Includes controls for selecting the columns to
    plot, filtering data, and determining symbol color and shape.
    
    The widget consists of four components:
    
    1) A list of column names from which the user may select 1 or 2 columns
       to plot. If one column is selected, the data for that column will be
       plotted in a histogram-like manner by using :func:`pseudoScatter()
       <pyqtgraph.pseudoScatter>`. If two columns are selected, then the
       scatter plot will be generated with x determined by the first column
       that was selected and y by the second.
    2) A DataFilter that allows the user to select a subset of the data by 
       specifying multiple selection criteria.
    3) A ColorMap that allows the user to determine how points are colored by
       specifying multiple criteria.
    4) A PlotWidget for displaying the data.
    """
    sigScatterPlotClicked = pg.QtCore.Signal(object, object, object)
    
    def __init__(self, parent=None):
        pg.QtGui.QSplitter.__init__(self, pg.QtCore.Qt.Horizontal)
        self.ctrlPanel = pg.QtGui.QSplitter(pg.QtCore.Qt.Vertical)
        self.addWidget(self.ctrlPanel)
        self.fieldList = pg.QtGui.QListWidget()
        self.fieldList.setSelectionMode(self.fieldList.ExtendedSelection)
        self.ptree = pg.parametertree.ParameterTree(showHeader=False)
        self.filter = DataFilterParameter()
        self.colorMap = ColorMapParameter()
        self.style = StyleMapParameter()
        self.params = pg.parametertree.Parameter.create(name='params', type='group', children=[self.filter, self.colorMap, self.style])
        self.ptree.setParameters(self.params, showTop=False)
        
        self.plot = PlotWidget()
        self.ctrlPanel.addWidget(self.fieldList)
        self.ctrlPanel.addWidget(self.ptree)
        self.addWidget(self.plot)
        
        fg = pg.mkColor(pg.getConfigOption('foreground'))
        fg.setAlpha(150)
        self.filterText = pg.TextItem(border=pg.getConfigOption('foreground'), color=fg)
        self.filterText.setPos(60,20)
        self.filterText.setParentItem(self.plot.plotItem)
        
        self.data = None
        self.indices = None
        self.mouseOverField = None
        self.scatterPlot = None
        self.selectionScatter = None
        self.selectedIndices = []
        self._visibleXY = None  # currently plotted points
        self._visibleData = None  # currently plotted records
        self._visibleIndices = None
        self._indexMap = None
        
        self.fieldList.itemSelectionChanged.connect(self.fieldSelectionChanged)
        self.filter.sigFilterChanged.connect(self.filterChanged)
        self.colorMap.sigColorMapChanged.connect(self.updatePlot)
        self.style.sigStyleChanged.connect(self.updatePlot)
    
    def setFields(self, fields, mouseOverField=None):
        """
        Set the list of field names/units to be processed.
        
        The format of *fields* is the same as used by 
        :func:`ColorMapWidget.setFields <pyqtgraph.widgets.ColorMapWidget.ColorMapParameter.setFields>`
        """
        self.fields = OrderedDict(fields)
        self.mouseOverField = mouseOverField
        self.fieldList.clear()
        for f,opts in fields:
            item = pg.QtGui.QListWidgetItem(f)
            item.opts = opts
            item = self.fieldList.addItem(item)
        self.filter.setFields(fields)
        self.colorMap.setFields(fields)
        self.style.setFields(fields)

    def setSelectedFields(self, *fields):
        self.fieldList.itemSelectionChanged.disconnect(self.fieldSelectionChanged)
        try:
            self.fieldList.clearSelection()
            for f in fields:
                i = list(self.fields.keys()).index(f)
                item = self.fieldList.item(i)
                item.setSelected(True)
        finally:
            self.fieldList.itemSelectionChanged.connect(self.fieldSelectionChanged)
        self.fieldSelectionChanged()

    def setData(self, data):
        """
        Set the data to be processed and displayed. 
        Argument must be a numpy record array.
        """
        self.data = data
        self.indices = np.arange(len(data))
        self.filtered = None
        self.filteredIndices = None
        self.updatePlot()
        
    def setSelectedIndices(self, inds):
        """Mark the specified indices as selected.

        Must be a sequence of integers that index into the array given in setData().
        """
        self.selectedIndices = inds
        self.updateSelected()

    def setSelectedPoints(self, points):
        """Mark the specified points as selected.

        Must be a list of points as generated by the sigScatterPlotClicked signal.
        """
        self.setSelectedIndices([pt.originalIndex for pt in points])

    def fieldSelectionChanged(self):
        sel = self.fieldList.selectedItems()
        if len(sel) > 2:
            self.fieldList.blockSignals(True)
            try:
                for item in sel[1:-1]:
                    item.setSelected(False)
            finally:
                self.fieldList.blockSignals(False)
                
        self.updatePlot()
        
    def filterChanged(self, f):
        self.filtered = None
        self.updatePlot()
        desc = self.filter.describe()
        if len(desc) == 0:
            self.filterText.setVisible(False)
        else:
            self.filterText.setText('\n'.join(desc))
            self.filterText.setVisible(True)
        
    def updatePlot(self):
        self.plot.clear()
        if self.data is None or len(self.data) == 0:
            return
        
        if self.filtered is None:
            mask = self.filter.generateMask(self.data)
            self.filtered = self.data[mask]
            self.filteredIndices = self.indices[mask]
        data = self.filtered
        if len(data) == 0:
            return
        
        colors = np.array([pg.mkBrush(*x) for x in self.colorMap.map(data)])
        
        style = self.style.map(data)
        
        ## Look up selected columns and units
        sel = list([str(item.text()) for item in self.fieldList.selectedItems()])
        units = list([item.opts.get('units', '') for item in self.fieldList.selectedItems()])
        if len(sel) == 0:
            self.plot.setTitle('')
            return
        

        if len(sel) == 1:
            self.plot.setLabels(left=('N', ''), bottom=(sel[0], units[0]), title='')
            if len(data) == 0:
                return
            #x = data[sel[0]]
            #y = None
            xy = [data[sel[0]], None]
        elif len(sel) == 2:
            self.plot.setLabels(left=(sel[1],units[1]), bottom=(sel[0],units[0]))
            if len(data) == 0:
                return
            
            xy = [data[sel[0]], data[sel[1]]]
            #xydata = []
            #for ax in [0,1]:
                #d = data[sel[ax]]
                ### scatter catecorical values just a bit so they show up better in the scatter plot.
                ##if sel[ax] in ['MorphologyBSMean', 'MorphologyTDMean', 'FIType']:
                    ##d += np.random.normal(size=len(cells), scale=0.1)
                    
                #xydata.append(d)
            #x,y = xydata

        ## convert enum-type fields to float, set axis labels
        enum = [False, False]
        for i in [0,1]:
            axis = self.plot.getAxis(['bottom', 'left'][i])
            if xy[i] is not None and (self.fields[sel[i]].get('mode', None) == 'enum' or xy[i].dtype.kind in ('S', 'O')):
                vals = self.fields[sel[i]].get('values', list(set(xy[i])))
                xy[i] = np.array([vals.index(x) if x in vals else len(vals) for x in xy[i]], dtype=float)
                axis.setTicks([list(enumerate(vals))])
                enum[i] = True
            else:
                axis.setTicks(None)  # reset to automatic ticking
        
        ## mask out any nan values
        mask = np.ones(len(xy[0]), dtype=bool)
        if xy[0].dtype.kind == 'f':
            mask &= np.isfinite(xy[0])
        if xy[1] is not None and xy[1].dtype.kind == 'f':
            mask &= np.isfinite(xy[1])
        
        xy[0] = xy[0][mask]

        for k in style.keys():
            if style[k] is None:
                continue
            style[k] = style[k][mask]
        style['symbolBrush'] = colors[mask]
        data = data[mask]
        indices = self.filteredIndices[mask]

        ## Scatter y-values for a histogram-like appearance
        if xy[1] is None:
            ## column scatter plot
            xy[1] = pg.pseudoScatter(xy[0])
        else:
            xy[1] = xy[1][mask]
        ## beeswarm plots
        
        for ax in [0,1]:
            if not enum[ax]:
                continue
            imax = int(xy[ax].max()) if len(xy[ax]) > 0 else 0
            for i in range(imax+1):
                keymask = xy[ax] == i
                scatter = pg.pseudoScatter(xy[1-ax][keymask], bidir=True)
                if len(scatter) == 0:
                    continue
                smax = np.abs(scatter).max()
                if smax != 0:
                    scatter *= 0.2 / smax
                xy[ax][keymask] += scatter


        if self.scatterPlot is not None:
            try:
                self.scatterPlot.sigPointsClicked.disconnect(self.plotClicked)
            except:
                pass
        
        self._visibleXY = xy
        self._visibleData = data
        self._visibleIndices = indices
        self._indexMap = None
        self.scatterPlot = self.plot.plot(xy[0], xy[1], data=data, **style)
        self.scatterPlot.sigPointsClicked.connect(self.plotClicked)
        self.updateSelected()

    def updateSelected(self):
        if self._visibleXY is None:
            return
        # map from global index to visible index
        indMap = self._getIndexMap()
        inds = [indMap[i] for i in self.selectedIndices if i in indMap]
        x,y = self._visibleXY[0][inds], self._visibleXY[1][inds]

        if self.selectionScatter is not None:
            self.plot.plotItem.removeItem(self.selectionScatter)
        if len(x) == 0:
            return
        self.selectionScatter = self.plot.plot(x, y, pen=None, symbol='s', symbolSize=12, symbolBrush=None, symbolPen='y')

    def _getIndexMap(self):
        # mapping from original data index to visible point index
        if self._indexMap is None:
            self._indexMap = {j:i for i,j in enumerate(self._visibleIndices)}
        return self._indexMap

    def plotClicked(self, plot, points, ev):
        # Tag each point with its index into the original dataset
        for pt in points:
            pt.originalIndex = self._visibleIndices[pt.index()]
        self.sigScatterPlotClicked.emit(self, points, ev)