コード例 #1
0
    def get_ranges(self, beam_to_plot, var_x, var_y):
        xrange = None
        yrange = None
        factor1 = ShadowPlot.get_factor(var_x, self.workspace_units_to_cm)
        factor2 = ShadowPlot.get_factor(var_y, self.workspace_units_to_cm)

        if self.x_range == 0 and self.y_range == 0:
            pass
        else:
            if self.x_range == 1:
                congruence.checkLessThan(self.x_range_min, self.x_range_max,
                                         "X range min", "X range max")

                xrange = [
                    self.x_range_min / factor1, self.x_range_max / factor1
                ]

            if self.y_range == 1:
                congruence.checkLessThan(self.y_range_min, self.y_range_max,
                                         "Y range min", "Y range max")

                yrange = [
                    self.y_range_min / factor2, self.y_range_max / factor2
                ]

        return xrange, yrange
コード例 #2
0
    def plot_xy_hybrid(self, progressBarValue, scaled_matrix, plot_canvas_index, title, xtitle, ytitle, var1, var2):
        if self.plot_canvas[plot_canvas_index] is None:
            self.plot_canvas[plot_canvas_index] = ImageView()
            self.plot_canvas[plot_canvas_index].setColormap({"name":"temperature", "normalization":"linear", "autoscale":True, "vmin":0, "vmax":0, "colors":256})
            self.plot_canvas[plot_canvas_index].setMinimumWidth(590)
            self.plot_canvas[plot_canvas_index].setMaximumWidth(590)

            self.tab[plot_canvas_index].layout().addWidget(self.plot_canvas[plot_canvas_index])

        factor1 = ShadowPlot.get_factor(var1, self.workspace_units_to_cm)
        factor2 = ShadowPlot.get_factor(var2, self.workspace_units_to_cm)

        xmin, xmax = min(scaled_matrix.x_coord), max(scaled_matrix.x_coord)
        ymin, ymax = min(scaled_matrix.y_coord), max(scaled_matrix.y_coord)

        dim_x, dim_y = scaled_matrix.shape()

        origin = (xmin*factor1, ymin*factor2)
        scale = (abs((xmax-xmin)/dim_x)*factor1, abs((ymax-ymin)/dim_y)*factor2)

        data_to_plot = []
        for y_index in range(0, dim_y):
            x_values = []
            for x_index in range(0, dim_x):
                x_values.append(scaled_matrix.z_values[x_index, y_index])

            data_to_plot.append(x_values)

        self.plot_canvas[plot_canvas_index].setImage(numpy.array(data_to_plot), origin=origin, scale=scale)
        self.plot_canvas[plot_canvas_index].setGraphXLabel(xtitle)
        self.plot_canvas[plot_canvas_index].setGraphYLabel(ytitle)
        self.plot_canvas[plot_canvas_index].setGraphTitle(title)

        self.progressBarSet(progressBarValue)
コード例 #3
0
    def replace_fig(self, beam, var_x, var_y, var_color, title, xtitle, ytitle,
                    xrange, yrange, nolost, xum, yum):

        if self.backend == 0:
            use_backend = 'matplotlib'
        elif self.backend == 1:
            if not has_opengl:
                QMessageBox.information(
                    self, "Plot Scatter Information",
                    "It seems that PyOpenGL is not installed in your system.\n Install it to get much faster scatter plots.",
                    QMessageBox.Ok)
                use_backend = 'matplotlib'
                self.backend = 0
            else:
                use_backend = 'gl'

        if self.plot_canvas is None:
            self.plot_canvas = ScatterView(backend=use_backend)
        else:
            self.image_box.layout().removeWidget(self.plot_canvas)
            self.plot_canvas = None
            self.plot_canvas = ScatterView(backend=use_backend)

        if self.color_column != 0:
            color_array = beam.getshonecol(var_color, nolost=nolost)
        else:
            color_array = beam.getshonecol(1, nolost=nolost) * 0.0

        factor1 = ShadowPlot.get_factor(var_x, self.workspace_units_to_cm)
        factor2 = ShadowPlot.get_factor(var_y, self.workspace_units_to_cm)
        factorC = ShadowPlot.get_factor(var_color, self.workspace_units_to_cm)

        if self.weight_transparency == 1:
            self.plot_canvas.setData(
                beam.getshonecol(var_x, nolost=nolost) * factor1,
                beam.getshonecol(var_y, nolost=nolost) * factor2,
                color_array * factorC,
                alpha=beam.getshonecol(23, nolost=nolost))
        else:
            self.plot_canvas.setData(
                beam.getshonecol(var_x, nolost=nolost) * factor1,
                beam.getshonecol(var_y, nolost=nolost) * factor2,
                color_array * factorC,
            )

        self.plot_canvas.resetZoom()
        self.plot_canvas.setGraphTitle(title)
        self.plot_canvas.setColormap(Colormap('viridis'))

        ax = self.plot_canvas.getPlotWidget().getXAxis()
        if self.x_range == 1:
            ax.setLimits(self.x_range_min, self.x_range_max)
        ax.setLabel(xtitle)

        ay = self.plot_canvas.getPlotWidget().getYAxis()
        if self.y_range == 1:
            ay.setLimits(self.y_range_min, self.y_range_max)
        ay.setLabel(ytitle)

        self.image_box.layout().addWidget(self.plot_canvas)
