def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Calibration Peak Shift",
                                 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,
                   "Send Peak Shift",
                   height=50,
                   callback=self.send_peak_shift)

        lab6_box = gui.widgetBox(main_box,
                                 "Lab6 Tan Correction",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 30)

        self.create_box(lab6_box, "ax")
        self.create_box(lab6_box, "bx")
        self.create_box(lab6_box, "cx")
        self.create_box(lab6_box, "dx")
        self.create_box(lab6_box, "ex")
Пример #2
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

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

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

        gui.button(button_box,
                   self,
                   "Send Strain",
                   height=50,
                   callback=self.send_strain)

        self.create_box(main_box, "rho", label="\u03c1")
        self.create_box(main_box, "Re")
        self.create_box(main_box, "Ae")
        self.create_box(main_box, "Be")
        self.create_box(main_box, "As")
        self.create_box(main_box, "Bs")
        self.create_box(main_box, "mix")
        self.create_box(main_box, "b")
    def __init__(self):
        super().__init__(show_automatic_box=True)

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

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

        gui.button(button_box,
                   self,
                   "Send Background",
                   height=50,
                   callback=self.send_background)

        chebyshev_box = gui.widgetBox(main_box,
                                      "Chebyshev Parameters",
                                      orientation="vertical",
                                      width=self.CONTROL_AREA_WIDTH - 30)

        self.create_box(chebyshev_box, "a0")
        self.create_box(chebyshev_box, "b0")
        self.create_box(chebyshev_box, "a1")
        self.create_box(chebyshev_box, "b1")
        self.create_box(chebyshev_box, "a2")
        self.create_box(chebyshev_box, "b2")
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Constrast Factor Calculator Parameters",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=600)

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

        gui.button(button_box,
                   self,
                   "Send Constrast Factor A/B Parameters",
                   height=50,
                   callback=self.send_contrast_factor_a_b)

        contrast_factor_box = gui.widgetBox(main_box,
                                            "Elastic Constants",
                                            orientation="vertical",
                                            height=300,
                                            width=self.CONTROL_AREA_WIDTH - 30)

        gui.lineEdit(contrast_factor_box,
                     self,
                     "c11",
                     "c11",
                     labelWidth=90,
                     valueType=float)
        gui.lineEdit(contrast_factor_box,
                     self,
                     "c12",
                     "c12",
                     labelWidth=90,
                     valueType=float)
        gui.lineEdit(contrast_factor_box,
                     self,
                     "c44",
                     "c44",
                     labelWidth=90,
                     valueType=float)

        text_area_box = gui.widgetBox(contrast_factor_box,
                                      "Calculation Result",
                                      orientation="vertical",
                                      height=160,
                                      width=self.CONTROL_AREA_WIDTH - 50)

        self.text_area = gui.textArea(height=120,
                                      width=self.CONTROL_AREA_WIDTH - 70,
                                      readOnly=True)
        self.text_area.setText("")
        self.text_area.setStyleSheet("font-family: Courier, monospace;")

        text_area_box.layout().addWidget(self.text_area)

        orangegui.separator(main_box, height=280)
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Instrumental Profile", 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, "Send Instrumental Profile", height=50, callback=self.send_intrumental_profile)

        caglioti_box_1 = gui.widgetBox(main_box,
                                 "Caglioti's FWHM", orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 30)
        
        caglioti_box_2 = gui.widgetBox(main_box,
                                 "Caglioti's \u03b7", orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 30)

        self.create_box(caglioti_box_1, "U")
        self.create_box(caglioti_box_1, "V")
        self.create_box(caglioti_box_1, "W")
        self.create_box(caglioti_box_2, "a")
        self.create_box(caglioti_box_2, "b")
        self.create_box(caglioti_box_2, "c")
Пример #6
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=600)


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


        gui.button(button_box,  self, "Send Free Input Parameters", height=50, 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(260)

        self.text_area_free_in = gui.textArea(height=500, 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)
Пример #7
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Peak Shift",
                                 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,
                   "Send Peak Shift",
                   height=50,
                   callback=self.send_peak_shift)

        zero_error_box = gui.widgetBox(main_box,
                                       "Zero Error",
                                       orientation="vertical",
                                       width=self.CONTROL_AREA_WIDTH - 30)

        self.create_box(zero_error_box, "shift", label="\u0394(2\u03b8) [deg]")
