Exemplo n.º 1
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        self.main_box = gui.widgetBox(self.controlArea,
                                      self.get_parameter_name(),
                                      orientation="vertical",
                                      width=self.CONTROL_AREA_WIDTH - 10,
                                      height=self.get_height())

        self.button_box = gui.widgetBox(self.main_box,
                                        "",
                                        orientation="horizontal",
                                        width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(self.button_box,
                   self,
                   "Send " + self.get_parameter_name(),
                   height=40,
                   callback=self.send_parameter)

        self.build_main_box()

        orangegui.separator(self.main_box)

        self.parameter_tabs = gui.tabWidget(self.main_box)
        self.parameter_box_array = []

        self.build_parameter_box_array()

        runaction = OWAction("Send " + self.get_parameter_name(), self)
        runaction.triggered.connect(self.send_parameter)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
    def __init__(self):
        super().__init__(show_automatic_box=True)
        
        line_profiles_box = gui.widgetBox(self.controlArea,
                                 "Line Profiles", orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10, height=600)


        button_box = gui.widgetBox(line_profiles_box,
                                   "", orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH-25)

        gui.button(button_box, self, "Send Line Profiles", height=40, callback=self.send_line_profiles)

        self.line_profiles_tabs = gui.tabWidget(line_profiles_box)
        self.line_profiles_box_array = []

        for index in range(len(self.reflections_of_phases)):
            line_profiles_tab = gui.createTabPage(self.line_profiles_tabs, DiffractionPattern.get_default_name(index))

            line_profiles_box = LineProfileBox(widget=self,
                                               parent=line_profiles_tab,
                                               diffraction_pattern_index = index,
                                               reflections_of_phases = self.reflections_of_phases[index],
                                               limits                = self.limits[index],
                                               limit_types           = self.limit_types[index])

            self.line_profiles_box_array.append(line_profiles_box)

        runaction = OWAction("Send Line Profiles", self)
        runaction.triggered.connect(self.send_line_profiles)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
Exemplo n.º 3
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Phases",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 5,
                                 height=self.get_height())

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Send Phases",
                   height=50,
                   callback=self.send_phases)

        tabs_button_box = gui.widgetBox(main_box,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        btns = [
            gui.button(tabs_button_box,
                       self,
                       "Insert Phase Before",
                       callback=self.insert_before),
            gui.button(tabs_button_box,
                       self,
                       "Insert Phase After",
                       callback=self.insert_after),
            gui.button(tabs_button_box,
                       self,
                       "Remove Phase",
                       callback=self.remove)
        ]

        for btn in btns:
            btn.setFixedHeight(35)

        self.phases_tabs = gui.tabWidget(main_box)
        self.phases_box_array = []

        for index in range(len(self.a)):
            phase_tab = gui.createTabPage(self.phases_tabs,
                                          "Phase " + str(index + 1))

            phase_box = self.get_phase_box_instance(index, phase_tab)

            self.phases_box_array.append(phase_box)

        runaction = OWAction("Send Phases", self)
        runaction.triggered.connect(self.send_phases)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
    def __init__(self):
        super().__init__(show_automatic_box=True)

        self.setFixedHeight(310)

        main_box = gui.widgetBox(self.controlArea,
                                 "Fit Initialization",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=210)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Send Fit Initialization",
                   height=40,
                   callback=self.send_fit_initialization)

        fft_box = gui.widgetBox(main_box,
                                "FFT",
                                orientation="vertical",
                                width=self.CONTROL_AREA_WIDTH - 30)

        gui.lineEdit(fft_box,
                     self,
                     "s_max",
                     "S_max [nm-1]",
                     labelWidth=250,
                     valueType=float,
                     validator=QDoubleValidator())

        self.cb_n_step = orangegui.comboBox(
            fft_box,
            self,
            "n_step",
            label="FFT Steps",
            labelWidth=350,
            items=["1024", "2048", "4096", "8192", "16384", "32768", "65536"],
            sendSelectedValue=True,
            orientation="horizontal")
        orangegui.comboBox(fft_box,
                           self,
                           "fft_type",
                           label="FFT Type",
                           items=FFTTypes.tuple(),
                           orientation="horizontal")

        orangegui.rubber(self.controlArea)

        runaction = OWAction("Send Fit Initialization", self)
        runaction.triggered.connect(self.send_fit_initialization)
        self.addAction(runaction)
