Esempio n. 1
0
    def testErrors(self):
        # test if onlimits is True and give also a roi
        with self.assertRaises(ValueError):
            stats._CurveContext(item=self.plot1d.getCurve('curve0'),
                                plot=self.plot1d,
                                onlimits=True,
                                roi=self._1Droi)

        # test if is a curve context and give an invalid 2D roi
        with self.assertRaises(TypeError):
            stats._CurveContext(item=self.plot1d.getCurve('curve0'),
                                plot=self.plot1d,
                                onlimits=False,
                                roi=self._2Droi_rect)
Esempio n. 2
0
 def createCurveContext(self):
     TestStatsBase.createCurveContext(self)
     self.curveContext = stats._CurveContext(
         item=self.plot1d.getCurve('curve0'),
         plot=self.plot1d,
         onlimits=False,
         roi=self._1Droi)
Esempio n. 3
0
    def testOnLimits(self):
        stat = stats.StatMin()

        self.plot1d.getXAxis().setLimitsConstraints(minPos=2, maxPos=5)
        curveContextOnLimits = stats._CurveContext(
            item=self.plot1d.getCurve('curve0'),
            plot=self.plot1d,
            onlimits=True,
            roi=None)
        self.assertEqual(stat.calculate(curveContextOnLimits), 2)

        self.plot2d.getXAxis().setLimitsConstraints(minPos=32)
        imageContextOnLimits = stats._ImageContext(
            item=self.plot2d.getImage('test image'),
            plot=self.plot2d,
            onlimits=True,
            roi=None)
        self.assertEqual(stat.calculate(imageContextOnLimits), 32)

        self.scatterPlot.getXAxis().setLimitsConstraints(minPos=40)
        scatterContextOnLimits = stats._ScatterContext(
            item=self.scatterPlot.getScatter('scatter plot'),
            plot=self.scatterPlot,
            onlimits=True,
            roi=None)
        self.assertEqual(stat.calculate(scatterContextOnLimits), 20)
Esempio n. 4
0
    def createCurveContext(self):
        self.plot1d = Plot1D()
        x = range(20)
        y = range(20)
        self.plot1d.addCurve(x, y, legend='curve0')

        self.curveContext = stats._CurveContext(
            item=self.plot1d.getCurve('curve0'),
            plot=self.plot1d,
            onlimits=False)
Esempio n. 5
0
    def createCurveContext(self):
        self.plot1d = Plot1D()
        x = range(20)
        y = range(20)
        self.plot1d.addCurve(x, y, legend='curve0')

        self.curveContext = stats._CurveContext(
            item=self.plot1d.getCurve('curve0'),
            plot=self.plot1d,
            onlimits=False)
Esempio n. 6
0
    def setUp(self):
        TestCaseQt.setUp(self)
        self.plot1d = Plot1D()
        x = range(20)
        y = range(20)
        self.plot1d.addCurve(x, y, legend='curve0')

        self.curveContext = stats._CurveContext(
            item=self.plot1d.getCurve('curve0'),
            plot=self.plot1d,
            onlimits=False)

        self.stat = stats.StatMin()
Esempio n. 7
0
    def testOnLimits(self):
        stat = stats.StatMin()

        self.plot1d.getXAxis().setLimitsConstraints(minPos=2, maxPos=5)
        curveContextOnLimits = stats._CurveContext(
            item=self.plot1d.getCurve('curve0'),
            plot=self.plot1d,
            onlimits=True)
        self.assertTrue(stat.calculate(curveContextOnLimits) == 2)

        self.plot2d.getXAxis().setLimitsConstraints(minPos=32)
        imageContextOnLimits = stats._ImageContext(
            item=self.plot2d.getImage('test image'),
            plot=self.plot2d,
            onlimits=True)
        self.assertTrue(stat.calculate(imageContextOnLimits) == 32)

        self.scatterPlot.getXAxis().setLimitsConstraints(minPos=40)
        scatterContextOnLimits = stats._ScatterContext(
            item=self.scatterPlot.getScatter('scatter plot'),
            plot=self.scatterPlot,
            onlimits=True)
        self.assertTrue(stat.calculate(scatterContextOnLimits) == 20)