Пример #8
0
    def __init__(self):
        super().__init__(show_automatic_box=True)
        
        if self.IS_FIX: self.fix_input()
        
        crystal_box = gui.widgetBox(self.controlArea,
                                 "Crystal Structure", orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10, height=600)


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

        gui.button(button_box,  self, "Send Crystal Structure", height=50, callback=self.send_fit_initialization)

        self.crystal_structure_tabs = gui.tabWidget(crystal_box)
        self.crystal_structure_box_array = []

        for index in range(len(self.a)):
            crystal_structure_tab = gui.createTabPage(self.crystal_structure_tabs, "Diff. Patt. " + str(index + 1))

            crystal_structure_box = CrystalStructureBox(widget=self,
                                                        parent=crystal_structure_tab,
                                                        index = index,
                                                        a                                    = self.a[index],
                                                        a_fixed                              = self.a_fixed[index],
                                                        a_has_min                            = self.a_has_min[index],
                                                        a_min                                = self.a_min[index],
                                                        a_has_max                            = self.a_has_max[index],
                                                        a_max                                = self.a_max[index],
                                                        a_function                           = self.a_function[index],
                                                        a_function_value                     = self.a_function_value[index],
                                                        symmetry                             = self.symmetry[index],
                                                        use_structure                        = self.use_structure[index],
                                                        formula                              = self.formula[index],
                                                        intensity_scale_factor               = self.intensity_scale_factor[index],
                                                        intensity_scale_factor_fixed         = self.intensity_scale_factor_fixed[index],
                                                        intensity_scale_factor_has_min       = self.intensity_scale_factor_has_min[index],
                                                        intensity_scale_factor_min           = self.intensity_scale_factor_min[index],
                                                        intensity_scale_factor_has_max       = self.intensity_scale_factor_has_max[index],
                                                        intensity_scale_factor_max           = self.intensity_scale_factor_max[index],
                                                        intensity_scale_factor_function      = self.intensity_scale_factor_function[index],
                                                        intensity_scale_factor_function_value= self.intensity_scale_factor_function_value[index],
                                                        reflections                          = self.reflections[index],
                                                        limit                                = self.limit[index],
                                                        limit_type                           = self.limit_type[index])

            self.crystal_structure_box_array.append(crystal_structure_box)
Пример #9
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

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

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

        gui.button(button_box,
                   self,
                   "Send Fit Initialization",
                   height=50,
                   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")
Пример #10
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Thermal Properties Setting",
                                 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,
                   "Send Debye-Waller Parameters",
                   height=50,
                   callback=self.send_debye_waller)

        box = gui.widgetBox(main_box,
                            "Debye-Waller Factor",
                            orientation="vertical",
                            width=self.CONTROL_AREA_WIDTH - 30)

        orangegui.comboBox(box,
                           self,
                           "use_debye_waller_factor",
                           label="Calculate",
                           items=["No", "Yes"],
                           labelWidth=250,
                           orientation="horizontal",
                           callback=self.set_dw)

        self.box_dw = gui.widgetBox(box,
                                    "",
                                    orientation="vertical",
                                    width=self.CONTROL_AREA_WIDTH - 30,
                                    height=30)
        self.box_dw_empty = gui.widgetBox(box,
                                          "",
                                          orientation="vertical",
                                          width=self.CONTROL_AREA_WIDTH - 30,
                                          height=30)

        self.create_box(self.box_dw, "debye_waller_factor", "B [Å-2]")

        self.set_dw()
Пример #11
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Peak Shift", 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, "Send Peak Shift", height=50, callback=self.send_peak_displacement)

        specimen_displacement_box = gui.widgetBox(main_box,
                                    "Specimen Displacement", orientation="vertical",
                                    width=self.CONTROL_AREA_WIDTH - 30)

        gui.lineEdit(specimen_displacement_box, self, "goniometer_radius", "Goniometer Radius [m]", labelWidth=300, valueType=float, validator=QDoubleValidator())
        orangegui.separator(specimen_displacement_box)
        self.create_box(specimen_displacement_box, "displacement", label="\u03b4 [\u03bcm]")
Пример #12
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

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

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

        gui.button(button_box,
                   self,
                   "Send Strain",
                   height=50,
                   callback=self.send_strain)

        self.create_box(main_box, "aa")
        self.create_box(main_box, "bb")

        invariant_box = gui.widgetBox(main_box,
                                      "Invariant Parameters",
                                      orientation="vertical",
                                      width=self.CONTROL_AREA_WIDTH - 30)

        self.cb_laue_id = orangegui.comboBox(invariant_box,
                                             self,
                                             "laue_id",
                                             label="Laue Group",
                                             items=LaueGroup.tuple(),
                                             callback=self.set_laue_id,
                                             orientation="horizontal")

        self.create_box(invariant_box, "e1")
        self.create_box(invariant_box, "e4")
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Warren Model Strain",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=600)

        self.create_box(parent_box=main_box,
                        var="average_cell_parameter",
                        label="<a>")

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

        gui.button(button_box,
                   self,
                   "Send Strain",
                   height=50,
                   callback=self.send_strain)
    def __init__(self, show_automatic_box=True):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()

        if self.want_main_area:
            max_width = self.MAX_WIDTH
        else:
            max_width = self.MAX_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.MAX_HEIGHT))))

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

        from PyQt5.QtWidgets import QSizePolicy
        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:
            orange_gui.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)