Exemplo n.º 5
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=500)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Send Free Input Parameters",
                   height=40,
                   callback=self.send_free_input_parameters)

        tabs = gui.tabWidget(main_box)
        tab_free_in = gui.createTabPage(tabs, "Free Input Parameters")

        self.scrollarea_free_in = QScrollArea(tab_free_in)
        self.scrollarea_free_in.setMinimumWidth(self.CONTROL_AREA_WIDTH - 45)
        self.scrollarea_free_in.setMinimumHeight(160)

        self.text_area_free_in = gui.textArea(height=400,
                                              width=self.CONTROL_AREA_WIDTH -
                                              65,
                                              readOnly=False)
        self.text_area_free_in.setText(self.free_input_parameters)

        self.scrollarea_free_in.setWidget(self.text_area_free_in)
        self.scrollarea_free_in.setWidgetResizable(1)

        tab_free_in.layout().addWidget(self.scrollarea_free_in,
                                       alignment=Qt.AlignHCenter)

        runaction = OWAction("Send Free Input Parameters", self)
        runaction.triggered.connect(self.send_free_input_parameters)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
    def __init__(self):
        super().__init__(show_automatic_box=True)

        self.setFixedHeight(410)

        main_box = gui.widgetBox(self.controlArea,
                                 "Line Profiles",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=300)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Debye-Waller Parameters",
                   height=40,
                   callback=self.send_debye_waller)

        orangegui.comboBox(main_box,
                           self,
                           "use_single_parameter_set",
                           label="Use single set of Parameters",
                           labelWidth=350,
                           orientation="horizontal",
                           items=["No", "Yes"],
                           callback=self.set_use_single_parameter_set,
                           sendSelectedValue=False)

        orangegui.separator(main_box)

        self.debye_wallers_tabs = gui.tabWidget(main_box)

        self.set_use_single_parameter_set(on_init=True)

        runaction = OWAction("Send Debye-Waller Parameters", self)
        runaction.triggered.connect(self.send_debye_waller)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