コード例 #4
0
    def get_ranges(self, beam_to_plot, var_x, var_y):
        xrange = None
        yrange = None
        factor1 = ShadowPlot.get_factor(var_x, self.workspace_units_to_cm)
        factor2 = ShadowPlot.get_factor(var_y, self.workspace_units_to_cm)

        if self.x_range == 0 and self.y_range == 0:
            if self.cartesian_axis == 1:
                x_max = 0
                y_max = 0
                x_min = 0
                y_min = 0

                x, y, good_only = beam_to_plot.getshcol((var_x, var_y, 10))

                x_to_plot = copy.deepcopy(x)
                y_to_plot = copy.deepcopy(y)

                go = numpy.where(good_only == 1)
                lo = numpy.where(good_only != 1)

                if self.rays == 0:
                    x_max = numpy.array(x_to_plot[0:], float).max()
                    y_max = numpy.array(y_to_plot[0:], float).max()
                    x_min = numpy.array(x_to_plot[0:], float).min()
                    y_min = numpy.array(y_to_plot[0:], float).min()
                elif self.rays == 1:
                    x_max = numpy.array(x_to_plot[go], float).max()
                    y_max = numpy.array(y_to_plot[go], float).max()
                    x_min = numpy.array(x_to_plot[go], float).min()
                    y_min = numpy.array(y_to_plot[go], float).min()
                elif self.rays == 2:
                    x_max = numpy.array(x_to_plot[lo], float).max()
                    y_max = numpy.array(y_to_plot[lo], float).max()
                    x_min = numpy.array(x_to_plot[lo], float).min()
                    y_min = numpy.array(y_to_plot[lo], float).min()

                xrange = [x_min, x_max]
                yrange = [y_min, y_max]
        else:
            if self.x_range == 1:
                congruence.checkLessThan(self.x_range_min, self.x_range_max,
                                         "X range min", "X range max")

                xrange = [
                    self.x_range_min / factor1, self.x_range_max / factor1
                ]

            if self.y_range == 1:
                congruence.checkLessThan(self.y_range_min, self.y_range_max,
                                         "Y range min", "Y range max")

                yrange = [
                    self.y_range_min / factor2, self.y_range_max / factor2
                ]

        return xrange, yrange
コード例 #5
0
ファイル: ow_plot_xy.py プロジェクト: lucarebuffi/ShadowOui
    def get_ranges(self, beam_to_plot, var_x, var_y):
        xrange = None
        yrange = None
        factor1 = ShadowPlot.get_factor(var_x, self.workspace_units_to_cm)
        factor2 = ShadowPlot.get_factor(var_y, self.workspace_units_to_cm)

        if self.x_range == 0 and self.y_range == 0:
            if self.cartesian_axis == 1:
                x_max = 0
                y_max = 0
                x_min = 0
                y_min = 0

                x, y, good_only = beam_to_plot.getshcol((var_x, var_y, 10))

                x_to_plot = copy.deepcopy(x)
                y_to_plot = copy.deepcopy(y)

                go = numpy.where(good_only == 1)
                lo = numpy.where(good_only != 1)

                if self.rays == 0:
                    x_max = numpy.array(x_to_plot[0:], float).max()
                    y_max = numpy.array(y_to_plot[0:], float).max()
                    x_min = numpy.array(x_to_plot[0:], float).min()
                    y_min = numpy.array(y_to_plot[0:], float).min()
                elif self.rays == 1:
                    x_max = numpy.array(x_to_plot[go], float).max()
                    y_max = numpy.array(y_to_plot[go], float).max()
                    x_min = numpy.array(x_to_plot[go], float).min()
                    y_min = numpy.array(y_to_plot[go], float).min()
                elif self.rays == 2:
                    x_max = numpy.array(x_to_plot[lo], float).max()
                    y_max = numpy.array(y_to_plot[lo], float).max()
                    x_min = numpy.array(x_to_plot[lo], float).min()
                    y_min = numpy.array(y_to_plot[lo], float).min()

                xrange = [x_min, x_max]
                yrange = [y_min, y_max]
        else:
            if self.x_range == 1:
                if self.x_range_min >= self.x_range_max:
                    raise Exception("X range min cannot be greater or equal than X range max")

                xrange = [self.x_range_min / factor1, self.x_range_max / factor1]

            if self.y_range == 1:
                if self.y_range_min >= self.y_range_max:
                    raise Exception("Y range min cannot be greater or than Y range max")

                yrange = [self.y_range_min / factor2, self.y_range_max / factor2]

        return xrange, yrange
コード例 #6
0
    def get_range(self, beam_to_plot, var_x):
        if self.x_range == 0:
            x_max = 0
            x_min = 0

            x, good_only = beam_to_plot.getshcol((var_x, 10))

            x_to_plot = copy.deepcopy(x)

            go = numpy.where(good_only == 1)
            lo = numpy.where(good_only != 1)

            if self.rays == 0:
                x_max = numpy.array(x_to_plot[0:], float).max()
                x_min = numpy.array(x_to_plot[0:], float).min()
            elif self.rays == 1:
                x_max = numpy.array(x_to_plot[go], float).max()
                x_min = numpy.array(x_to_plot[go], float).min()
            elif self.rays == 2:
                x_max = numpy.array(x_to_plot[lo], float).max()
                x_min = numpy.array(x_to_plot[lo], float).min()

            xrange = [x_min, x_max]
        else:
            congruence.checkLessThan(self.x_range_min, self.x_range_max,
                                     "X range min", "X range max")

            factor1 = ShadowPlot.get_factor(var_x, self.workspace_units_to_cm)

            xrange = [self.x_range_min / factor1, self.x_range_max / factor1]

        return xrange
コード例 #7
0
ファイル: scanning_gui.py プロジェクト: 91902078/ShadowOui
    def plot_histo(self,
                   beam,
                   col,
                   nbins=100,
                   ref=23,
                   title="",
                   xtitle="",
                   ytitle="",
                   histo_index=0,
                   scan_variable_name="Variable",
                   scan_variable_value=0,
                   offset=0.0,
                   xrange=None,
                   show_reference=True,
                   add_labels=True,
                   has_colormap=True,
                   colormap=cm.rainbow):
        factor=ShadowPlot.get_factor(col, conv=self.workspace_units_to_cm)

        if histo_index==0 and xrange is None:
            ticket = beam._beam.histo1(col, xrange=None, nbins=nbins, nolost=1, ref=ref)

            fwhm = ticket['fwhm']
            xrange = ticket['xrange']
            centroid = get_average(ticket['histogram'], ticket['bin_center'])

            if not fwhm is None: xrange = [centroid - 2*fwhm , centroid + 2*fwhm]

        ticket = beam._beam.histo1(col, xrange=xrange, nbins=nbins, nolost=1, ref=ref)

        if not ytitle is None:  ytitle = ytitle + ' weighted by ' + ShadowPlot.get_shadow_label(ref)

        histogram = ticket['histogram_path']
        bins = ticket['bin_path']*factor

        histogram_stats = ticket['histogram']
        bins_stats = ticket['bin_center']

        sigma = get_sigma(histogram_stats, bins_stats)*factor
        fwhm = sigma*2.35 if ticket['fwhm'] is None else ticket['fwhm']*factor
        centroid = get_average(histogram_stats, bins_stats)*factor

        peak_intensity = numpy.average(histogram_stats[numpy.where(histogram_stats>=numpy.max(histogram_stats)*0.90)])
        integral_intensity = numpy.sum(histogram_stats)

        rcParams['axes.formatter.useoffset']='False'

        self.set_xrange(bins)
        self.set_labels(title=title, xlabel=xtitle, ylabel=scan_variable_name, zlabel=ytitle)

        self.add_histo(scan_variable_value, histogram, has_colormap, colormap, histo_index)

        return HistogramData(histogram=histogram_stats,
                             bins=bins_stats,
                             xrange=xrange,
                             fwhm=fwhm,
                             sigma=sigma,
                             centroid=centroid,
                             peak_intensity=peak_intensity,
                             integral_intensity=integral_intensity)
