summaryrefslogtreecommitdiff
path: root/silx/gui/plot/test/testScatterView.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2018-12-17 12:28:45 +0100
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2018-12-17 12:28:45 +0100
commitc49572a2e90b398e90a43f86b490f27ee6c58de6 (patch)
treed130cf7dfc3cf73157e1bece8173331bb4bc7156 /silx/gui/plot/test/testScatterView.py
parent0bbc8ab933e62c1fa6d548e879ae6d98cbd461f1 (diff)
parentcebdc9244c019224846cb8d2668080fe386a6adc (diff)
Merge tag 'upstream/0.9.0+dfsg'
Upstream version 0.9.0+dfsg
Diffstat (limited to 'silx/gui/plot/test/testScatterView.py')
-rw-r--r--silx/gui/plot/test/testScatterView.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/silx/gui/plot/test/testScatterView.py b/silx/gui/plot/test/testScatterView.py
index 40fdac6..583e3ed 100644
--- a/silx/gui/plot/test/testScatterView.py
+++ b/silx/gui/plot/test/testScatterView.py
@@ -103,6 +103,25 @@ class TestScatterView(PlotWidgetTestCase):
self.assertIsNone(data[3]) # xerror
self.assertIsNone(data[4]) # yerror
+ def testAlpha(self):
+ """Test alpha transparency in setData"""
+ _pts = 100
+ _levels = 100
+ _fwhm = 50
+ x = numpy.random.rand(_pts)*_levels
+ y = numpy.random.rand(_pts)*_levels
+ value = numpy.random.rand(_pts)*_levels
+ x0 = x[int(_pts/2)]
+ y0 = x[int(_pts/2)]
+ #2D Gaussian kernel
+ alpha = numpy.exp(-4*numpy.log(2) * ((x-x0)**2 + (y-y0)**2) / _fwhm**2)
+
+ self.plot.setData(x, y, value, alpha=alpha)
+ self.qapp.processEvents()
+
+ alphaData = self.plot.getScatterItem().getAlphaData()
+ self.assertTrue(numpy.all(numpy.equal(alpha, alphaData)))
+
def suite():
test_suite = unittest.TestSuite()