Esempio n. 1
0
    def update_selection_plot(self):
        self.parent.ui.profile.clear()
        o_get = Get(parent=self.parent)
        x_axis, x_axis_label = o_get.x_axis()
        max_value = self.parent.ui.profile_of_bin_size_slider.maximum()
        roi_selected = max_value - self.parent.ui.profile_of_bin_size_slider.value(
        )

        y_axis = self.parent.fitting_input_dictionary['rois'][roi_selected][
            'profile']

        self.parent.ui.profile.plot(x_axis,
                                    y_axis,
                                    pen=(self.parent.shrinking_roi_rgb[0],
                                         self.parent.shrinking_roi_rgb[1],
                                         self.parent.shrinking_roi_rgb[2]))
        self.parent.ui.profile.setLabel("bottom", x_axis_label)
        self.parent.ui.profile.setLabel("left", 'Mean transmission')

        # full region
        y_axis = self.parent.fitting_input_dictionary['rois'][0]['profile']
        self.parent.ui.profile.plot(x_axis,
                                    y_axis,
                                    pen=(self.parent.selection_roi_rgb[0],
                                         self.parent.selection_roi_rgb[1],
                                         self.parent.selection_roi_rgb[2]))
Esempio n. 2
0
    def bragg_edge_range_changed(self):
        [left_range, right_range] = list(self.bragg_edge_range_ui.getRegion())
        o_get = Get(parent=self)
        x_axis, _ = o_get.x_axis()

        left_index = find_nearest_index(array=x_axis, value=left_range)
        right_index = find_nearest_index(array=x_axis, value=right_range)

        self.bragg_edge_range = [left_index, right_index]
Esempio n. 3
0
    def update_selection_profile_plot(self):

        if self.parent.is_file_imported:
            self.update_selection_plot()
            self.parent.update_vertical_line_in_profile_plot()

        else:
            o_get = Get(parent=self.parent)
            x_axis, x_axis_label = o_get.x_axis()
            self.parent.ui.profile.clear()

            # large selection region
            [x0, y0, x1, y1, _, _] = o_get.selection_roi_dimension()
            profile = o_get.profile_of_roi(x0, y0, x1, y1)
            x_axis, y_axis = check_size(x_axis=x_axis, y_axis=profile)
            self.parent.ui.profile.plot(x_axis,
                                        y_axis,
                                        pen=(self.parent.selection_roi_rgb[0],
                                             self.parent.selection_roi_rgb[1],
                                             self.parent.selection_roi_rgb[2]))

            # shrinkable region
            shrinking_roi = self.get_coordinates_of_new_inside_selection_box()
            x0 = shrinking_roi['x0']
            y0 = shrinking_roi['y0']
            x1 = shrinking_roi['x1']
            y1 = shrinking_roi['y1']
            profile = o_get.profile_of_roi(x0, y0, x1, y1)
            x_axis, y_axis = check_size(x_axis=x_axis, y_axis=profile)
            self.parent.ui.profile.plot(x_axis,
                                        y_axis,
                                        pen=(self.parent.shrinking_roi_rgb[0],
                                             self.parent.shrinking_roi_rgb[1],
                                             self.parent.shrinking_roi_rgb[2]))
            self.parent.ui.profile.setLabel("bottom", x_axis_label)
            self.parent.ui.profile.setLabel("left", 'Mean transmission')

            # vertical line showing peak to fit
            bragg_edge_range = [
                x_axis[self.parent.bragg_edge_range[0]],
                x_axis[self.parent.bragg_edge_range[1]]
            ]

            self.parent.bragg_edge_range_ui = pg.LinearRegionItem(
                values=bragg_edge_range,
                orientation=None,
                brush=None,
                movable=True,
                bounds=None)
            self.parent.bragg_edge_range_ui.sigRegionChanged.connect(
                self.parent.bragg_edge_range_changed)
            self.parent.bragg_edge_range_ui.setZValue(-10)
            self.parent.ui.profile.addItem(self.parent.bragg_edge_range_ui)
Esempio n. 4
0
    def update_vertical_line_in_profile_plot(self):
        o_get = Get(parent=self)
        x_axis, x_axis_label = o_get.x_axis()

        bragg_edge_range = [x_axis[self.bragg_edge_range[0]],
                            x_axis[self.bragg_edge_range[1]]]

        if self.bragg_edge_range_ui:
            self.ui.profile.removeItem(self.bragg_edge_range_ui)
        self.bragg_edge_range_ui = pg.LinearRegionItem(values=bragg_edge_range,
                                                       orientation=None,
                                                       brush=None,
                                                       movable=True,
                                                       bounds=None)
        self.bragg_edge_range_ui.sigRegionChanged.connect(self.bragg_edge_range_changed)
        self.bragg_edge_range_ui.setZValue(-10)
        self.ui.profile.addItem(self.bragg_edge_range_ui)