Example #1
0
    def __updateGUIWithIntegrationResult(self, integrationProcess):
        colormap = self.__defaultColorMap
        self.__plot2d.setDefaultColormap(colormap)

        # Add a marker for each rings on the plots
        ringAngles = integrationProcess.ringAngles()
        for legend in self.__ringLegends:
            self.__plot1d.removeMarker(legend)
            self.__plot2d.removeMarker(legend)
        self.__ringLegends = []
        colors = utils.getFreeColorRange(self.__plot2d.getDefaultColormap())
        for i, angle in enumerate(ringAngles):
            legend = "ring_%i" % (i + 1)
            color = colors[i % len(colors)]
            htmlColor = "#%02X%02X%02X" % (color.red(), color.green(),
                                           color.blue())
            self.__plot1d.addXMarker(x=angle, color=htmlColor, legend=legend)
            self.__plot2d.addXMarker(x=angle, color=htmlColor, legend=legend)
            self.__ringLegends.append(legend)

        # FIXME set axes
        result1d = integrationProcess.result1d()
        if hasattr(self.__plot1d, "addHistogram"):
            # silx >= 0.5
            # Removing item fixes bug in silx 0.5 when histogram data changed
            self.__plot1d.remove(legend="result1d", kind="histogram")
            self.__plot1d.addHistogram(legend="result1d",
                                       align="right",
                                       edges=result1d.radial,
                                       color="blue",
                                       histogram=result1d.intensity)
        else:
            # older
            self.__plot1d.addCurve(legend="result1d",
                                   x=result1d.radial,
                                   y=result1d.intensity)

        # Assume that axes are linear
        result2d = integrationProcess.result2d()
        origin = (result2d.radial[0], result2d.azimuthal[0])
        scaleX = (result2d.radial[-1] -
                  result2d.radial[0]) / result2d.intensity.shape[1]
        scaleY = (result2d.azimuthal[-1] -
                  result2d.azimuthal[0]) / result2d.intensity.shape[0]
        self.__plot2d.addImage(legend="result2d",
                               data=result2d.intensity,
                               origin=origin,
                               scale=(scaleX, scaleY),
                               colormap=colormap)
Example #2
0
    def __updateGUIWithIntegrationResult(self, integrationProcess):
        colormap = self.__defaultColorMap
        self.__plot2d.setDefaultColormap(colormap)

        # Add a marker for each rings on the plots
        ringAngles = integrationProcess.ringAngles()
        for legend in self.__ringLegends:
            self.__plot1d.removeMarker(legend)
            self.__plot2d.removeMarker(legend)
        self.__ringLegends = []
        colors = utils.getFreeColorRange(self.__plot2d.getDefaultColormap())
        for i, angle in enumerate(ringAngles):
            legend = "ring_%i" % (i + 1)
            color = colors[i % len(colors)]
            htmlColor = "#%02X%02X%02X60" % (color.red(), color.green(), color.blue())
            self.__plot1d.addXMarker(x=angle, color=htmlColor, legend=legend)
            self.__plot2d.addXMarker(x=angle, color=htmlColor, legend=legend)
            self.__ringLegends.append(legend)

        # FIXME set axes
        result1d = integrationProcess.result1d()
        if hasattr(self.__plot1d, "addHistogram"):
            # silx >= 0.5
            # Removing item fixes bug in silx 0.5 when histogram data changed
            self.__plot1d.remove(legend="result1d", kind="histogram")
            self.__plot1d.addHistogram(
                legend="result1d",
                align="right",
                edges=result1d.radial,
                color="blue",
                histogram=result1d.intensity)
        else:
            # older
            self.__plot1d.addCurve(
                legend="result1d",
                x=result1d.radial,
                y=result1d.intensity)

        # Assume that axes are linear
        result2d = integrationProcess.result2d()
        origin = (result2d.radial[0], result2d.azimuthal[0])
        scaleX = (result2d.radial[-1] - result2d.radial[0]) / result2d.intensity.shape[1]
        scaleY = (result2d.azimuthal[-1] - result2d.azimuthal[0]) / result2d.intensity.shape[0]
        self.__plot2d.addImage(
            legend="result2d",
            data=result2d.intensity,
            origin=origin,
            scale=(scaleX, scaleY),
            colormap=colormap)
Example #3
0
 def createMarkerColors(self):
     colormap = self.getDefaultColormap()
     return utils.getFreeColorRange(colormap)
Example #4
0
 def createMarkerColors(self):
     colormap = self.getDefaultColormap()
     return utils.getFreeColorRange(colormap)