Beispiel #1
0
class ScatterViewUserDefault(ScatterView):
    _defaultColormap = None
    _defaultSymbol = None
    _defaultVisualization = None

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        if self._defaultColormap is None:
            self._defaultColormap = Colormap(DEFAULT_SCATTER_COLORMAP)
        if self._defaultSymbol is None:
            self._defaultSymbol = DEFAULT_SCATTER_SYMBOL
        if self._defaultVisualization is None:
            self._defaultVisualization= DEFAULT_SCATTER_VISUALIZATION

        # Apply defaults
        self.setColormap(self._defaultColormap.copy())
        scatter = self.getScatterItem()
        scatter.setSymbol(self._defaultSymbol)
        scatter.setVisualization(self._defaultVisualization)

        # Connect to scatter item
        scatter.sigItemChanged.connect(self.__scatterItemChanged)

    def __scatterItemChanged(self, event):
        """Handle change of scatter item colormap and symbol"""
        if event is items.ItemChangedType.COLORMAP:
            ScatterViewUserDefault._defaultColormap = self.getScatterItem().getColormap().copy()
        elif event is items.ItemChangedType.SYMBOL:
            ScatterViewUserDefault._defaultSymbol = self.getScatterItem().getSymbol()
        elif event is items.ItemChangedType.VISUALIZATION_MODE:
            ScatterViewUserDefault._defaultVisualization = self.getScatterItem().getVisualization()
Beispiel #2
0
    def testCopy(self):
        """Make sure the copy function is correctly processing
        """
        colormapObject = Colormap(name='toto',
                                  colors=numpy.array([12, 13, 14]),
                                  vmin=None,
                                  vmax=None,
                                  normalization=Colormap.LOGARITHM)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setColormapLUT(numpy.array([0, 1]))
        self.assertFalse(colormapObject == colormapObject2)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setNormalization(Colormap.LINEAR)
        self.assertFalse(colormapObject == colormapObject2)
Beispiel #3
0
    def testCopy(self):
        """Make sure the copy function is correctly processing
        """
        colormapObject = Colormap(name='toto',
                                  colors=numpy.array([12, 13, 14]),
                                  vmin=None,
                                  vmax=None,
                                  normalization=Colormap.LOGARITHM)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setColormapLUT(numpy.array([0, 1]))
        self.assertFalse(colormapObject == colormapObject2)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setNormalization(Colormap.LINEAR)
        self.assertFalse(colormapObject == colormapObject2)
    def testCopy(self):
        """Make sure the copy function is correctly processing
        """
        colormapObject = Colormap(name=None,
                                  colors=numpy.array([[1., 0., 0.],
                                                      [0., 1., 0.],
                                                      [0., 0., 1.]]),
                                  vmin=None,
                                  vmax=None,
                                  normalization=Colormap.LOGARITHM)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setColormapLUT([[0, 0, 0], [255, 255, 255]])
        self.assertFalse(colormapObject == colormapObject2)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setNormalization(Colormap.LINEAR)
        self.assertFalse(colormapObject == colormapObject2)
Beispiel #5
0
    def testCopy(self):
        """Make sure the copy function is correctly processing
        """
        colormapObject = Colormap(name='red',
                                  colors=numpy.array([[1., 0., 0.],
                                                      [0., 1., 0.],
                                                      [0., 0., 1.]]),
                                  vmin=None,
                                  vmax=None,
                                  normalization=Colormap.LOGARITHM)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setColormapLUT([[0, 0, 0], [255, 255, 255]])
        self.assertFalse(colormapObject == colormapObject2)

        colormapObject2 = colormapObject.copy()
        self.assertTrue(colormapObject == colormapObject2)
        colormapObject.setNormalization(Colormap.LINEAR)
        self.assertFalse(colormapObject == colormapObject2)