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, "", 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)
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)
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