Beispiel #1
0
    def __init__(self,
                 parent=None,
                 state=None,
                 settings=None,
                 name="BIOSANS",
                 data_proxy=None):
        super(SANSInstrumentWidget, self).__init__(parent,
                                                   state,
                                                   settings,
                                                   data_proxy=data_proxy)

        class SummaryFrame(QtGui.QFrame, ui.sans.ui_hfir_instrument.Ui_Frame):
            def __init__(self, parent=None):
                QtGui.QFrame.__init__(self, parent)
                self.setupUi(self)

        self._summary = SummaryFrame(self)
        self.initialize_content()
        self._layout.addWidget(self._summary)

        self._masked_detectors = []

        if state is not None:
            self.set_state(state)
        else:
            instr = ReductionOptions()
            instr.instrument_name = name
            self.set_state(instr)

        # General GUI settings
        if settings is None:
            settings = GeneralSettings()
        self._settings = settings
        # Connect do UI data update
        self._settings.data_updated.connect(self._data_updated)
    def __init__(self, parent=None, state=None, settings=None, name="BIOSANS", data_proxy=None):
        super(SANSInstrumentWidget, self).__init__(parent, state, settings, data_proxy=data_proxy)

        class SummaryFrame(QtGui.QFrame, ui.sans.ui_hfir_instrument.Ui_Frame):
            def __init__(self, parent=None):
                QtGui.QFrame.__init__(self, parent)
                self.setupUi(self)

        self._summary = SummaryFrame(self)
        self.initialize_content()
        self._layout.addWidget(self._summary)

        self._masked_detectors = []

        if state is not None:
            self.set_state(state)
        else:
            instr = ReductionOptions()
            instr.instrument_name = name
            self.set_state(instr)

        # General GUI settings
        if settings is None:
            settings = GeneralSettings()
        self._settings = settings
        # Connect do UI data update
        self._settings.data_updated.connect(self._data_updated)