Пример #15
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea, "Fitter Setting", orientation="vertical", width=self.CONTROL_AREA_WIDTH)

        button_box = gui.widgetBox(main_box, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH-15, height=70)

        button_box_1 = gui.widgetBox(button_box, "", orientation="horizontal")

        self.fit_button = gui.button(button_box_1,  self, "Fit", height=40, callback=self.do_fit)
        self.fit_button.setStyleSheet("color: #252468")
        font = QFont(self.fit_button.font())
        font.setBold(True)
        font.setPixelSize(18)
        self.fit_button.setFont(font)

        self.stop_fit_button = gui.button(button_box_1,  self, "STOP", height=40, callback=self.stop_fit)
        self.stop_fit_button.setStyleSheet("color: red")
        font = QFont(self.stop_fit_button.font())
        font.setBold(True)
        font.setItalic(True)
        self.stop_fit_button.setFont(font)

        button_box_2 = gui.widgetBox(button_box, "", orientation="horizontal")

        gui.button(button_box_2,  self, "Send Current Fit", height=40, callback=self.send_current_fit)
        gui.button(button_box_2,  self, "Save Data", height=40, callback=self.save_data)

        orangegui.separator(main_box)

        self.cb_fitter = orangegui.comboBox(main_box, self, "fitter_name", label="Fit algorithm", items=FitterName.tuple(), orientation="horizontal")


        iteration_box = gui.widgetBox(main_box, "", orientation="horizontal", width=250)

        gui.lineEdit(iteration_box, self, "n_iterations", "Nr. Iterations", labelWidth=80, valueType=int, validator=QIntValidator())
        orangegui.checkBox(iteration_box, self, "is_incremental", "Incremental")

        iteration_box = gui.widgetBox(main_box, "", orientation="vertical", width=250)

        self.le_current_iteration = gui.lineEdit(iteration_box, self, "current_iteration", "Current Iteration", labelWidth=120, valueType=int, orientation="horizontal")
        self.le_current_iteration.setReadOnly(True)
        self.le_current_iteration.setStyleSheet("background-color: #FAFAB0; color: #252468")
        font = QFont(self.le_current_iteration.font())
        font.setBold(True)
        self.le_current_iteration.setFont(font)

        orangegui.separator(main_box)

        self.plot_box = gui.widgetBox(main_box, "Plotting Options", orientation="vertical", width=self.CONTROL_AREA_WIDTH-20)

        self.cb_interactive = orangegui.checkBox(self.plot_box, self, "is_interactive", "Refresh Plots while fitting", callback=self.set_interactive)
        orangegui.separator(self.plot_box, height=8)

        self.cb_show_wss_gof = orangegui.checkBox(self.plot_box, self, "show_wss_gof", "Refresh W.S.S. and G.o.F. plots" )
        orangegui.separator(self.plot_box)
        self.cb_show_ipf     = orangegui.checkBox(self.plot_box, self, "show_ipf", "Refresh Instrumental Profile plots")
        orangegui.separator(self.plot_box)
        self.cb_show_shift     = orangegui.checkBox(self.plot_box, self, "show_shift", "Refresh Calibration Shift plots")
        orangegui.separator(self.plot_box)
        self.cb_show_size    = orangegui.checkBox(self.plot_box, self, "show_size", "Refresh Size Distribution plot")
        orangegui.separator(self.plot_box)
        self.cb_show_warren  = orangegui.checkBox(self.plot_box, self, "show_warren", "Refresh Warren's plot")

        self.set_interactive()

        tab_free_out = gui.widgetBox(main_box, "Free Output Parameters", orientation="vertical")

        self.scrollarea_free_out = QScrollArea(tab_free_out)
        self.scrollarea_free_out.setMinimumWidth(self.CONTROL_AREA_WIDTH-55)
        self.scrollarea_free_out.setMaximumHeight(170)

        def write_text():
            self.free_output_parameters_text = self.text_area_free_out.toPlainText()

        self.text_area_free_out = gui.textArea(height=1000, width=1000, readOnly=False)
        self.text_area_free_out.setText(self.free_output_parameters_text)
        self.text_area_free_out.textChanged.connect(write_text)

        self.scrollarea_free_out.setWidget(self.text_area_free_out)
        self.scrollarea_free_out.setWidgetResizable(1)

        tab_free_out.layout().addWidget(self.scrollarea_free_out, alignment=Qt.AlignHCenter)

        self.tabs = gui.tabWidget(self.mainArea)

        self.tab_fit_in  = gui.createTabPage(self.tabs, "Fit Input Parameters")
        self.tab_plot    = gui.createTabPage(self.tabs, "Plots")
        self.tab_fit_out = gui.createTabPage(self.tabs, "Fit Output Parameters")

        self.tabs_plot = gui.tabWidget(self.tab_plot)

        self.tab_plot_fit_data = gui.createTabPage(self.tabs_plot, "Fit")
        self.tab_plot_fit_wss  = gui.createTabPage(self.tabs_plot, "W.S.S.")
        self.tab_plot_fit_gof  = gui.createTabPage(self.tabs_plot, "G.o.F.")
        self.tab_plot_ipf   = gui.createTabPage(self.tabs_plot, "Instrumental Profile")
        self.tab_plot_size   = gui.createTabPage(self.tabs_plot, "Size Distribution")
        self.tab_plot_strain = gui.createTabPage(self.tabs_plot, "Warren's Plot")

        self.std_output = gui.textArea(height=100, width=800)
        self.std_output.setStyleSheet("font-family: Courier, monospace;")

        out_box = gui.widgetBox(self.mainArea, "System Output", addSpace=False, orientation="horizontal")
        out_box.layout().addWidget(self.std_output)

        self.tabs_plot_fit_data = gui.tabWidget(self.tab_plot_fit_data)
        self.tabs_plot_ipf = gui.tabWidget(self.tab_plot_ipf)
        self.tab_plot_fwhm = gui.createTabPage(self.tabs_plot_ipf, "Caglioti's FWHM")
        self.tab_plot_eta  = gui.createTabPage(self.tabs_plot_ipf, "Caglioti's \u03b7")
        self.tab_plot_lab6 = gui.createTabPage(self.tabs_plot_ipf, "LaB6 Tan Correction")

        self.build_plot_fit()

        self.plot_fit_wss = PlotWindow()
        self.plot_fit_wss.setDefaultPlotLines(True)
        self.plot_fit_wss.setActiveCurveColor(color="#00008B")
        self.plot_fit_wss.setGraphXLabel("Iteration")
        self.plot_fit_wss.setGraphYLabel("WSS")

        self.tab_plot_fit_wss.layout().addWidget(self.plot_fit_wss)

        self.plot_fit_gof = PlotWindow()
        self.plot_fit_gof.setDefaultPlotLines(True)
        self.plot_fit_gof.setActiveCurveColor(color="#00008B")
        self.plot_fit_gof.setGraphXLabel("Iteration")
        self.plot_fit_gof.setGraphYLabel("GOF")

        self.tab_plot_fit_gof.layout().addWidget(self.plot_fit_gof)

        self.plot_size = PlotWindow()
        self.plot_size.setDefaultPlotLines(True)
        self.plot_size.setActiveCurveColor(color="#00008B")
        self.plot_size.setGraphTitle("Crystalline Domains Size Distribution")
        self.plot_size.setGraphXLabel(r"D [nm]")
        self.plot_size.setGraphYLabel("Frequency")

        self.tab_plot_size.layout().addWidget(self.plot_size)

        self.plot_strain = PlotWindow(control=True)
        legendsDockWidget = LegendsDockWidget(plot=self.plot_strain)
        self.plot_strain._legendsDockWidget = legendsDockWidget
        self.plot_strain._dockWidgets.append(legendsDockWidget)
        self.plot_strain.addDockWidget(qt.Qt.RightDockWidgetArea, legendsDockWidget)
        self.plot_strain._legendsDockWidget.setFixedWidth(120)
        self.plot_strain.getLegendsDockWidget().show()

        self.plot_strain.setDefaultPlotLines(True)
        self.plot_strain.setActiveCurveColor(color="#00008B")
        self.plot_strain.setGraphTitle("Warren's plot")
        self.plot_strain.setGraphXLabel(r"L [nm]")
        self.plot_strain.setGraphYLabel("$\sqrt{<{\Delta}L^{2}>}$ [nm]")

        self.tab_plot_strain.layout().addWidget(self.plot_strain)

        box = gui.widgetBox(self.tab_plot_fwhm, "", orientation="horizontal")

        boxl = gui.widgetBox(box, "", orientation="vertical")
        boxr = gui.widgetBox(box, "", orientation="vertical", width=150)

        def set_fwhm_autoscale():
            self.le_fwhm_xmin.setEnabled(self.fwhm_autoscale==0)
            self.le_fwhm_xmax.setEnabled(self.fwhm_autoscale==0)
            self.le_fwhm_ymin.setEnabled(self.fwhm_autoscale==0)
            self.le_fwhm_ymax.setEnabled(self.fwhm_autoscale==0)

        orangegui.checkBox(boxr, self, "fwhm_autoscale", "Autoscale", callback=set_fwhm_autoscale)

        self.le_fwhm_xmin = gui.lineEdit(boxr, self, "fwhm_xmin", "2\u03b8 min", labelWidth=70, valueType=float)
        self.le_fwhm_xmax = gui.lineEdit(boxr, self, "fwhm_xmax", "2\u03b8 max", labelWidth=70, valueType=float)
        self.le_fwhm_ymin = gui.lineEdit(boxr, self, "fwhm_ymin", "FWHM min", labelWidth=70, valueType=float)
        self.le_fwhm_ymax = gui.lineEdit(boxr, self, "fwhm_ymax", "FWHM max", labelWidth=70, valueType=float)
        gui.button(boxr, self, "Refresh", height=40, callback=self.refresh_caglioti_fwhm)

        set_fwhm_autoscale()

        self.plot_ipf_fwhm = PlotWindow()
        self.plot_ipf_fwhm.setDefaultPlotLines(True)
        self.plot_ipf_fwhm.setActiveCurveColor(color="#00008B")
        self.plot_ipf_fwhm.setGraphXLabel("2\u03b8 (deg)")
        self.plot_ipf_fwhm.setGraphYLabel("FWHM (deg)")

        boxl.layout().addWidget(self.plot_ipf_fwhm)


        box = gui.widgetBox(self.tab_plot_eta, "", orientation="horizontal")

        boxl = gui.widgetBox(box, "", orientation="vertical")
        boxr = gui.widgetBox(box, "", orientation="vertical", width=150)

        def set_eta_autoscale():
            self.le_eta_xmin.setEnabled(self.eta_autoscale==0)
            self.le_eta_xmax.setEnabled(self.eta_autoscale==0)
            self.le_eta_ymin.setEnabled(self.eta_autoscale==0)
            self.le_eta_ymax.setEnabled(self.eta_autoscale==0)

        orangegui.checkBox(boxr, self, "eta_autoscale", "Autoscale", callback=set_eta_autoscale)

        self.le_eta_xmin = gui.lineEdit(boxr, self, "eta_xmin", "2\u03b8 min", labelWidth=70, valueType=float)
        self.le_eta_xmax = gui.lineEdit(boxr, self, "eta_xmax", "2\u03b8 max", labelWidth=70, valueType=float)
        self.le_eta_ymin = gui.lineEdit(boxr, self, "eta_ymin", "\u03b7 min", labelWidth=70, valueType=float)
        self.le_eta_ymax = gui.lineEdit(boxr, self, "eta_ymax", "\u03b7 max", labelWidth=70, valueType=float)
        gui.button(boxr, self, "Refresh", height=40, callback=self.refresh_caglioti_eta)

        set_eta_autoscale()

        self.plot_ipf_eta = PlotWindow()
        self.plot_ipf_eta.setDefaultPlotLines(True)
        self.plot_ipf_eta.setActiveCurveColor(color="#00008B")
        self.plot_ipf_eta.setGraphXLabel("2\u03b8 (deg)")
        self.plot_ipf_eta.setGraphYLabel("\u03b7")

        boxl.layout().addWidget(self.plot_ipf_eta)

        box = gui.widgetBox(self.tab_plot_lab6, "", orientation="horizontal")

        boxl = gui.widgetBox(box, "", orientation="vertical")
        boxr = gui.widgetBox(box, "", orientation="vertical", width=150)

        def set_lab6_autoscale():
            self.le_lab6_xmin.setEnabled(self.lab6_autoscale==0)
            self.le_lab6_xmax.setEnabled(self.lab6_autoscale==0)
            self.le_lab6_ymin.setEnabled(self.lab6_autoscale==0)
            self.le_lab6_ymax.setEnabled(self.lab6_autoscale==0)

        orangegui.checkBox(boxr, self, "lab6_autoscale", "Autoscale", callback=set_lab6_autoscale)

        self.le_lab6_xmin = gui.lineEdit(boxr, self, "lab6_xmin", "2\u03b8 min", labelWidth=70, valueType=float)
        self.le_lab6_xmax = gui.lineEdit(boxr, self, "lab6_xmax", "2\u03b8 max", labelWidth=70, valueType=float)
        self.le_lab6_ymin = gui.lineEdit(boxr, self, "lab6_ymin", "\u0394(2\u03b8) min", labelWidth=70, valueType=float)
        self.le_lab6_ymax = gui.lineEdit(boxr, self, "lab6_ymax", "\u0394(2\u03b8) max", labelWidth=70, valueType=float)
        gui.button(boxr, self, "Refresh", height=40, callback=self.refresh_lab6)

        set_lab6_autoscale()

        self.plot_ipf_lab6 = PlotWindow()
        self.plot_ipf_lab6.setDefaultPlotLines(True)
        self.plot_ipf_lab6.setActiveCurveColor(color="#00008B")
        self.plot_ipf_lab6.setGraphXLabel("2\u03b8 (deg)")
        self.plot_ipf_lab6.setGraphYLabel("\u0394(2\u03b8) (deg)")

        boxl.layout().addWidget(self.plot_ipf_lab6)

        # -------------------

        self.table_fit_in = self.create_table_widget(is_output=False)
        self.tab_fit_in.layout().addWidget(self.table_fit_in, alignment=Qt.AlignHCenter)

        # -------------------

        self.table_fit_out = self.create_table_widget()
        self.tab_fit_out.layout().addWidget(self.table_fit_out, alignment=Qt.AlignHCenter)