コード例 #8
0
    def plot_histo_hybrid(self, progressBarValue, scaled_array,
                          plot_canvas_index, title, xtitle, ytitle, var):
        if self.plot_canvas[plot_canvas_index] is None:
            self.plot_canvas[plot_canvas_index] = oasysgui.plotWindow(
                roi=False, control=False, position=True)
            self.plot_canvas[plot_canvas_index].setDefaultPlotLines(True)
            self.plot_canvas[plot_canvas_index].setActiveCurveColor(
                color='blue')
            self.plot_canvas[plot_canvas_index].setInteractiveMode(mode='zoom')

            self.tab[plot_canvas_index].layout().addWidget(
                self.plot_canvas[plot_canvas_index])

        factor = ShadowPlot.get_factor(var, self.workspace_units_to_cm)

        self.plot_canvas[plot_canvas_index].addCurve(
            scaled_array.scale * factor,
            scaled_array.np_array,
            "crv_" + ytitle,
            symbol='',
            color="blue",
            replace=True)  #'+', '^', ','
        self.plot_canvas[plot_canvas_index]._backend.ax.get_yaxis(
        ).get_major_formatter().set_useOffset(True)
        self.plot_canvas[plot_canvas_index]._backend.ax.get_yaxis(
        ).get_major_formatter().set_scientific(True)
        self.plot_canvas[plot_canvas_index].setGraphXLabel(xtitle)
        self.plot_canvas[plot_canvas_index].setGraphYLabel(ytitle)
        self.plot_canvas[plot_canvas_index].setGraphTitle(title)
        self.plot_canvas[plot_canvas_index].replot()

        self.progressBarSet(progressBarValue)
コード例 #9
0
ファイル: ow_histogram.py プロジェクト: lucarebuffi/ShadowOui
    def get_range(self, beam_to_plot, var_x):
        if self.x_range == 0:
            x_max = 0
            x_min = 0

            x, good_only = beam_to_plot.getshcol((var_x, 10))

            x_to_plot = copy.deepcopy(x)

            go = numpy.where(good_only == 1)
            lo = numpy.where(good_only != 1)

            if self.rays == 0:
                x_max = numpy.array(x_to_plot[0:], float).max()
                x_min = numpy.array(x_to_plot[0:], float).min()
            elif self.rays == 1:
                x_max = numpy.array(x_to_plot[go], float).max()
                x_min = numpy.array(x_to_plot[go], float).min()
            elif self.rays == 2:
                x_max = numpy.array(x_to_plot[lo], float).max()
                x_min = numpy.array(x_to_plot[lo], float).min()

            xrange = [x_min, x_max]
        else:
            if self.x_range_min >= self.x_range_max:
                raise Exception("X range min cannot be greater or equal than X range max")

            factor1 = ShadowPlot.get_factor(var_x, self.workspace_units_to_cm)

            xrange = [self.x_range_min / factor1, self.x_range_max / factor1]

        return xrange
コード例 #10
0
    def plot_histo_hybrid(self, progressBarValue, scaled_array, plot_canvas_index, title, xtitle, ytitle, var):
        if self.plot_canvas[plot_canvas_index] is None:
            self.plot_canvas[plot_canvas_index] = PlotWindow(roi=False, control=False, position=True, plugins=False)
            self.plot_canvas[plot_canvas_index].setDefaultPlotLines(True)
            self.plot_canvas[plot_canvas_index].setActiveCurveColor(color='darkblue')
            self.plot_canvas[plot_canvas_index].setDrawModeEnabled(True, 'rectangle')
            self.plot_canvas[plot_canvas_index].setZoomModeEnabled(True)

            self.tab[plot_canvas_index].layout().addWidget(self.plot_canvas[plot_canvas_index])

        factor = ShadowPlot.get_factor(var, self.workspace_units_to_cm)

        self.plot_canvas[plot_canvas_index].addCurve(scaled_array.scale*factor, scaled_array.np_array, "crv_"+ytitle, symbol='', color="blue", replace=True) #'+', '^', ','
        self.plot_canvas[plot_canvas_index]._plot.graph.ax.get_yaxis().get_major_formatter().set_useOffset(True)
        self.plot_canvas[plot_canvas_index]._plot.graph.ax.get_yaxis().get_major_formatter().set_scientific(True)
        self.plot_canvas[plot_canvas_index].setGraphXLabel(xtitle)
        self.plot_canvas[plot_canvas_index].setGraphYLabel(ytitle)
        self.plot_canvas[plot_canvas_index].setGraphTitle(title)
        self.plot_canvas[plot_canvas_index].replot()

        self.progressBarSet(progressBarValue)