Beispiel #3
0
    def get_state(self):
        """
            Returns an object with the state of the interface
        """
        m = ReductionOptions()

        m.instrument_name = self._summary.instr_name_label.text()

        # Absolute scaling
        m.scaling_factor = util._check_and_get_float_line_edit(
            self._summary.scale_edit)
        m.calculate_scale = self._summary.scale_chk.isChecked()
        m.scaling_direct_file = unicode(self._summary.scale_data_edit.text())
        m.scaling_att_trans = util._check_and_get_float_line_edit(
            self._summary.scale_att_trans_edit)
        m.scaling_beam_diam = util._check_and_get_float_line_edit(
            self._summary.scale_beam_radius_edit, min=0.0)
        m.manual_beam_diam = self._summary.beamstop_chk.isChecked()

        # Detector offset input
        if self._summary.detector_offset_chk.isChecked():
            m.detector_offset = util._check_and_get_float_line_edit(
                self._summary.detector_offset_edit)

        # Sample-detector distance
        if self._summary.sample_dist_chk.isChecked():
            m.sample_detector_distance = util._check_and_get_float_line_edit(
                self._summary.sample_dist_edit)

        # Wavelength value
        wavelength = util._check_and_get_float_line_edit(
            self._summary.wavelength_edit, min=0.0)
        if self._summary.wavelength_chk.isChecked():
            m.wavelength = wavelength
            m.wavelength_spread = util._check_and_get_float_line_edit(
                self._summary.wavelength_spread_edit)

        # Solid angle correction
        m.solid_angle_corr = self._summary.solid_angle_chk.isChecked()

        # Dark current
        m.dark_current_corr = self._summary.dark_current_check.isChecked()
        m.dark_current_data = unicode(self._summary.dark_file_edit.text())

        # Normalization
        if self._summary.normalization_none_radio.isChecked():
            m.normalization = m.NORMALIZATION_NONE
        elif self._summary.normalization_time_radio.isChecked():
            m.normalization = m.NORMALIZATION_TIME
        elif self._summary.normalization_monitor_radio.isChecked():
            m.normalization = m.NORMALIZATION_MONITOR

        # Q range
        m.n_q_bins = util._check_and_get_int_line_edit(
            self._summary.n_q_bins_edit)
        m.n_sub_pix = util._check_and_get_int_line_edit(
            self._summary.n_sub_pix_edit)
        m.log_binning = self._summary.log_binning_radio.isChecked()
        m.align_log_with_decades = self._summary.align_check.isChecked()

        m.n_wedges = util._check_and_get_int_line_edit(
            self._summary.n_wedges_edit)
        m.wedge_angle = util._check_and_get_float_line_edit(
            self._summary.wedge_angle_edit)
        m.wedge_offset = util._check_and_get_float_line_edit(
            self._summary.wedge_offset_edit)

        # Detector side masking
        if self._summary.mask_side_front_radio.isChecked():
            m.masked_side = 'Front'
        elif self._summary.mask_side_back_radio.isChecked():
            m.masked_side = 'Back'
        else:
            m.masked_side = None

        # Mask detector IDs
        m.use_mask_file = self._summary.mask_check.isChecked()
        m.mask_file = unicode(self._summary.mask_edit.text())
        m.detector_ids = self._masked_detectors
        if self._in_mantidplot:
            from mantid.api import AnalysisDataService
            import mantid.simpleapi as api
            if AnalysisDataService.doesExist(self.mask_ws):
                ws, masked_detectors = api.ExtractMask(
                    InputWorkspace=self.mask_ws,
                    OutputWorkspace="__edited_mask")
                m.detector_ids = [int(i) for i in masked_detectors]

        self._settings.emit_key_value("DARK_CURRENT",
                                      str(self._summary.dark_file_edit.text()))
        return m
    def get_state(self):
        """
            Returns an object with the state of the interface
        """

        m = ReductionOptions()

        m.instrument_name = self._summary.instr_name_label.text()

        # Absolute scaling
        m.scaling_factor = util._check_and_get_float_line_edit(self._summary.scale_edit)
        m.calculate_scale = self._summary.scale_chk.isChecked()
        m.scaling_direct_file = unicode(self._summary.scale_data_edit.text())
        m.scaling_att_trans = util._check_and_get_float_line_edit(self._summary.scale_att_trans_edit)
        m.scaling_beam_diam = util._check_and_get_float_line_edit(self._summary.scale_beam_radius_edit, min=0.0)
        m.manual_beam_diam = self._summary.beamstop_chk.isChecked()