Пример #16
0
    def __init__(self,
                 widget=None,
                 parent=None,
                 index = 0,
                 a                                     = 0.0,
                 a_fixed                               = 0,
                 a_has_min                             = 0,
                 a_min                                 = 0.0,
                 a_has_max                             = 0,
                 a_max                                 = 0.0,
                 a_function                            = 0,
                 a_function_value                      = "",
                 symmetry                              = 2,
                 use_structure                         = 0,
                 formula                               = "",
                 intensity_scale_factor                = 1.0,
                 intensity_scale_factor_fixed          = 0,
                 intensity_scale_factor_has_min        = 0,
                 intensity_scale_factor_min            = 0.0,
                 intensity_scale_factor_has_max        = 0,
                 intensity_scale_factor_max            = 0.0,
                 intensity_scale_factor_function       = 0,
                 intensity_scale_factor_function_value = "",
                 reflections                           = "",
                 limit                                 = 0.0,
                 limit_type                            = 0):
        super(CrystalStructureBox, self).__init__(parent)
        OWComponent.__init__(self)

        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)
        self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 35)
        self.setFixedHeight(500)

        self.widget = widget
        self.index = index
        
        self.a                                     = a
        self.a_fixed                               = a_fixed
        self.a_has_min                             = a_has_min
        self.a_min                                 = a_min
        self.a_has_max                             = a_has_max
        self.a_max                                 = a_max
        self.a_function                            = a_function
        self.a_function_value                      = a_function_value
        self.symmetry                              = symmetry
        self.use_structure                         = use_structure
        self.formula                               = formula
        self.intensity_scale_factor                = intensity_scale_factor
        self.intensity_scale_factor_fixed          = intensity_scale_factor_fixed
        self.intensity_scale_factor_has_min        = intensity_scale_factor_has_min
        self.intensity_scale_factor_min            = intensity_scale_factor_min
        self.intensity_scale_factor_has_max        = intensity_scale_factor_has_max
        self.intensity_scale_factor_max            = intensity_scale_factor_max
        self.intensity_scale_factor_function       = intensity_scale_factor_function
        self.intensity_scale_factor_function_value = intensity_scale_factor_function_value
        self.reflections                           = reflections
        self.limit                                 = limit
        self.limit_type                            = limit_type

        self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH

        container = gui.widgetBox(parent, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH-45)


        self.cb_symmetry = orangegui.comboBox(container, self, "symmetry", label="Symmetry", items=Symmetry.tuple(), callback=self.set_symmetry, orientation="horizontal")

        widget.create_box_in_widget(self, container, "a", "a [nm]", add_callback=True)

        orangegui.separator(container)

        structure_box = gui.widgetBox(container,
                                       "", orientation="vertical",
                                       width=self.CONTROL_AREA_WIDTH - 45)

        orangegui.comboBox(structure_box, self, "use_structure", label="Use Structural Model", items=["No", "Yes"],
                           callback=self.set_structure, labelWidth=350, orientation="horizontal")


        self.structure_box_1 = gui.widgetBox(structure_box,
                                       "", orientation="vertical",
                                       width=self.CONTROL_AREA_WIDTH - 50, height=60)

        gui.lineEdit(self.structure_box_1, self, "formula", "Chemical Formula", labelWidth=90, valueType=str, callback=widget.dump_formula)
        widget.create_box_in_widget(self, self.structure_box_1, "intensity_scale_factor", "I0", add_callback=True)

        self.structure_box_2 = gui.widgetBox(structure_box,
                                       "", orientation="vertical",
                                       width=self.CONTROL_AREA_WIDTH - 50, height=60)

        orangegui.separator(container)

        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.dump_limit)
        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.dump_limit()
                widget.dump_limit_type()

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

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

        self.set_structure()

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

        orangegui.label(reflection_box, self, "h, k, l, <intensity_name> int <, min value, max value>")

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

        def write_text():
            self.reflections = self.text_area.toPlainText()
            if not self.is_on_init: widget.dump_reflections()

        self.text_area = gui.textArea(height=500, width=1000, readOnly=False)
        self.text_area.setText(self.reflections)
        self.text_area.setStyleSheet("font-family: Courier, monospace;")
        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
    def __init__(self):
        super().__init__(show_automatic_box=True)

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

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

        gui.button(button_box,
                   self,
                   "Send Size",
                   height=50,
                   callback=self.send_size)

        self.cb_shape = orangegui.comboBox(main_box,
                                           self,
                                           "shape",
                                           label="Shape",
                                           items=Shape.tuple(),
                                           callback=self.set_shape,
                                           orientation="horizontal")
        self.cb_distribution = orangegui.comboBox(
            main_box,
            self,
            "distribution",
            label="Distribution",
            items=Distribution.tuple(),
            callback=self.set_distribution,
            orientation="horizontal")

        size_box = gui.widgetBox(main_box,
                                 "Size Parameters",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 30)

        self.create_box(size_box, "mu", label="\u03bc or D")

        self.sigma_box = gui.widgetBox(size_box, "", orientation="vertical")

        self.create_box(self.sigma_box, "sigma", label="\u03c3")

        self.saxs_box = gui.widgetBox(size_box, "", orientation="vertical")

        orangegui.comboBox(self.saxs_box,
                           self,
                           "add_saxs",
                           label="Add SAXS",
                           items=["No", "Yes"],
                           labelWidth=300,
                           orientation="horizontal",
                           callback=self.set_add_saxs)

        self.normalize_box = gui.widgetBox(self.saxs_box,
                                           "",
                                           orientation="vertical")

        orangegui.comboBox(self.normalize_box,
                           self,
                           "normalize_to",
                           label="Normalize to",
                           items=Normalization.tuple(),
                           labelWidth=300,
                           orientation="horizontal")

        self.set_distribution(is_init=True)
