def plotCorrelationFi(self): """ Построение графика корреляции левого и правого полушария по сегментам """ # Если выделена не однастрока (4 поля) if len(self.ui.treExportProbes.selectedIndexes()) != 4: self.statusBar().showMessage(u'Пациент не выбран') return for index in self.ui.treExportProbes.selectedItems(): # Получаем матрицы съема lMatr, rMatr = base.getMatrix(index.text(0), str(index.text(2))) # Получаем матрицу корреляции corrMtrx = MathFunc.CorrelationSegI(lMatr, rMatr) # подготавливаем холст gf.preparePlot(self.ui.qwtGraphPlot, u'Корреляция Seg(L,R)') gf.setAxis(self.ui.qwtGraphPlot) # markers (Вертикальны разделители) gf.plotVFuncMarkers(self.ui.qwtGraphPlot) # ось абцисс gf.plotAbciss(self.ui.qwtGraphPlot) # Построение графика правого полушария curve = Qwt.QwtPlotCurve(u'Корреляция Seg(L,R)') curve.attach(self.ui.qwtGraphPlot) curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) curve.setPen(Qt.QPen(Qt.Qt.black, 2)) curve.setData(range(0, 35), corrMtrx) # Выводим график self.ui.qwtGraphPlot.replot()
def plotMaxMin(self): ''' Постоение графика Max-min ''' # Если выделена не однастрока (4 поля) if len(self.ui.treExportProbes.selectedIndexes()) != 4: self.statusBar().showMessage(u'Пациент не выбран') return for index in self.ui.treExportProbes.selectedItems(): # Получаем матрицы съема lMatr, rMatr = base.getMatrix(index.text(0), str(index.text(2))) # Расчитываем MaxMin для каждого полушария lMaxMin = MathFunc.MaxMin(lMatr) rMaxMin = MathFunc.MaxMin(rMatr) # подготавливаем холст gf.preparePlot(self.ui.qwtGraphPlot, u'Max-Min') gf.setAxis(self.ui.qwtGraphPlot) # markers (Вертикальны разделители) gf.plotVFuncMarkers(self.ui.qwtGraphPlot) # Построение графика левого полушария curve = Qwt.QwtPlotCurve(u'Левое полушарие') curve.attach(self.ui.qwtGraphPlot) curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) curve.setPen(Qt.QPen(Qt.Qt.black, 2, Qt.Qt.DotLine)) curve.setData(range(0, 35), lMaxMin) # Построение графика правого полушария curve = Qwt.QwtPlotCurve(u'Правое полушарие') curve.attach(self.ui.qwtGraphPlot) curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) curve.setPen(Qt.QPen(Qt.Qt.black, 2)) curve.setData(range(0, 35), rMaxMin) # Выводим график self.ui.qwtGraphPlot.replot()
def plotSegment(self): """ Построение по сегментам """ cols = {'C1':Qt.Qt.black, 'C2-3':Qt.Qt.red, 'C4-5':Qt.Qt.blue, 'C6':Qt.Qt.black, 'C7-8':Qt.Qt.red, 'Th1':Qt.Qt.blue, 'Th2':Qt.Qt.black, 'Th3-4':Qt.Qt.red, 'Th5':Qt.Qt.blue, 'Th6':Qt.Qt.black, 'Th7':Qt.Qt.red, 'Th8-9':Qt.Qt.blue, 'Th10':Qt.Qt.black, 'Th11':Qt.Qt.red, 'Th12':Qt.Qt.blue, 'L1':Qt.Qt.black, 'L2':Qt.Qt.red, 'L3':Qt.Qt.blue, 'L4':Qt.Qt.black, 'L5':Qt.Qt.red, 'S1':Qt.Qt.blue, 'S2':Qt.Qt.black, 'S3-4':Qt.Qt.red, 'K-S5':Qt.Qt.blue} # Если выделена не однастрока (4 поля) if len(self.ui.treExportProbes.selectedIndexes()) != 4: return # подготавливаем холст gf.preparePlot(self.ui.qwtSegPlot, u'Сегмент', leg = 'check') gf.setAxis(self.ui.qwtSegPlot) # markers (Вертикальны разделители) gf.plotVFuncMarkers(self.ui.qwtSegPlot) # Расчёт значений for index in self.ui.treExportProbes.selectedItems(): # Получаем матрицы съема lMatr, rMatr = base.getMatrix(index.text(0), str(index.text(2))) # Получаем словарь сегментов для каждого полушария lSeg = MathFunc.Segment(lMatr) rSeg = MathFunc.Segment(rMatr) # Создаём словари curve curvL = {} curvR = {} # Строим графики по сементам for key in lSeg.keys(): # Левое полушарие curvL[key] = Qwt.QwtPlotCurve(key) curvL[key].attach(self.ui.qwtSegPlot) curvL[key].setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) curvL[key].setPen(Qt.QPen(cols[key], 2, Qt.Qt.DotLine)) curvL[key].setData(range(len(lSeg[key])), lSeg[key]) self.showCurve(curvL[key], False) # Правое полушарие curvR[key] = Qwt.QwtPlotCurve(key) curvR[key].attach(self.ui.qwtSegPlot) curvR[key].setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) curvR[key].setPen(Qt.QPen(cols[key], 2)) curvR[key].setData(range(len(rSeg[key])), rSeg[key]) self.showCurve(curvR[key], False) # Выводим график self.showCurve(curvL['C1'], True) self.showCurve(curvR['C1'], True) self.ui.qwtSegPlot.replot()