#         ## If total detector distance is checked, ignore the other 3 distances:
#         if self._summary.total_detector_distance_chk.isChecked():
#             m.sample_total_distance = util._check_and_get_float_line_edit(self._summary.total_detector_distance_edit)
#         else:
#             # Detector offset input
#             if self._summary.detector_offset_chk.isChecked():
#                 m.detector_offset = util._check_and_get_float_line_edit(self._summary.detector_offset_edit)
#             # Sample-detector distance
#             if self._summary.sample_dist_chk.isChecked():
#                 m.sample_detector_distance = util._check_and_get_float_line_edit(self._summary.sample_dist_edit)
#             # Sample-Si-window
#             if self._summary.sample_si_dist_chk.isChecked():
#                 m.sample_si_window_distance = util._check_and_get_float_line_edit(self._summary.sample_si_dist_edit)

        # Workaround:
        # Offset is not used
        # The detector_distanc will be used as sample_total_distance
        m.sample_detector_distance = util._check_and_get_float_line_edit(self._summary.total_detector_distance_edit)
        m.detector_offset = 0

        # Wavelength value
        wavelength = util._check_and_get_float_line_edit(self._summary.wavelength_edit, min=0.0)
        if self._summary.wavelength_chk.isChecked():
            m.wavelength = wavelength
            m.wavelength_spread = util._check_and_get_float_line_edit(self._summary.wavelength_spread_edit)

        # Solid angle correction
        m.solid_angle_corr = self._summary.solid_angle_chk.isChecked()

        # Dark current
        m.dark_current_corr = self._summary.dark_current_check.isChecked()
        m.dark_current_data = unicode(self._summary.dark_file_edit.text())

        # Normalization
        if self._summary.normalization_none_radio.isChecked():
            m.normalization = m.NORMALIZATION_NONE
        elif self._summary.normalization_time_radio.isChecked():
            m.normalization = m.NORMALIZATION_TIME
        elif self._summary.normalization_monitor_radio.isChecked():
            m.normalization = m.NORMALIZATION_MONITOR

        # Q range
        m.n_q_bins = util._check_and_get_int_line_edit(self._summary.n_q_bins_edit)
        m.n_sub_pix = util._check_and_get_int_line_edit(self._summary.n_sub_pix_edit)
        m.log_binning = self._summary.log_binning_radio.isChecked()
        m.align_log_with_decades = self._summary.align_check.isChecked()
        m.error_weighting = self._summary.error_weighting_check.isChecked()

        m.n_wedges = util._check_and_get_int_line_edit(self._summary.n_wedges_edit)
        m.wedge_angle = util._check_and_get_float_line_edit(self._summary.wedge_angle_edit)
        m.wedge_offset = util._check_and_get_float_line_edit(self._summary.wedge_offset_edit)

        # Detector side masking
        if self._summary.mask_side_front_radio.isChecked():
            m.masked_side = 'Front'
        elif self._summary.mask_side_back_radio.isChecked():
            m.masked_side = 'Back'
        else:
            m.masked_side = None

        # Mask detector IDs
        m.use_mask_file = self._summary.mask_check.isChecked()
        m.mask_file = unicode(self._summary.mask_edit.text())
        m.detector_ids = self._masked_detectors
        if self._in_mantidplot:
            from mantid.api import AnalysisDataService
            import mantid.simpleapi as api
            if AnalysisDataService.doesExist(self.mask_ws):
                _, masked_detectors = api.ExtractMask(InputWorkspace=self.mask_ws, OutputWorkspace="__edited_mask")
                m.detector_ids = [int(i) for i in masked_detectors]

        self._settings.emit_key_value("DARK_CURRENT", str(self._summary.dark_file_edit.text()))
        return m
Beispiel #5
0
    def get_state(self):
        """
            Returns an object with the state of the interface
        """
        m = ReductionOptions()

        m.instrument_name = self._summary.instr_name_label.text()

        # Absolute scaling
        m.scaling_factor = util._check_and_get_float_line_edit(self._summary.scale_edit)
        m.calculate_scale = self._summary.scale_chk.isChecked()
        m.scaling_direct_file = unicode(self._summary.scale_data_edit.text())
        m.scaling_att_trans = util._check_and_get_float_line_edit(self._summary.scale_att_trans_edit)
        m.scaling_beam_diam = util._check_and_get_float_line_edit(self._summary.scale_beam_radius_edit, min=0.0)
        m.manual_beam_diam = self._summary.beamstop_chk.isChecked()

        # Detector offset input
        if self._summary.detector_offset_chk.isChecked():
            m.detector_offset = util._check_and_get_float_line_edit(self._summary.detector_offset_edit)

        # Sample-detector distance
        if self._summary.sample_dist_chk.isChecked():
            m.sample_detector_distance = util._check_and_get_float_line_edit(self._summary.sample_dist_edit)

        # Wavelength value
        wavelength = util._check_and_get_float_line_edit(self._summary.wavelength_edit, min=0.0)
        if self._summary.wavelength_chk.isChecked():
            m.wavelength = wavelength
            m.wavelength_spread = util._check_and_get_float_line_edit(self._summary.wavelength_spread_edit)

        # Solid angle correction
        m.solid_angle_corr = self._summary.solid_angle_chk.isChecked()

        # Dark current
        m.dark_current_corr = self._summary.dark_current_check.isChecked()
        m.dark_current_data = unicode(self._summary.dark_file_edit.text())

        # Normalization
        if self._summary.normalization_none_radio.isChecked():
            m.normalization = m.NORMALIZATION_NONE
        elif self._summary.normalization_time_radio.isChecked():
            m.normalization = m.NORMALIZATION_TIME
        elif self._summary.normalization_monitor_radio.isChecked():
            m.normalization = m.NORMALIZATION_MONITOR

        # Q range
        m.n_q_bins = util._check_and_get_int_line_edit(self._summary.n_q_bins_edit)
        m.n_sub_pix = util._check_and_get_int_line_edit(self._summary.n_sub_pix_edit)
        m.log_binning = self._summary.log_binning_radio.isChecked()

        # Mask detector IDs
        m.use_mask_file = self._summary.mask_check.isChecked()
        m.mask_file = unicode(self._summary.mask_edit.text())
        m.detector_ids = self._masked_detectors
        if self._in_mantidplot:
            from mantid.api import AnalysisDataService
            import mantid.simpleapi as api
            if AnalysisDataService.doesExist(self.mask_ws):
                ws, masked_detectors = api.ExtractMask(InputWorkspace=self.mask_ws, OutputWorkspace="__edited_mask")
                m.detector_ids = [int(i) for i in masked_detectors]

        self._settings.emit_key_value("DARK_CURRENT", str(self._summary.dark_file_edit.text()))
        return m