コード例 #11
0
    def plot_results(self):
        self.plotted_beam = None

        if super().plot_results():
            if self.spectro_plot_canvas is None:
                self.spectro_plot_canvas = PlotWindow.PlotWindow(
                    roi=False,
                    control=False,
                    position=False,
                    plugins=False,
                    logx=False,
                    logy=False)
                self.spectro_plot_canvas.setDefaultPlotLines(False)
                self.spectro_plot_canvas.setDefaultPlotPoints(True)
                self.spectro_plot_canvas.setZoomModeEnabled(True)
                self.spectro_plot_canvas.setMinimumWidth(673)
                self.spectro_plot_canvas.setMaximumWidth(673)
                pos = self.spectro_plot_canvas._plot.graph.ax.get_position()
                self.spectro_plot_canvas._plot.graph.ax.set_position(
                    [pos.x0, pos.y0, pos.width * 0.86, pos.height])
                pos = self.spectro_plot_canvas._plot.graph.ax2.get_position()
                self.spectro_plot_canvas._plot.graph.ax2.set_position(
                    [pos.x0, pos.y0, pos.width * 0.86, pos.height])
                ax3 = self.spectro_plot_canvas._plot.graph.fig.add_axes(
                    [.82, .15, .05, .75])

                self.spectro_image_box.layout().addWidget(
                    self.spectro_plot_canvas)
            else:
                self.spectro_plot_canvas.clear()
                self.spectro_plot_canvas.setDefaultPlotLines(False)
                self.spectro_plot_canvas.setDefaultPlotPoints(True)
                ax3 = self.spectro_plot_canvas._plot.graph.fig.axes[-1]
                ax3.cla()

            number_of_bins = self.spectro_number_of_bins + 1

            x, y, auto_x_title, auto_y_title, xum, yum = self.get_titles()

            if self.plotted_beam is None: self.plotted_beam = self.input_beam

            xrange, yrange = self.get_ranges(self.plotted_beam._beam, x, y)

            min_k = numpy.min(self.plotted_beam._beam.rays[:, 10])
            max_k = numpy.max(self.plotted_beam._beam.rays[:, 10])

            if self.spectro_variable == 0:  #Energy
                energy_min = ShadowPhysics.getEnergyFromShadowK(min_k)
                energy_max = ShadowPhysics.getEnergyFromShadowK(max_k)

                bins = energy_min + numpy.arange(0, number_of_bins + 1) * (
                    (energy_max - energy_min) / number_of_bins)
                normalization = colors.Normalize(vmin=energy_min,
                                                 vmax=energy_max)
            else:  #wavelength
                wavelength_min = ShadowPhysics.getWavelengthfromShadowK(max_k)
                wavelength_max = ShadowPhysics.getWavelengthfromShadowK(min_k)

                bins = wavelength_min + numpy.arange(0, number_of_bins + 1) * (
                    (wavelength_max - wavelength_min) / number_of_bins)
                normalization = colors.Normalize(vmin=wavelength_min,
                                                 vmax=wavelength_max)

            scalarMap = cmx.ScalarMappable(norm=normalization,
                                           cmap=self.color_map)

            cb1 = colorbar.ColorbarBase(ax3,
                                        cmap=self.color_map,
                                        norm=normalization,
                                        orientation='vertical')

            if self.spectro_variable == 0:  #Energy
                cb1.set_label('Energy [eV]')
            else:
                cb1.set_label('Wavelength [Å]')

            go = numpy.where(self.plotted_beam._beam.rays[:, 9] == 1)
            lo = numpy.where(self.plotted_beam._beam.rays[:, 9] != 1)

            rays_to_plot = self.plotted_beam._beam.rays

            if self.rays == 1:
                rays_to_plot = self.plotted_beam._beam.rays[go]
            elif self.rays == 2:
                rays_to_plot = self.plotted_beam._beam.rays[lo]

            factor_x = ShadowPlot.get_factor(x, self.workspace_units_to_cm)
            factor_y = ShadowPlot.get_factor(y, self.workspace_units_to_cm)

            for index in range(0, number_of_bins):
                min_value = bins[index]
                max_value = bins[index + 1]

                if index < number_of_bins - 1:
                    if self.spectro_variable == 0:  #Energy
                        cursor = numpy.where((numpy.round(
                            ShadowPhysics.getEnergyFromShadowK(
                                rays_to_plot[:, 10]),
                            4) >= numpy.round(min_value, 4)) & (numpy.round(
                                ShadowPhysics.getEnergyFromShadowK(
                                    rays_to_plot[:, 10]), 4) < numpy.round(
                                        max_value, 4)))
                    else:
                        cursor = numpy.where((numpy.round(
                            ShadowPhysics.getWavelengthfromShadowK(
                                rays_to_plot[:, 10]),
                            4) >= numpy.round(min_value, 4)) & (numpy.round(
                                ShadowPhysics.getWavelengthfromShadowK(
                                    rays_to_plot[:, 10]), 4) < numpy.round(
                                        max_value, 4)))
                else:
                    if self.spectro_variable == 0:  #Energy
                        cursor = numpy.where((numpy.round(
                            ShadowPhysics.getEnergyFromShadowK(
                                rays_to_plot[:, 10]),
                            4) >= numpy.round(min_value, 4)) & (numpy.round(
                                ShadowPhysics.getEnergyFromShadowK(
                                    rays_to_plot[:, 10]), 4) <= numpy.round(
                                        max_value, 4)))
                    else:
                        cursor = numpy.where((numpy.round(
                            ShadowPhysics.getWavelengthfromShadowK(
                                rays_to_plot[:, 10]),
                            4) >= numpy.round(min_value, 4)) & (numpy.round(
                                ShadowPhysics.getWavelengthfromShadowK(
                                    rays_to_plot[:, 10]), 4) <= numpy.round(
                                        max_value, 4)))

                color = scalarMap.to_rgba((bins[index] + bins[index + 1]) / 2)

                if index == 0:
                    self.spectro_plot_canvas.setActiveCurveColor(color=color)

                self.replace_spectro_fig(rays_to_plot[cursor],
                                         x,
                                         y,
                                         factor_x,
                                         factor_y,
                                         title=self.title + str(index),
                                         color=color)

            self.spectro_plot_canvas.setGraphXLimits(xrange[0] * factor_x,
                                                     xrange[1] * factor_x)
            self.spectro_plot_canvas.setGraphYLimits(yrange[0] * factor_y,
                                                     yrange[1] * factor_y)
            self.spectro_plot_canvas.setGraphXLabel(auto_x_title)
            self.spectro_plot_canvas.setGraphYLabel(auto_y_title)
            self.spectro_plot_canvas.replot()