Пример #18
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Lorentz-Polarization Factors Setting",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=400)

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

        gui.button(button_box,
                   self,
                   "Send Lorentz-Polarization Parameters",
                   height=50,
                   callback=self.send_lorentz_polarization)

        box = gui.widgetBox(main_box,
                            "Lorentz-Polarization Factors",
                            orientation="vertical",
                            width=self.CONTROL_AREA_WIDTH - 30)

        orangegui.comboBox(box,
                           self,
                           "use_lorentz_factor",
                           label="Add Lorentz Factor",
                           items=["No", "Yes"],
                           labelWidth=300,
                           orientation="horizontal",
                           callback=self.set_LorentzFactor)

        self.lorentz_box = gui.widgetBox(box,
                                         "",
                                         orientation="vertical",
                                         width=self.CONTROL_AREA_WIDTH - 50,
                                         height=30)
        self.lorentz_box_empty = gui.widgetBox(box,
                                               "",
                                               orientation="vertical",
                                               width=self.CONTROL_AREA_WIDTH -
                                               50,
                                               height=30)

        orangegui.comboBox(self.lorentz_box,
                           self,
                           "lorentz_formula",
                           label="Formula",
                           items=LorentzFormula.tuple(),
                           labelWidth=300,
                           orientation="horizontal")

        self.set_LorentzFactor()

        orangegui.separator(box)

        orangegui.comboBox(box,
                           self,
                           "use_polarization_factor",
                           label="Add Polarization Factor",
                           items=["No", "Yes"],
                           labelWidth=300,
                           orientation="horizontal",
                           callback=self.set_Polarization)

        self.polarization_box = gui.widgetBox(box,
                                              "",
                                              orientation="vertical",
                                              width=self.CONTROL_AREA_WIDTH -
                                              50,
                                              height=200)
        self.polarization_box_empty = gui.widgetBox(
            box,
            "",
            orientation="vertical",
            width=self.CONTROL_AREA_WIDTH - 50,
            height=200)

        gui.lineEdit(self.polarization_box,
                     self,
                     "degree_of_polarization",
                     "Deg. Pol. (0\u2264Q\u22641)",
                     labelWidth=300,
                     valueType=float,
                     validator=QDoubleValidator())

        orangegui.comboBox(self.polarization_box,
                           self,
                           "use_twotheta_mono",
                           label="Use Monochromator",
                           items=["No", "Yes"],
                           labelWidth=300,
                           orientation="horizontal",
                           callback=self.set_Monochromator)

        self.monochromator_box = gui.widgetBox(self.polarization_box,
                                               "",
                                               orientation="vertical",
                                               width=self.CONTROL_AREA_WIDTH -
                                               50,
                                               height=95)
        self.monochromator_box_empty = gui.widgetBox(
            self.polarization_box,
            "",
            orientation="vertical",
            width=self.CONTROL_AREA_WIDTH - 50,
            height=95)

        orangegui.comboBox(self.monochromator_box,
                           self,
                           "beampath",
                           label="Beampath",
                           items=Beampath.tuple(),
                           labelWidth=300,
                           orientation="horizontal")

        gui.lineEdit(self.monochromator_box,
                     self,
                     "twotheta_mono",
                     "2\u03B8 Monochromator [deg]",
                     labelWidth=300,
                     valueType=float,
                     validator=QDoubleValidator())

        self.set_Polarization()
    def create_box_in_widget(cls,
                             widget,
                             parent_box,
                             var,
                             label=None,
                             disable_function=False,
                             add_callback=False,
                             label_width=40):
        box = gui.widgetBox(parent_box,
                            "",
                            orientation="horizontal",
                            width=widget.CONTROL_AREA_WIDTH - 50,
                            height=25)

        box_value_width = 100 - (label_width - 40)

        box_label = gui.widgetBox(box,
                                  "",
                                  orientation="horizontal",
                                  width=label_width,
                                  height=25)
        box_value = gui.widgetBox(box,
                                  "",
                                  orientation="horizontal",
                                  width=box_value_width,
                                  height=25)
        box_fixed = gui.widgetBox(box, "", orientation="horizontal", height=25)
        box_min_max = gui.widgetBox(box,
                                    "",
                                    orientation="horizontal",
                                    height=30)
        box_function = gui.widgetBox(box,
                                     "",
                                     orientation="horizontal",
                                     height=25)
        box_function_value = gui.widgetBox(box,
                                           "",
                                           orientation="horizontal",
                                           height=25)

        gui.widgetLabel(box_label, var if label is None else label)
        if add_callback:
            le_var = gui.lineEdit(box_value,
                                  widget,
                                  var,
                                  "",
                                  valueType=float,
                                  validator=QDoubleValidator(),
                                  callback=getattr(widget, "callback_" + var))
        else:
            le_var = gui.lineEdit(box_value,
                                  widget,
                                  var,
                                  "",
                                  valueType=float,
                                  validator=QDoubleValidator())

        def set_flags():
            fixed = getattr(widget, var + "_fixed") == 1
            function = getattr(widget, var + "_function") == 1
            if disable_function:
                function = False
                setattr(widget, var + "_function", 0)

            if function:
                setattr(widget, var + "_fixed", 0)

                box_min_max.setVisible(False)
                box_fixed.setVisible(False)
                le_var.setVisible(False)
                box_value.setFixedWidth(5)
                box_function.setVisible(True)
                box_function_value.setVisible(True)
            elif fixed:
                setattr(widget, var + "_function", 0)

                box_min_max.setVisible(False)
                box_fixed.setVisible(True)
                le_var.setVisible(True)
                box_value.setFixedWidth(box_value_width)
                box_function.setVisible(False)
                box_function_value.setVisible(False)
            else:
                setattr(widget, var + "_fixed", 0)
                setattr(widget, var + "_function", 0)

                box_min_max.setVisible(True)
                box_fixed.setVisible(True)
                le_var.setVisible(True)
                box_value.setFixedWidth(box_value_width)
                box_function.setVisible(True)
                box_function_value.setVisible(False)

            if add_callback: getattr(widget, "callback_" + var)()

        widget.parameter_functions[var] = set_flags

        orangegui.checkBox(box_fixed,
                           widget,
                           var + "_fixed",
                           "fix",
                           callback=set_flags)

        def set_min():
            setattr(widget, var + "_has_min", 1)
            if add_callback: getattr(widget, "callback_" + var)()

        def set_max():
            setattr(widget, var + "_has_max", 1)
            if add_callback: getattr(widget, "callback_" + var)()

        if add_callback:
            orangegui.checkBox(box_min_max,
                               widget,
                               var + "_has_min",
                               "min",
                               callback=getattr(widget, "callback_" + var))
            gui.lineEdit(box_min_max,
                         widget,
                         var + "_min",
                         "",
                         valueType=float,
                         validator=QDoubleValidator(),
                         callback=set_min)
            orangegui.checkBox(box_min_max,
                               widget,
                               var + "_has_max",
                               "max",
                               callback=getattr(widget, "callback_" + var))
            gui.lineEdit(box_min_max,
                         widget,
                         var + "_max",
                         "",
                         valueType=float,
                         validator=QDoubleValidator(),
                         callback=set_max)

            cb = orangegui.checkBox(box_function,
                                    widget,
                                    var + "_function",
                                    "f(x)",
                                    callback=set_flags)
            cb.setEnabled(not disable_function)

            gui.lineEdit(box_function_value,
                         widget,
                         var + "_function_value",
                         "expression",
                         valueType=str,
                         callback=getattr(widget, "callback_" + var))
        else:
            orangegui.checkBox(box_min_max, widget, var + "_has_min", "min")
            gui.lineEdit(box_min_max,
                         widget,
                         var + "_min",
                         "",
                         valueType=float,
                         validator=QDoubleValidator(),
                         callback=set_min)
            orangegui.checkBox(box_min_max, widget, var + "_has_max", "max")
            gui.lineEdit(box_min_max,
                         widget,
                         var + "_max",
                         "",
                         valueType=float,
                         validator=QDoubleValidator(),
                         callback=set_max)

            cb = orangegui.checkBox(box_function,
                                    widget,
                                    var + "_function",
                                    "f(x)",
                                    callback=set_flags)
            cb.setEnabled(not disable_function)

            gui.lineEdit(box_function_value,
                         widget,
                         var + "_function_value",
                         "expression",
                         valueType=str)

        set_flags()