Exemplo n.º 7
0
    def __init__(self, show_automatic_box=True):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()

        if self.want_main_area:
            max_width = self.MAX_WIDTH_MAIN
            self.CONTROL_AREA_WIDTH = self.CONTROL_AREA_WIDTH_MAIN
        else:
            max_width = self.MAX_WIDTH_NO_MAIN
            self.CONTROL_AREA_WIDTH = self.CONTROL_AREA_WIDTH_NO_MAIN

        self.setGeometry(
            QRect(round(geom.width() * 0.01), round(geom.height() * 0.01),
                  round(min(geom.width() * 0.95, max_width)),
                  round(min(geom.height() * 0.95, self.get_max_height()))))

        self.setMinimumWidth(self.geometry().width() / 2)
        self.setMinimumHeight(self.geometry().height() / 2)
        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        self.general_options_box = gui.widgetBox(self.controlArea,
                                                 "General Options",
                                                 addSpace=True,
                                                 orientation="horizontal")

        if show_automatic_box:
            orangegui.checkBox(self.general_options_box, self,
                               'is_automatic_run', 'Automatic')

        gui.button(self.general_options_box,
                   self,
                   "Reset Fields",
                   callback=self.callResetSettings)
        gui.button(self.general_options_box,
                   self,
                   "Show Available Parameters",
                   callback=self.show_available_parameters)
    def __init__(self,
                 widget=None,
                 widget_container=None,
                 parent=None,
                 diffraction_pattern_index = 0,
                 phase_index = 0,
                 reflections_of_phase = "",
                 limit                = 0.0,
                 limit_type           = 0):
        super(ReflectionsOfPhaseBox, self).__init__()

        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)
        self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 55)
        self.setFixedHeight(430)

        self.widget = widget
        self.diffraction_pattern_index = diffraction_pattern_index
        self.phase_index = phase_index
        
        self.reflections_of_phase = reflections_of_phase
        self.limit                = limit
        self.limit_type           = limit_type

        self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH-65

        parent.layout().addWidget(self)
        container = self

        gen_box = gui.widgetBox(container, "Generate Reflections", orientation="horizontal")

        le_limit = gui.lineEdit(gen_box, self, "limit", "Limit", labelWidth=90, valueType=float, validator=QDoubleValidator(), callback=widget_container.dump_limits)
        cb_limit = orangegui.comboBox(gen_box, self, "limit_type", label="Kind", items=["None", "Nr. Peaks", "2Theta Max"], orientation="horizontal")

        def set_limit(limit_type):
            if limit_type == 0:
                le_limit.setText("-1")
                le_limit.setEnabled(False)
            else:
                le_limit.setEnabled(True)

            if not self.is_on_init:
                widget_container.dump_limits()
                widget_container.dump_limit_types()

        cb_limit.currentIndexChanged.connect(set_limit)
        set_limit(self.limit_type)

        gui.button(gen_box, self, "Generate Reflections", callback=self.generate_reflections)

        reflection_box = gui.widgetBox(container,
                                       "Reflections", orientation="vertical",
                                       width=self.CONTROL_AREA_WIDTH - 10)

        orangegui.label(reflection_box, self, "h, k, l, <name> value <min minimum> <max maximum> or < fixed> or <name := function>")

        scrollarea = QScrollArea(reflection_box)
        scrollarea.setMaximumWidth(self.CONTROL_AREA_WIDTH - 40)
        scrollarea.setMinimumWidth(self.CONTROL_AREA_WIDTH - 40)

        def write_text():
            self.reflections_of_phase = self.text_area.toPlainText()
            if not self.is_on_init: widget_container.dump_reflections_of_phases()

        self.text_area = gui.textArea(height=500, width=5000, readOnly=False)
        self.text_area.setText(self.reflections_of_phase)
        self.text_area.textChanged.connect(write_text)

        scrollarea.setWidget(self.text_area)
        scrollarea.setWidgetResizable(1)

        reflection_box.layout().addWidget(scrollarea, alignment=Qt.AlignHCenter)

        self.is_on_init = False
Exemplo n.º 9
0
    def init_gui(self, container):
        box = gui.widgetBox(container,
                            "",
                            orientation="vertical",
                            width=self.CONTROL_AREA_WIDTH - 5,
                            spacing=0)

        orangegui.comboBox(box,
                           self,
                           "is_multiple_wavelength",
                           label="Incident Radiation",
                           items=["Single Wavelenght", "X-ray Tube"],
                           orientation="horizontal",
                           callback=self.set_is_multiple_wavelength)

        self.secondary_box = gui.widgetBox(container,
                                           "",
                                           orientation="horizontal",
                                           width=self.CONTROL_AREA_WIDTH - 5,
                                           spacing=0)

        orangegui.comboBox(self.secondary_box,
                           self,
                           "xray_tube_key",
                           label="X-ray Tube Dataset",
                           items=self.get_xray_tube_keys(),
                           sendSelectedValue=True,
                           orientation="horizontal",
                           callback=self.set_xray_tube_key)

        orangegui.separator(self.secondary_box)
        gui.button(self.secondary_box,
                   self,
                   "Reset",
                   width=70,
                   callback=self.set_xray_tube_key)

        self.secondary_box_empty = gui.widgetBox(
            container,
            "",
            orientation="vertical",
            width=self.CONTROL_AREA_WIDTH - 5,
            spacing=0)

        OWGenericWidget.create_box_in_widget(self,
                                             container,
                                             "wavelength",
                                             label="\u03BB  [nm]",
                                             disable_function=True,
                                             add_callback=True,
                                             min_value=0.0,
                                             min_accepted=False,
                                             trim=25)

        self.secondary_box_2 = gui.widgetBox(container,
                                             "",
                                             orientation="vertical",
                                             width=self.CONTROL_AREA_WIDTH)
        self.secondary_box_2_empty = gui.widgetBox(
            container,
            "",
            orientation="vertical",
            width=self.CONTROL_AREA_WIDTH)

        self.create_wavelength_boxes()

        self.set_is_multiple_wavelength()
