Beispiel #1
0
    def update_label(self):

        plot_data = self.plot_item.get_plot_data()

        if plot_data == None:
            intensity = 0

        elif np.isnan(plot_data.data).all():
            intensity = np.nan

        else:
            cut = self.model.cut_from_data(plot_data, region='center')

            # Normalize by dividing by the number of non nan elements
            if config.get_key('crosshair', 'normalized_intensity') == 'True':
                intensity = normalize(cut.data)

            else:
                intensity = np.nansum(cut.data)

        if abs(intensity) > 1000:
            self.point_value_label.setText('%.2fk' % (intensity / 1000))

        else:
            self.point_value_label.setText('%.2f' % intensity)

        x = self.model.x
        y = self.model.y

        self.distance_value_label.setText('%.2f' % np.sqrt(x**2 + y**2))
Beispiel #2
0
    def plot(self,
             data,
             title,
             crosshair,
             region,
             phi_sample=720,
             line_sample=500,
             normalized=False):

        index = len(self.plot_item.listDataItems())
        colors = config.get_key('profile_plot', 'colors')
        color = colors.split(',')[index % len(colors)]
        line_width = int(config.get_key('profile_plot', 'line_width'))
        symbols = config.get_key('profile_plot', 'symbols')
        symbol = symbols.split(',')[index % len(symbols)]
        symbol_size = int(config.get_key('profile_plot', 'symbol_size'))

        if isinstance(data, PlotData):
            x, y = self.model.get_plot_data(data, crosshair, region,
                                            phi_sample, line_sample)
        else:
            data, axis = data
            x = np.array(data.axes[axis].axis)
            y = []
            for i in range(len(x)):
                slice_ = data.slice_from_index(i, axis=axis)
                plot_data = crosshair.cut_from_data(slice_, region=region).data

                if np.isnan(plot_data).all():
                    y.append(np.nan)

                else:
                    if config.get_key('crosshair',
                                      'normalized_intensity') == 'True':
                        y.append(normalize(plot_data))

                    else:
                        y.append(np.nansum(plot_data))

            y = np.array(y)

        x = x[~np.isnan(y)]
        y = y[~np.isnan(y)]

        if normalized:
            y = y / max(y)

        self.plot_item.plot(x,
                            y,
                            name=title + self.title_suffixes[region],
                            pen=mkPen(color, width=line_width),
                            symbol=symbol,
                            symbolPen=mkPen(color, width=symbol_size),
                            symbolBrush=mkBrush(color))
Beispiel #3
0
    def update_label(self):

        plot_data = self.plot_item.get_plot_data()

        super().update_label()

        if plot_data == None:
            intensity = 0

        else:
            cut = self.model.cut_from_data(plot_data, region='ring')

            # Normalize by dividing by the number of non nan elements
            if config.get_key('crosshair', 'normalized_intensity') == 'True':
                intensity = normalize(cut.data)

            else:
                intensity = np.nansum(cut.data)

        if abs(intensity) > 1000:
            self.ring_value_label.setText('%.2fk' % (intensity / 1000))

        else:
            self.ring_value_label.setText('%.2f' % intensity)