當前位置: 首頁>>代碼示例>>Python>>正文


Python PlotWindow._getAllMarkers方法代碼示例

本文整理匯總了Python中silx.gui.plot.PlotWindow._getAllMarkers方法的典型用法代碼示例。如果您正苦於以下問題:Python PlotWindow._getAllMarkers方法的具體用法?Python PlotWindow._getAllMarkers怎麽用?Python PlotWindow._getAllMarkers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在silx.gui.plot.PlotWindow的用法示例。


在下文中一共展示了PlotWindow._getAllMarkers方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestCurvesROIWidget

# 需要導入模塊: from silx.gui.plot import PlotWindow [as 別名]
# 或者: from silx.gui.plot.PlotWindow import _getAllMarkers [as 別名]

#.........這裏部分代碼省略.........
        roiWidget = self.plot.getCurvesRoiDockWidget().roiWidget
        self.plot.getCurvesRoiDockWidget().setRois(roisDefs)
        self.assertTrue(len(roiWidget.getRois()) is len(roisDefs))
        self.plot.getCurvesRoiDockWidget().setVisible(True)
        self.assertTrue(len(roiWidget.getRois()) is len(roisDefs))

    def testDictCompatibility(self):
        """Test that ROI api is valid with dict and not information is lost"""
        roiDict = {'from': 20, 'to': 200, 'type': 'energy', 'comment': 'no',
                   'name': 'myROI', 'calibration': [1, 2, 3]}
        roi = CurvesROIWidget.ROI._fromDict(roiDict)
        self.assertTrue(roi.toDict() == roiDict)

    def testShowAllROI(self):
        """Test the show allROI action"""
        x = numpy.arange(100.)
        y = numpy.arange(100.)
        self.plot.addCurve(x=x, y=y, legend="name", replace="True")

        roisDefsDict = {
            "range1": {"from": 20, "to": 200,"type": "energy"},
            "range2": {"from": 300, "to": 500, "type": "energy"}
        }

        roisDefsObj = (
            CurvesROIWidget.ROI(name='range3', fromdata=20, todata=200,
                                type_='energy'),
            CurvesROIWidget.ROI(name='range4', fromdata=300, todata=500,
                                type_='energy')
        )
        self.widget.roiWidget.showAllMarkers(True)
        roiWidget = self.plot.getCurvesRoiDockWidget().roiWidget
        roiWidget.setRois(roisDefsDict)
        self.assertTrue(len(self.plot._getAllMarkers()) is 2*3)

        markersHandler = self.widget.roiWidget.roiTable._markersHandler
        roiWidget.showAllMarkers(True)
        ICRROI = markersHandler.getVisibleRois()
        self.assertTrue(len(ICRROI) is 2)

        roiWidget.showAllMarkers(False)
        ICRROI = markersHandler.getVisibleRois()
        self.assertTrue(len(ICRROI) is 1)

        roiWidget.setRois(roisDefsObj)
        self.qapp.processEvents()
        self.assertTrue(len(self.plot._getAllMarkers()) is 2*3)

        markersHandler = self.widget.roiWidget.roiTable._markersHandler
        roiWidget.showAllMarkers(True)
        ICRROI = markersHandler.getVisibleRois()
        self.assertTrue(len(ICRROI) is 2)

        roiWidget.showAllMarkers(False)
        ICRROI = markersHandler.getVisibleRois()
        self.assertTrue(len(ICRROI) is 1)

    def testRoiEdition(self):
        """Make sure if the ROI object is edited the ROITable will be updated
        """
        roi = CurvesROIWidget.ROI(name='linear', fromdata=0, todata=5)
        self.widget.roiWidget.setRois((roi, ))

        x = (0, 1, 1, 2, 2, 3)
        y = (1, 1, 2, 2, 1, 1)
        self.plot.addCurve(x=x, y=y, legend='linearCurve')
開發者ID:dnaudet,項目名稱:silx,代碼行數:70,代碼來源:testCurvesROIWidget.py


注:本文中的silx.gui.plot.PlotWindow._getAllMarkers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。