Exemplo n.º 10
0
    def __init__(self):
        super().__init__(show_automatic_box=False)

        main_box = gui.widgetBox(self.controlArea,
                                 "Load Diffraction Pattern",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 5,
                                 height=600)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Load Data",
                   height=50,
                   callback=self.load_diffraction_patterns)

        tabs_button_box = gui.widgetBox(main_box,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        btns = [
            gui.button(tabs_button_box,
                       self,
                       "Insert Before",
                       callback=self.insert_before),
            gui.button(tabs_button_box,
                       self,
                       "Insert After",
                       callback=self.insert_after),
            gui.button(tabs_button_box, self, "Remove", callback=self.remove),
            gui.button(tabs_button_box,
                       self,
                       "Remove All",
                       callback=self.remove_all)
        ]

        for btn in btns:
            btn.setFixedHeight(40)

        btns[3].setStyleSheet("color: red")
        font = QFont(btns[3].font())
        font.setItalic(True)
        btns[3].setFont(font)

        self.diffraction_pattern_tabs = gui.tabWidget(main_box)
        self.diffraction_pattern_box_array = []

        for index in range(len(self.filename)):
            diffraction_pattern_tab = gui.createTabPage(
                self.diffraction_pattern_tabs,
                DiffractionPattern.get_default_name(index))

            diffraction_pattern_box = DiffractionPatternBox(
                widget=self,
                parent=diffraction_pattern_tab,
                index=index,
                filename=self.filename[index],
                twotheta_min=self.twotheta_min[index],
                twotheta_has_min=self.twotheta_has_min[index],
                twotheta_max=self.twotheta_max[index],
                twotheta_has_max=self.twotheta_has_max[index],
                diffraction_pattern_name=self.diffraction_pattern_name[index])

            self.diffraction_pattern_box_array.append(diffraction_pattern_box)

        self.tabs = gui.tabWidget(self.mainArea)
        self.tab_diff = []
        self.tabs_data_plot = []
        self.tab_data = []
        self.tab_plot = []
        self.plot = []
        self.table_data = []

        for index in range(len(self.filename)):
            self.tab_diff.append(
                gui.createTabPage(self.tabs,
                                  DiffractionPattern.get_default_name(index)))
            self.tabs_data_plot.append(gui.tabWidget(self.tab_diff[index]))
            self.tab_data.append(
                gui.createTabPage(self.tabs_data_plot[index], "Data"))
            self.tab_plot.append(
                gui.createTabPage(self.tabs_data_plot[index], "Plot"))

            self.plot.append(PlotWindow())
            self.plot[index].setDefaultPlotLines(True)
            self.plot[index].setActiveCurveColor(color="#00008B")
            self.plot[index].setGraphXLabel(r"2$\theta$")
            self.plot[index].setGraphYLabel("Intensity")

            self.tab_plot[index].layout().addWidget(self.plot[index])

            table_widget = self.create_table_widget()

            self.table_data.append(table_widget)

            self.tab_data[index].layout().addWidget(table_widget,
                                                    alignment=Qt.AlignHCenter)

        runaction = OWAction("Load Diffraction Patterns", self)
        runaction.triggered.connect(self.load_diffraction_patterns)
        self.addAction(runaction)