コード例 #12
0
    def plot_xy(self, var_x, var_y, title, xtitle, ytitle, xum, yum):
        beam_to_plot = self.input_beam._beam

        if self.image_plane == 1:
            new_shadow_beam = self.input_beam.duplicate(history=False)

            historyItem = self.input_beam.getOEHistory(oe_number=self.input_beam._oe_number)
            if historyItem is None: raise Exception("Calculation impossible: Beam has no history")

            dist = 0.0

            if self.image_plane_rel_abs_position == 1:  # relative
                image_plane = 0.0

                if type(historyItem._shadow_oe_end) == ShadowOpticalElement:
                    image_plane = historyItem._shadow_oe_end._oe.T_IMAGE
                elif type(historyItem._shadow_oe_end) == ShadowCompoundOpticalElement:
                    image_plane = historyItem._shadow_oe_end._oe.list[historyItem._shadow_oe_end._oe.number_oe() - 1].T_IMAGE

                if self.image_plane_new_position < 0 and abs(self.image_plane_new_position) > image_plane:
                    raise Exception("Image plane new position cannot be before the O.E.")

                dist = self.image_plane_new_position
            else:  # absolute
                ShadowGui.checkPositiveNumber(self.image_plane_new_position, "Image Plane new Position")

                dist = self.image_plane_new_position - historyItem._shadow_oe_end._oe.T_IMAGE

            new_shadow_beam._beam.retrace(dist)

            beam_to_plot = new_shadow_beam._beam

        xrange = None
        yrange = None

        factor1 = ShadowPlot.get_factor(var_x)
        factor2 = ShadowPlot.get_factor(var_y)

        if self.x_range == 0 and self.y_range == 0:
            if self.cartesian_axis == 1:
                x_max = 0
                y_max = 0
                x_min = 0
                y_min = 0

                x, y, good_only = beam_to_plot.getshcol((var_x, var_y, 10))

                x_to_plot = copy.deepcopy(x)
                y_to_plot = copy.deepcopy(y)

                go = numpy.where(good_only == 1)
                lo = numpy.where(good_only != 1)

                if self.rays == 0:
                    x_max = numpy.array(x_to_plot[0:], float).max()
                    y_max = numpy.array(y_to_plot[0:], float).max()
                    x_min = numpy.array(x_to_plot[0:], float).min()
                    y_min = numpy.array(y_to_plot[0:], float).min()
                elif self.rays == 1:
                    x_max = numpy.array(x_to_plot[go], float).max()
                    y_max = numpy.array(y_to_plot[go], float).max()
                    x_min = numpy.array(x_to_plot[go], float).min()
                    y_min = numpy.array(y_to_plot[go], float).min()
                elif self.rays == 2:
                    x_max = numpy.array(x_to_plot[lo], float).max()
                    y_max = numpy.array(y_to_plot[lo], float).max()
                    x_min = numpy.array(x_to_plot[lo], float).min()
                    y_min = numpy.array(y_to_plot[lo], float).min()

                temp = numpy.array([x_max, y_max, x_min, y_min], float)

                xrange = [temp.min(), temp.max()]
                yrange = [temp.min(), temp.max()]
        else:
            if self.x_range == 1:
                if self.x_range_min >= self.x_range_max:
                    raise Exception("X range min cannot be greater or equal than X range max")

                xrange = [self.x_range_min / factor1, self.x_range_max / factor1]

            if self.y_range == 1:
                if self.y_range_min >= self.y_range_max:
                    raise Exception("Y range min cannot be greater or than Y range max")

                yrange = [self.y_range_min / factor2, self.y_range_max / factor1]

        self.replace_fig(beam_to_plot, var_x, var_y, title, xtitle, ytitle, xrange=xrange, yrange=yrange, nbins=int(self.number_of_bins), nolost=self.rays, xum=xum, yum=yum)
コード例 #13
0
    def calculate(self):
        if ShadowCongruence.checkEmptyBeam(self.input_beam):
            if ShadowCongruence.checkGoodBeam(self.input_beam):

                beam_to_analize = self.input_beam._beam

                if self.image_plane == 1:
                    new_shadow_beam = self.input_beam.duplicate(history=False)
                    dist = 0.0

                    if self.image_plane_rel_abs_position == 1:  # relative
                        dist = self.image_plane_new_position
                    else:  # absolute
                        historyItem = self.input_beam.getOEHistory(
                            oe_number=self.input_beam._oe_number)

                        if historyItem is None: image_plane = 0.0
                        elif self.input_beam._oe_number == 0: image_plane = 0.0
                        else:
                            image_plane = historyItem._shadow_oe_end._oe.T_IMAGE

                        dist = self.image_plane_new_position - image_plane

                    new_shadow_beam._beam.retrace(dist)

                    beam_to_analize = new_shadow_beam._beam

                if self.mode == 2:
                    center = [self.center_x, self.center_z]
                else:
                    center = [0.0, 0.0]

                if self.y_range == 1:
                    if self.y_range_min >= self.y_range_max:
                        raise Exception(
                            "Y range min cannot be greater or than Y range max"
                        )

                ticket = ST.focnew(beam_to_analize,
                                   mode=self.mode,
                                   center=center)

                self.focnewInfo.setText(ticket["text"])

                if self.plot_canvas_x is None:
                    self.plot_canvas_x = oasysgui.plotWindow(roi=False,
                                                             control=False,
                                                             position=True)
                    self.plot_canvas_x.setDefaultPlotLines(True)
                    self.plot_canvas_x.setActiveCurveColor(color='blue')
                    self.plot_canvas_x.setInteractiveMode(mode='zoom')
                    self.plot_canvas_x.toolBar().setVisible(False)

                    self.plot_canvas_z = oasysgui.plotWindow(roi=False,
                                                             control=False,
                                                             position=True)
                    self.plot_canvas_z.setDefaultPlotLines(True)
                    self.plot_canvas_z.setActiveCurveColor(color='red')
                    self.plot_canvas_z.setInteractiveMode(mode='zoom')
                    self.plot_canvas_z.toolBar().setVisible(False)

                    self.plot_canvas_t = oasysgui.plotWindow(roi=False,
                                                             control=False,
                                                             position=True)
                    self.plot_canvas_t.setDefaultPlotLines(True)
                    self.plot_canvas_t.setActiveCurveColor(color='green')
                    self.plot_canvas_t.setInteractiveMode(mode='zoom')
                    self.plot_canvas_t.toolBar().setVisible(False)

                    gridLayout = QtWidgets.QGridLayout()

                    gridLayout.addWidget(self.plot_canvas_x, 0, 0)
                    gridLayout.addWidget(self.plot_canvas_z, 0, 1)
                    gridLayout.addWidget(self.plot_canvas_t, 1, 0)

                    widget = QtWidgets.QWidget()
                    widget.setLayout(gridLayout)

                    self.image_box.layout().addWidget(widget)

                if self.y_range == 0:
                    y = numpy.linspace(-10.0, 10.0, 1001)
                else:
                    y = numpy.linspace(self.y_range_min, self.y_range_max,
                                       self.y_npoints)

                pos = [0.25, 0.15, 0.7, 0.75]

                self.plot_canvas_x.addCurve(
                    y,
                    2.35 * ST.focnew_scan(ticket["AX"], y) *
                    ShadowPlot.get_factor(1, self.workspace_units_to_cm),
                    "x (tangential)",
                    symbol='',
                    color="blue",
                    replace=True)  #'+', '^', ','
                self.plot_canvas_x._backend.ax.get_yaxis().get_major_formatter(
                ).set_useOffset(True)
                self.plot_canvas_x._backend.ax.get_yaxis().get_major_formatter(
                ).set_scientific(True)
                self.plot_canvas_x._backend.ax.set_position(pos)
                self.plot_canvas_x._backend.ax2.set_position(pos)
                self.plot_canvas_x.setGraphXLabel("Y [" +
                                                  self.workspace_units_label +
                                                  "]")
                self.plot_canvas_x.setGraphYLabel("2.35*<X> [$\mu$m]")
                self.plot_canvas_x._backend.ax.set_title(
                    "X", horizontalalignment='left')
                self.plot_canvas_x.replot()

                self.plot_canvas_z.addCurve(
                    y,
                    2.35 * ST.focnew_scan(ticket["AZ"], y) *
                    ShadowPlot.get_factor(3, self.workspace_units_to_cm),
                    "z (sagittal)",
                    symbol='',
                    color="red",
                    replace=False)  #'+', '^', ','
                self.plot_canvas_z._backend.ax.get_yaxis().get_major_formatter(
                ).set_useOffset(True)
                self.plot_canvas_z._backend.ax.get_yaxis().get_major_formatter(
                ).set_scientific(True)
                self.plot_canvas_z._backend.ax.set_position(pos)
                self.plot_canvas_z._backend.ax2.set_position(pos)
                self.plot_canvas_z.setGraphXLabel("Y [" +
                                                  self.workspace_units_label +
                                                  "]")
                self.plot_canvas_z.setGraphYLabel("2.35*<Z> [$\mu$m]")
                self.plot_canvas_z._backend.ax.set_title(
                    "Z", horizontalalignment='left')
                self.plot_canvas_z.replot()

                self.plot_canvas_t.addCurve(
                    y,
                    2.35 * ST.focnew_scan(ticket["AT"], y) *
                    ShadowPlot.get_factor(1, self.workspace_units_to_cm),
                    "combined x,z",
                    symbol='',
                    color="green",
                    replace=True)  #'+', '^', ','
                self.plot_canvas_t._backend.ax.get_yaxis().get_major_formatter(
                ).set_useOffset(True)
                self.plot_canvas_t._backend.ax.get_yaxis().get_major_formatter(
                ).set_scientific(True)
                self.plot_canvas_t._backend.ax.set_position(pos)
                self.plot_canvas_t._backend.ax2.set_position(pos)
                self.plot_canvas_t.setGraphXLabel("Y [" +
                                                  self.workspace_units_label +
                                                  "]")
                self.plot_canvas_t.setGraphYLabel("2.35*<X,Z> [$\mu$m]")
                self.plot_canvas_t._backend.ax.set_title(
                    "X,Z (Combined)", horizontalalignment='left')
                self.plot_canvas_t.replot()
