Exemplo n.º 1
0
    def _setup_instrument_specific_settings(self):
        # Get the first run number of the scatter data for the first table
        sample_scatter = self._view.get_cell(row=0, column=0, convert_to=str)

        # Check if it exists at all
        if not sample_scatter:
            return

        # Get the file information from
        file_information_factory = SANSFileInformationFactory()
        try:
            self._file_information = file_information_factory.create_sans_file_information(
                sample_scatter)
        except NotImplementedError:
            self.sans_logger.warning(
                "Could not get file information from {}.".format(
                    sample_scatter))
            self._file_information = None

        # Provide the instrument specific settings
        if self._file_information:
            # Set the instrument on the table
            instrument = self._file_information.get_instrument()
            self._view.set_instrument_settings(instrument)

            # Set the reduction mode
            reduction_mode_list = get_reduction_mode_strings_for_gui(
                instrument=instrument)
            self._view.set_reduction_modes(reduction_mode_list)
        else:
            self._view.set_instrument_settings(SANSInstrument.NoInstrument)
            reduction_mode_list = get_reduction_mode_strings_for_gui()
            self._view.set_reduction_modes(reduction_mode_list)
Exemplo n.º 2
0
    def test_that_gets_reduction_mode_string_for_gui(self):
        sans_settings = get_reduction_mode_strings_for_gui(SANSInstrument.SANS2D)
        self._assert_same(sans_settings, ["rear", "front", "Merged", "All"])

        loq_settings = get_reduction_mode_strings_for_gui(SANSInstrument.LOQ)
        self._assert_same(loq_settings, ["main-detector", "Hab", "Merged", "All"])

        larmor_settings = get_reduction_mode_strings_for_gui(SANSInstrument.LARMOR)
        self._assert_same(larmor_settings, ["DetectorBench"])

        default_settings = get_reduction_mode_strings_for_gui(SANSInstrument.NoInstrument)
        self._assert_same(default_settings, ["LAB", "HAB", "Merged", "All"])
Exemplo n.º 3
0
    def test_that_gets_reduction_mode_string_for_gui(self):
        sans_settings = get_reduction_mode_strings_for_gui(SANSInstrument.SANS2D)
        self._assert_same(sans_settings, ["rear", "front", "Merged", "All"])

        loq_settings = get_reduction_mode_strings_for_gui(SANSInstrument.LOQ)
        self._assert_same(loq_settings, ["main-detector", "Hab", "Merged", "All"])

        larmor_settings = get_reduction_mode_strings_for_gui(SANSInstrument.LARMOR)
        self._assert_same(larmor_settings, ["DetectorBench"])

        default_settings = get_reduction_mode_strings_for_gui(SANSInstrument.NoInstrument)
        self._assert_same(default_settings, ["LAB", "HAB", "Merged", "All"])
Exemplo n.º 4
0
    def _default_gui_setup(self):
        """
        Provides a default setup of the GUI. This is important for the initial start up, when the view is being set.
        """
        # Set the possible reduction modes
        reduction_mode_list = get_reduction_mode_strings_for_gui()
        self._view.set_reduction_modes(reduction_mode_list)

        # Set the possible instruments
        instrument_list = get_instrument_strings_for_gui()
        self._view.set_instruments(instrument_list)

        # Set the step type options for wavelength
        range_step_types = [
            RangeStepType.to_string(RangeStepType.Lin),
            RangeStepType.to_string(RangeStepType.Log),
            RangeStepType.to_string(RangeStepType.RangeLog),
            RangeStepType.to_string(RangeStepType.RangeLin)
        ]
        self._view.wavelength_step_type = range_step_types

        # Set the geometry options. This needs to include the option to read the sample shape from file.
        sample_shape = [
            "Read from file", SampleShape.Cylinder, SampleShape.FlatPlate,
            SampleShape.Disc
        ]
        self._view.sample_shape = sample_shape

        # Set the q range
        self._view.q_1d_step_type = [
            RangeStepType.to_string(RangeStepType.Lin),
            RangeStepType.to_string(RangeStepType.Log)
        ]
        self._view.q_xy_step_type = [
            RangeStepType.to_string(RangeStepType.Lin)
        ]

        # Set the fit options
        fit_types = [
            FitType.to_string(FitType.Linear),
            FitType.to_string(FitType.Logarithmic),
            FitType.to_string(FitType.Polynomial)
        ]
        self._view.transmission_sample_fit_type = fit_types
        self._view.transmission_can_fit_type = fit_types