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)
def createCurveContext(self): TestStatsBase.createCurveContext(self) self.curveContext = stats._CurveContext( item=self.plot1d.getCurve('curve0'), plot=self.plot1d, onlimits=False, roi=self._1Droi)
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)
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)
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()
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)