コード例 #14
0
    def plot_histo(self,
                   beam,
                   col,
                   nbins=100,
                   title="",
                   xtitle="",
                   ytitle="",
                   histo_index=0,
                   scan_variable_name="Variable",
                   scan_variable_value=0,
                   offset=0.0,
                   xrange=None,
                   show_reference=True,
                   add_labels=True,
                   has_colormap=True,
                   colormap=cm.rainbow):

        factor = ShadowPlot.get_factor(col, conv=self.workspace_units_to_cm)

        if histo_index == 0 and xrange is None:
            ticket = beam._beam.histo1(col,
                                       xrange=None,
                                       nbins=nbins,
                                       nolost=1,
                                       ref=23)

            fwhm = ticket['fwhm']
            xrange = ticket['xrange']
            centroid = xrange[0] + (xrange[1] - xrange[0]) * 0.5

            if not fwhm is None:
                xrange = [centroid - 2 * fwhm, centroid + 2 * fwhm]

        ticket = beam._beam.histo1(col,
                                   xrange=xrange,
                                   nbins=nbins,
                                   nolost=1,
                                   ref=23)

        if not ytitle is None:
            ytitle = ytitle + ' weighted by ' + ShadowPlot.get_shadow_label(23)

        histogram = ticket['histogram_path']
        bins = ticket['bin_path'] * factor

        histogram_stats = ticket['histogram']
        bins_stats = ticket['bin_center']

        fwhm = ticket['fwhm']

        sigma = get_sigma(histogram_stats, bins_stats) * factor
        fwhm = sigma * 2.35 if fwhm is None else fwhm * factor

        peak_intensity = numpy.average(histogram_stats[numpy.where(
            histogram_stats >= numpy.max(histogram_stats) * 0.85)])

        if histo_index == 0 and show_reference:
            h_title = "Reference"
        else:
            h_title = scan_variable_name + ": " + str(scan_variable_value)

        color = "#000000"

        import matplotlib
        matplotlib.rcParams['axes.formatter.useoffset'] = 'False'

        if histo_index == 0:
            offset = int(peak_intensity * 0.3)

        self.plot_canvas.addCurve(bins,
                                  histogram + offset * histo_index,
                                  h_title,
                                  symbol='',
                                  color=color,
                                  xlabel=xtitle,
                                  ylabel=ytitle,
                                  replace=False)  #'+', '^', ','

        if add_labels:
            self.plot_canvas._backend.ax.text(xrange[0] * factor * 1.05,
                                              offset * histo_index * 1.05,
                                              h_title)

        if not xtitle is None: self.plot_canvas.setGraphXLabel(xtitle)
        if not ytitle is None: self.plot_canvas.setGraphYLabel(ytitle)
        if not title is None: self.plot_canvas.setGraphTitle(title)

        for label in self.plot_canvas._backend.ax.yaxis.get_ticklabels():
            label.set_color('white')
            label.set_fontsize(1)

        self.plot_canvas.setActiveCurveColor(color="#00008B")

        self.plot_canvas.setDrawModeEnabled(True, 'rectangle')
        self.plot_canvas.setInteractiveMode('zoom', color='orange')
        self.plot_canvas.resetZoom()
        self.plot_canvas.replot()

        self.plot_canvas.setGraphXLimits(xrange[0] * factor,
                                         xrange[1] * factor)

        self.plot_canvas.setActiveCurve(h_title)

        self.plot_canvas.setDefaultPlotLines(True)
        self.plot_canvas.setDefaultPlotPoints(False)

        self.plot_canvas.getLegendsDockWidget().setFixedHeight(510)
        self.plot_canvas.getLegendsDockWidget().setVisible(True)

        self.plot_canvas.addDockWidget(Qt.RightDockWidgetArea,
                                       self.plot_canvas.getLegendsDockWidget())

        return HistogramData(histogram_stats, bins_stats, offset, xrange, fwhm,
                             sigma, peak_intensity)