Beispiel #6
0
 def get_state(self):
     """
         Returns an object with the state of the interface
     """
     m = ReductionOptions()
     
     m.instrument_name = self._summary.instr_name_label.text()
     
     # Absolute scaling
     m.scaling_factor = util._check_and_get_float_line_edit(self._summary.scale_edit)
     m.calculate_scale = self._summary.scale_chk.isChecked()
     m.scaling_direct_file = unicode(self._summary.scale_data_edit.text())
     m.scaling_att_trans = util._check_and_get_float_line_edit(self._summary.scale_att_trans_edit)
     m.scaling_beam_diam = util._check_and_get_float_line_edit(self._summary.scale_beam_radius_edit, min=0.0)
     m.manual_beam_diam = self._summary.beamstop_chk.isChecked()
     
     # Detector offset input
     if self._summary.detector_offset_chk.isChecked():
         m.detector_offset = util._check_and_get_float_line_edit(self._summary.detector_offset_edit)
         
     # Sample-detector distance
     if self._summary.sample_dist_chk.isChecked():
         m.sample_detector_distance = util._check_and_get_float_line_edit(self._summary.sample_dist_edit)
         
     # Wavelength value
     wavelength = util._check_and_get_float_line_edit(self._summary.wavelength_edit, min=0.0)
     if self._summary.wavelength_chk.isChecked():
         m.wavelength = wavelength
         m.wavelength_spread = util._check_and_get_float_line_edit(self._summary.wavelength_spread_edit)
         
     # Solid angle correction
     m.solid_angle_corr = self._summary.solid_angle_chk.isChecked()
     
     # Dark current
     m.dark_current_corr = self._summary.dark_current_check.isChecked()
     m.dark_current_data = unicode(self._summary.dark_file_edit.text())
     
     # Normalization
     if self._summary.normalization_none_radio.isChecked():
         m.normalization = m.NORMALIZATION_NONE
     elif self._summary.normalization_time_radio.isChecked():
         m.normalization = m.NORMALIZATION_TIME
     elif self._summary.normalization_monitor_radio.isChecked():
         m.normalization = m.NORMALIZATION_MONITOR
         
     # Q range
     m.n_q_bins = util._check_and_get_int_line_edit(self._summary.n_q_bins_edit)
     m.n_sub_pix = util._check_and_get_int_line_edit(self._summary.n_sub_pix_edit)
     m.log_binning = self._summary.log_binning_radio.isChecked()
     
     # Mask detector IDs
     m.use_mask_file = self._summary.mask_check.isChecked()
     m.mask_file = unicode(self._summary.mask_edit.text())
     m.detector_ids = self._masked_detectors
     if self._in_mantidplot:
         if mtd.workspaceExists(self.mask_ws):
             masked_detectors = GetMaskedDetectors(self.mask_ws)
             ids_str = masked_detectors.getPropertyValue("DetectorList")
             m.detector_ids = map(int, ids_str.split(','))
     
     return m