Beispiel #1
0
    def do_plot_3d(self):
        """

        :return:
        """
        # color: get R, G, B
        status, rgb_values = guiutility.parse_float_editors([self.ui.lineEdit_baseColorRed,
                                                             self.ui.lineEdit_baseColorGreen,
                                                             self.ui.lineEdit_baseColorBlue])
        assert status

        # set the color to get change
        change_r = self.ui.checkBox_changeRed.isChecked()
        change_g = self.ui.checkBox_changeGreen.isChecked()
        change_b = self.ui.checkBox_changeBlue.isChecked()

        # get threshold
        status, thresholds = guiutility.parse_integers_editors([self.ui.lineEdit_countsThresholdLower,
                                                                self.ui.lineEdit_countsThresholdUpper],
                                                               allow_blank=True)
        assert status, thresholds
        if thresholds[0] is None:
            thresholds[0] = 0
        if thresholds[1] is None:
            thresholds[1] = sys.maxsize
        assert 0 <= thresholds[0] < thresholds[1]

        # data key
        data_key = int(self.ui.comboBox_dataKey.currentText())

        # plot
        self.plot_3d(data_key, rgb_values, thresholds, [change_r, change_g, change_b])

        return
Beispiel #2
0
    def do_plot_3d(self):
        """

        :return:
        """
        # color: get R, G, B
        status, rgb_values = guiutility.parse_float_editors([self.ui.lineEdit_baseColorRed,
                                                             self.ui.lineEdit_baseColorGreen,
                                                             self.ui.lineEdit_baseColorBlue])
        assert status

        # set the color to get change
        change_r = self.ui.checkBox_changeRed.isChecked()
        change_g = self.ui.checkBox_changeGreen.isChecked()
        change_b = self.ui.checkBox_changeBlue.isChecked()

        # get threshold
        status, thresholds = guiutility.parse_integers_editors([self.ui.lineEdit_countsThresholdLower,
                                                                self.ui.lineEdit_countsThresholdUpper],
                                                               allow_blank=True)
        assert status, thresholds
        if thresholds[0] is None:
            thresholds[0] = 0
        if thresholds[1] is None:
            thresholds[1] = sys.maxsize
        assert 0 <= thresholds[0] < thresholds[1]

        # data key
        data_key = int(self.ui.comboBox_dataKey.currentText())

        # plot
        self.plot_3d(data_key, rgb_values, thresholds, [change_r, change_g, change_b])

        return
Beispiel #3
0
    def set_calibration_to_reduction_controller(self, exp_number):
        """set user-specified instrument calibrations to the my controller
        :param exp_number:
        :return:
        """
        # set up the experiment number if it is different
        if exp_number != self._myController.get_experiment():
            self._myController.set_exp_number(exp_number)
            self._myController.set_default_detector_sample_distance(0.3750)
            self._myController.set_default_pixel_number(256, 256)

        # set up the calibration
        # wave length
        user_wavelength_str = str(
            self.ui.lineEdit_infoWavelength.text()).strip()
        if len(user_wavelength_str) > 0:
            try:
                user_wavelength = float(user_wavelength_str)
                self._myController.set_user_wave_length(
                    exp_number, user_wavelength)
            except ValueError:
                gui_util.show_message(
                    self,
                    '[ERROR] User-specified wave length {0} cannot be converted to float.'
                    ''.format(user_wavelength_str))
                return
        # END-IF

        # detector center
        user_det_center_str = str(
            self.ui.lineEdit_infoDetCenter.text()).strip()
        user_det_center_str = user_det_center_str.replace('x', ',')
        if len(user_det_center_str) > 0:
            try:
                det_center = gui_util.parse_integer_list(
                    user_det_center_str, 2)
            except RuntimeError as run_err:
                gui_util.show_message(
                    self, 'Unable to parse detector center {0} due to {1}'
                    ''.format(user_det_center_str, run_err))
                return
            self._myController.set_detector_center(exp_number, det_center[0],
                                                   det_center[1])
        # END-IF

        # detector sample distance
        status, ret_obj = gui_util.parse_float_editors(
            [self.ui.lineEdit_infoDetSampleDistance], allow_blank=True)

        if not status:
            error_message = ret_obj
            gui_util.show_message(self, '[ERROR] {0}'.format(error_message))
            return
        user_det_sample_distance = ret_obj[0]
        if user_det_sample_distance is not None:
            self._myController.set_detector_sample_distance(
                exp_number, user_det_sample_distance)

        # detector size
        curr_det_size_index = self.ui.comboBox_detSize.currentIndex()
        if curr_det_size_index > 2:
            gui_util.show_message(
                self, 'Detector {0} is not supported by now!'
                ''.format(str(self.ui.comboBox_detSize.currentText())))
            return
        det_size = [256, 512][curr_det_size_index]
        self._myController.set_detector_geometry(det_size, det_size)