コード例 #15
0
ファイル: ow_focnew.py プロジェクト: lucarebuffi/ShadowOui
    def calculate(self):
        if ShadowCongruence.checkEmptyBeam(self.input_beam):
            if ShadowCongruence.checkGoodBeam(self.input_beam):

                beam_to_analize = self.input_beam._beam

                if self.image_plane == 1:
                    new_shadow_beam = self.input_beam.duplicate(history=False)
                    dist = 0.0

                    if self.image_plane_rel_abs_position == 1:  # relative
                        dist = self.image_plane_new_position
                    else:  # absolute
                        historyItem = self.input_beam.getOEHistory(oe_number=self.input_beam._oe_number)

                        if historyItem is None: image_plane = 0.0
                        elif self.input_beam._oe_number == 0: image_plane = 0.0
                        else: image_plane = historyItem._shadow_oe_end._oe.T_IMAGE

                        dist = self.image_plane_new_position - image_plane

                    new_shadow_beam._beam.retrace(dist)

                    beam_to_analize = new_shadow_beam._beam

                if self.mode==2:
                    center=[self.center_x, self.center_z]
                else:
                    center=[0.0, 0.0]

                if self.y_range == 1:
                    if self.y_range_min >= self.y_range_max:
                        raise Exception("Y range min cannot be greater or than Y range max")

                ticket = ST.focnew(beam_to_analize, mode=self.mode, center=center)

                self.focnewInfo.setText(ticket["text"])

                if self.plot_canvas_x is None:
                    self.plot_canvas_x = PlotWindow(roi=False, control=False, position=True, plugins=False)
                    self.plot_canvas_x.setDefaultPlotLines(True)
                    self.plot_canvas_x.setActiveCurveColor(color='blue')
                    self.plot_canvas_x.setDrawModeEnabled(False)
                    self.plot_canvas_x.setZoomModeEnabled(False)
                    self.plot_canvas_x.toolBar.setVisible(False)

                    self.plot_canvas_z = PlotWindow(roi=False, control=False, position=True, plugins=False)
                    self.plot_canvas_z.setDefaultPlotLines(True)
                    self.plot_canvas_z.setActiveCurveColor(color='red')
                    self.plot_canvas_z.setDrawModeEnabled(False)
                    self.plot_canvas_z.setZoomModeEnabled(False)
                    self.plot_canvas_z.toolBar.setVisible(False)

                    self.plot_canvas_t = PlotWindow(roi=False, control=False, position=True, plugins=False)
                    self.plot_canvas_t.setDefaultPlotLines(True)
                    self.plot_canvas_t.setActiveCurveColor(color='green')
                    self.plot_canvas_t.setDrawModeEnabled(False)
                    self.plot_canvas_t.setZoomModeEnabled(False)
                    self.plot_canvas_t.toolBar.setVisible(False)

                    gridLayout = QtGui.QGridLayout()

                    gridLayout.addWidget(self.plot_canvas_x, 0, 0)
                    gridLayout.addWidget(self.plot_canvas_z, 0, 1)
                    gridLayout.addWidget(self.plot_canvas_t, 1, 0)

                    widget = QtGui.QWidget()
                    widget.setLayout(gridLayout)

                    self.image_box.layout().addWidget(widget)

                if self.y_range == 0:
                    y = numpy.linspace(-10.0, 10.0, 1001)
                else:
                    y = numpy.linspace(self.y_range_min, self.y_range_max, self.y_npoints)

                pos = [0.25, 0.15, 0.7, 0.75]

                self.plot_canvas_x.addCurve(y, 2.35*ST.focnew_scan(ticket["AX"], y)*ShadowPlot.get_factor(1, self.workspace_units_to_cm), "x (tangential)", symbol='', color="blue", replace=True) #'+', '^', ','
                self.plot_canvas_x._plot.graph.ax.get_yaxis().get_major_formatter().set_useOffset(True)
                self.plot_canvas_x._plot.graph.ax.get_yaxis().get_major_formatter().set_scientific(True)
                self.plot_canvas_x._plot.graph.ax.set_position(pos)
                self.plot_canvas_x._plot.graph.ax2.set_position(pos)
                self.plot_canvas_x.setGraphXLabel("Y [" + self.workspace_units_label + "]")
                self.plot_canvas_x.setGraphYLabel("2.35*<X> [$\mu$m]")
                self.plot_canvas_x._plot.graph.ax.set_title("X", horizontalalignment='left')
                self.plot_canvas_x.replot()

                self.plot_canvas_z.addCurve(y, 2.35*ST.focnew_scan(ticket["AZ"], y)*ShadowPlot.get_factor(3, self.workspace_units_to_cm), "z (sagittal)", symbol='', color="red", replace=False) #'+', '^', ','
                self.plot_canvas_z._plot.graph.ax.get_yaxis().get_major_formatter().set_useOffset(True)
                self.plot_canvas_z._plot.graph.ax.get_yaxis().get_major_formatter().set_scientific(True)
                self.plot_canvas_z._plot.graph.ax.set_position(pos)
                self.plot_canvas_z._plot.graph.ax2.set_position(pos)
                self.plot_canvas_z.setGraphXLabel("Y [" + self.workspace_units_label + "]")
                self.plot_canvas_z.setGraphYLabel("2.35*<Z> [$\mu$m]")
                self.plot_canvas_z._plot.graph.ax.set_title("Z", horizontalalignment='left')
                self.plot_canvas_z.replot()

                self.plot_canvas_t.addCurve(y, 2.35*ST.focnew_scan(ticket["AT"], y)*ShadowPlot.get_factor(1, self.workspace_units_to_cm), "combined x,z", symbol='', color="green", replace=True) #'+', '^', ','
                self.plot_canvas_t._plot.graph.ax.get_yaxis().get_major_formatter().set_useOffset(True)
                self.plot_canvas_t._plot.graph.ax.get_yaxis().get_major_formatter().set_scientific(True)
                self.plot_canvas_t._plot.graph.ax.set_position(pos)
                self.plot_canvas_t._plot.graph.ax2.set_position(pos)
                self.plot_canvas_t.setGraphXLabel("Y [" + self.workspace_units_label + "]")
                self.plot_canvas_t.setGraphYLabel("2.35*<X,Z> [$\mu$m]")
                self.plot_canvas_t._plot.graph.ax.set_title("X,Z (Combined)", horizontalalignment='left')
                self.plot_canvas_t.replot()
コード例 #16
0
    def plot_results(self):
        self.plotted_beam = None

        if super().plot_results():
            if self.spectro_plot_canvas is None:
                self.spectro_plot_canvas = PlotWindow.PlotWindow(roi=False, control=False, position=False, plugins=False, logx=False, logy=False)
                self.spectro_plot_canvas.setDefaultPlotLines(True)
                self.spectro_plot_canvas.setDefaultPlotPoints(False)
                self.spectro_plot_canvas.setZoomModeEnabled(True)
                self.spectro_plot_canvas.setMinimumWidth(673)
                self.spectro_plot_canvas.setMaximumWidth(673)
                pos = self.spectro_plot_canvas._plot.graph.ax.get_position()
                self.spectro_plot_canvas._plot.graph.ax.set_position([pos.x0, pos.y0 , pos.width*0.86, pos.height])
                pos = self.spectro_plot_canvas._plot.graph.ax2.get_position()
                self.spectro_plot_canvas._plot.graph.ax2.set_position([pos.x0, pos.y0 , pos.width*0.86, pos.height])
                ax3 = self.spectro_plot_canvas._plot.graph.fig.add_axes([.82, .15, .05, .75])

                self.spectro_image_box.layout().addWidget(self.spectro_plot_canvas)
            else:
                self.spectro_plot_canvas.clear()
                ax3 = self.spectro_plot_canvas._plot.graph.fig.axes[-1]
                ax3.cla()

            number_of_bins = self.spectro_number_of_bins + 1

            x, auto_title, xum = self.get_titles()

            if self.plotted_beam is None: self.plotted_beam = self.input_beam

            xrange  = self.get_range(self.plotted_beam._beam, x)

            min_k = numpy.min(self.plotted_beam._beam.rays[:, 10])
            max_k = numpy.max(self.plotted_beam._beam.rays[:, 10])

            if self.spectro_variable == 0: #Energy
                energy_min = ShadowPhysics.getEnergyFromShadowK(min_k)
                energy_max = ShadowPhysics.getEnergyFromShadowK(max_k)

                bins = energy_min + numpy.arange(0, number_of_bins + 1)*((energy_max-energy_min)/number_of_bins)
                normalization = colors.Normalize(vmin=energy_min, vmax=energy_max)
            else: #wavelength
                wavelength_min = ShadowPhysics.getWavelengthfromShadowK(max_k)
                wavelength_max = ShadowPhysics.getWavelengthfromShadowK(min_k)

                bins = wavelength_min + numpy.arange(0, number_of_bins + 1)*((wavelength_max-wavelength_min)/number_of_bins)
                normalization = colors.Normalize(vmin=wavelength_min, vmax=wavelength_max)

            scalarMap = cmx.ScalarMappable(norm=normalization, cmap=self.color_map)

            cb1 = colorbar.ColorbarBase(ax3,
                                        cmap=self.color_map,
                                        norm=normalization,
                                        orientation='vertical')

            if self.spectro_variable == 0: #Energy
                cb1.set_label('Energy [eV]')
            else:
                cb1.set_label('Wavelength [Å]')

            go = numpy.where(self.plotted_beam._beam.rays[:, 9] == 1)
            lo = numpy.where(self.plotted_beam._beam.rays[:, 9] != 1)

            rays_to_plot = self.plotted_beam._beam.rays

            if self.rays == 1:
                rays_to_plot = self.plotted_beam._beam.rays[go]
            elif self.rays == 2:
                rays_to_plot = self.plotted_beam._beam.rays[lo]

            factor_x = ShadowPlot.get_factor(x, self.workspace_units_to_cm)

            for index in range (0, number_of_bins):
                min_value = bins[index]
                max_value = bins[index+1]

                if index < number_of_bins-1:
                    if self.spectro_variable == 0: #Energy
                        cursor = numpy.where((numpy.round(ShadowPhysics.getEnergyFromShadowK(rays_to_plot[:, 10]), 4) >= numpy.round(min_value, 4)) &
                                             (numpy.round(ShadowPhysics.getEnergyFromShadowK(rays_to_plot[:, 10]), 4) < numpy.round(max_value, 4)))
                    else:
                        cursor = numpy.where((numpy.round(ShadowPhysics.getWavelengthfromShadowK(rays_to_plot[:, 10]), 4) >= numpy.round(min_value, 4)) &
                                             (numpy.round(ShadowPhysics.getWavelengthfromShadowK(rays_to_plot[:, 10]), 4) < numpy.round(max_value, 4)))
                else:
                    if self.spectro_variable == 0: #Energy
                        cursor = numpy.where((numpy.round(ShadowPhysics.getEnergyFromShadowK(rays_to_plot[:, 10]), 4) >= numpy.round(min_value, 4)) &
                                             (numpy.round(ShadowPhysics.getEnergyFromShadowK(rays_to_plot[:, 10]), 4) <= numpy.round(max_value, 4)))
                    else:
                        cursor = numpy.where((numpy.round(ShadowPhysics.getWavelengthfromShadowK(rays_to_plot[:, 10]), 4) >= numpy.round(min_value, 4)) &
                                             (numpy.round(ShadowPhysics.getWavelengthfromShadowK(rays_to_plot[:, 10]), 4) <= numpy.round(max_value, 4)))

                color = scalarMap.to_rgba((bins[index] + bins[index+1])/2)

                if index == 0: self.spectro_plot_canvas.setActiveCurveColor(color=color)

                self.replace_spectro_fig(rays_to_plot[cursor], x, factor_x, xrange,
                                         title=self.title + str(index), color=color)

            self.spectro_plot_canvas.setDrawModeEnabled(True, 'rectangle')
            self.spectro_plot_canvas.setGraphXLimits(xrange[0]*factor_x, xrange[1]*factor_x)
            self.spectro_plot_canvas.setGraphXLabel(auto_title)
            self.spectro_plot_canvas.replot()