示例#1
0
    def createTabThickness(self):
        tab_thick = oasysgui.createTabPage(self.tabs_setting, "Thickness Error")

        input_box = oasysgui.widgetBox(tab_thick, "Thickness Error Files", addSpace=True, orientation="vertical", height=390, width=self.CONTROL_AREA_WIDTH-20)

        gui.comboBox(input_box, self, "crl_material_data", label="Material Properties from", labelWidth=180,
                             items=["Chemical Formula", "Absorption Parameters"],
                             callback=self.set_CrlMaterialData,
                             sendSelectedValue=False, orientation="horizontal")

        self.input_box_1 = oasysgui.widgetBox(input_box, "", addSpace=False, orientation="vertical", width=self.CONTROL_AREA_WIDTH-40)
        self.input_box_2 = oasysgui.widgetBox(input_box, "", addSpace=False, orientation="vertical", width=self.CONTROL_AREA_WIDTH-40)

        oasysgui.lineEdit(self.input_box_1, self, "crl_material", "Chemical Formula", labelWidth=260, valueType=str, orientation="horizontal")
        oasysgui.lineEdit(self.input_box_2, self, "crl_delta", "Refractive Index (\u03b4)", labelWidth=260, valueType=float, orientation="horizontal")

        self.set_CrlMaterialData()

        self.files_area = oasysgui.textArea(height=265)

        input_box.layout().addWidget(self.files_area)

        self.refresh_files_text_area()

        oasysgui.lineEdit(input_box, self, "crl_scaling_factor", "Thickness Error Scaling Factor", labelWidth=260, valueType=float, orientation="horizontal")
示例#2
0
    def __init__(self):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(
                round(geom.width() * 0.05), round(geom.height() * 0.05),
                round(min(geom.width() * 0.98, self.CONTROL_AREA_WIDTH + 10)),
                round(min(geom.height() * 0.95,
                          self.CONTROL_AREA_HEIGHT + 10))))

        self.setFixedHeight(self.geometry().height())
        self.setFixedWidth(self.geometry().width())

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        self.text_area = oasysgui.textArea(height=self.CONTROL_AREA_HEIGHT -
                                           10,
                                           width=self.CONTROL_AREA_WIDTH - 5,
                                           readOnly=True)
        self.text_area.setText("")
        self.text_area.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")

        self.controlArea.layout().addWidget(self.text_area)
示例#3
0
    def __init__(self):
        super().__init__()

        layout = QVBoxLayout()

        self.code_area = oasysgui.textArea(readOnly=False)
        self.code_area.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")
        self.console = PythonConsole(self.__dict__, self)

        button_box = oasysgui.widgetBox(None,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")
        gui.button(button_box,
                   self,
                   "Run Script",
                   callback=self.execute_script,
                   height=40)
        gui.button(button_box,
                   self,
                   "Save Script to File",
                   callback=self.save_script,
                   height=40)

        layout.addWidget(self.code_area)
        layout.addWidget(self.console)
        layout.addWidget(button_box)

        self.setLayout(layout)
示例#4
0
    def __init__(self, show_automatic_box=True):
        super().__init__(show_automatic_box)

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        view_box = oasysgui.widgetBox(plot_tab, "Plotting Style", addSpace=False, orientation="horizontal")
        view_box_1 = oasysgui.widgetBox(view_box, "", addSpace=False, orientation="vertical", width=350)

        self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="Select level of Plotting",
                                            labelWidth=220,
                                            items=["Detailed Plot", "Preview", "None"],
                                            callback=self.set_PlotQuality, sendSelectedValue=False, orientation="horizontal")
        self.tab = []
        self.tabs = oasysgui.tabWidget(plot_tab)

        self.initializeTabs()

        self.enableFootprint(False)

        self.shadow_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal")
        out_box.layout().addWidget(self.shadow_output)
示例#5
0
    def __init__(self):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(QRect(round(geom.width() * 0.05),
                               round(geom.height() * 0.05),
                               round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                               round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        gui.separator(self.controlArea)

        button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal")

        button = gui.button(button_box, self, "Read Thickness", callback=self.read_surface)
        button.setFixedHeight(45)

        button = gui.button(button_box, self, "Render Thickness", callback=self.render_surface)
        button.setFixedHeight(45)

        input_box_l = oasysgui.widgetBox(self.controlArea, "Input", addSpace=True, orientation="vertical", height=460, width=self.CONTROL_AREA_WIDTH)

        gui.button(input_box_l, self, "Select Thickness Error Profile Data Files", callback=self.select_files)

        self.files_area = oasysgui.textArea(height=250)

        self.refresh_files_text_area()

        input_box_l.layout().addWidget(self.files_area)


        gui.comboBox(input_box_l, self, "separator", label="Separator", labelWidth=350,
                     items=["Comma", "Space"], sendSelectedValue=False, orientation="horizontal")

        oasysgui.lineEdit(input_box_l, self, "skip_rows", label="Skip Rows", labelWidth=350, orientation="horizontal", valueType=int)

        oasysgui.lineEdit(input_box_l, self, "conversion_to_m_z", label="Thickness conversion to m", labelWidth=300, orientation="horizontal", valueType=float)
        oasysgui.lineEdit(input_box_l, self, "conversion_to_m_xy", label="Coordinates conversion to m", labelWidth=300, orientation="horizontal", valueType=float)

        gui.comboBox(input_box_l, self, "negate", label="Invert Surface", labelWidth=350,
                     items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal")


        main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(main_tabs, "Thickness Error Surfaces")

        self.tab = []
        self.tabs = oasysgui.tabWidget(plot_tab)

        self.initialize_figures()

        gui.rubber(self.controlArea)
        gui.rubber(self.mainArea)
    def __init__(self):
        super(FluxCalculator, self).__init__()

        self.runaction = OWAction("Calculate Flux", self)
        self.runaction.triggered.connect(self.calculate_flux)
        self.addAction(self.runaction)

        self.setMaximumWidth(self.CONTROL_AREA_WIDTH + 10)
        self.setMaximumHeight(580)

        box0 = gui.widgetBox(self.controlArea, "", orientation="horizontal")
        gui.button(box0,
                   self,
                   "Calculate Flux",
                   callback=self.calculate_flux,
                   height=45)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(440)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 8)

        tab_out = oasysgui.createTabPage(tabs_setting,
                                         "Flux Calculation Results")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        self.text = oasysgui.textArea(width=self.CONTROL_AREA_WIDTH - 22,
                                      height=400)

        tab_out.layout().addWidget(self.text)

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)

        gui.rubber(self.controlArea)
示例#7
0
    def draw_specific_box(self):

        self.crystal_box = oasysgui.widgetBox(self.tab_bas, "Crystal Setting", addSpace=False, orientation="vertical")

        oasysgui.lineEdit(self.crystal_box, self, "d_spacing", "d-spacing [Å]", labelWidth=260, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(self.crystal_box, self, "asymmetry_angle", "Asymmetry Angle [rad]", labelWidth=260, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(self.crystal_box, self, "thickness", "Crystal Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal")

        polarization_box = oasysgui.widgetBox(self.crystal_box, "Crystal Polarizability", addSpace=False, orientation="horizontal")

        polarization_box_l = oasysgui.widgetBox(polarization_box, "", addSpace=False, orientation="vertical", width=200)
        polarization_box_r = oasysgui.widgetBox(polarization_box, "", addSpace=False, orientation="vartical")

        gui.label(polarization_box_l, self, "               Real Part")
        oasysgui.lineEdit(polarization_box_l, self, "psi_0r" , "X0", labelWidth=50, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(polarization_box_l, self, "psi_hr" , "Xh \u03c3", labelWidth=50, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(polarization_box_l, self, "psi_hbr", "Xh \u03c0", labelWidth=50, valueType=float, orientation="horizontal")

        gui.label(polarization_box_r, self, "Imaginary Part")
        oasysgui.lineEdit(polarization_box_r, self, "psi_0i",  "", labelWidth=50, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(polarization_box_r, self, "psi_hi",  "", labelWidth=50, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(polarization_box_r, self, "psi_hbi", "", labelWidth=50, valueType=float, orientation="horizontal")

        self.notes_area = oasysgui.textArea(height=40, width=370)
        self.notes_area.setText(self.notes)

        self.crystal_box.layout().addWidget(self.notes_area)

        tab_usa = oasysgui.createTabPage(self.tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa, "", addSpace=True, orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)
    def __init__(self):
        super().__init__()

        #/ Make GUI ----------------------------------------------------------------------------------------------------
        self.runaction = OWAction("Import Simulated Array", self)
        self.runaction.triggered.connect(self.selectFile)
        self.addAction(self.runaction)

        self.runaction = OWAction("Generate Height Profile File", self)
        self.runaction.triggered.connect(self.interp_save)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        gui.separator(self.controlArea)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Import Simulated\nArray",
                            callback=self.selectFile)
        button.setFixedHeight(45)

        button = gui.button(button_box,
                            self,
                            "Generate Height\nProfile File",
                            callback=self.interp_save)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        button.setFixedHeight(45)
        button.setFixedWidth(150)

        button = gui.button(button_box,
                            self,
                            "Reset Fields",
                            callback=self.call_reset_settings)
        button.setFixedHeight(45)

        #/ Control area ------------------------------------------------------------------------------------------------

        gui.separator(self.controlArea)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        tab_input = oasysgui.createTabPage(tabs_setting, "Input Parameters")
        tab_out = oasysgui.createTabPage(tabs_setting, "Output")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.get_usage_path()))

        usage_box.layout().addWidget(label)

        #/ ---------------------------------------

        select_file_box_1 = oasysgui.widgetBox(tab_input,
                                               "",
                                               addSpace=True,
                                               orientation="horizontal")
        self.wi_simFE_fname = oasysgui.lineEdit(select_file_box_1,
                                                self,
                                                "simFE_fname",
                                                "Input Array Path",
                                                labelWidth=120,
                                                valueType=str,
                                                orientation="horizontal")

        input_box = oasysgui.widgetBox(tab_input,
                                       "Transformation settings",
                                       addSpace=True,
                                       orientation="vertical")

        gui.comboBox(input_box,
                     self,
                     "unit",
                     label="Unit",
                     labelWidth=260,
                     items=["m", "cm"],
                     callback=None,
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(input_box)
        gui.separator(input_box)

        gui.comboBox(input_box,
                     self,
                     "method",
                     label="Select method",
                     labelWidth=260,
                     items=["Spacing", "Number of points"],
                     callback=self.set_Method,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.method_box_1 = oasysgui.widgetBox(input_box,
                                               "",
                                               addSpace=True,
                                               orientation="vertical",
                                               height=70)

        self.method_box_1_1 = oasysgui.widgetBox(self.method_box_1,
                                                 "",
                                                 addSpace=True,
                                                 orientation="vertical")
        self.wi_spacing_value = oasysgui.lineEdit(self.method_box_1_1,
                                                  self,
                                                  "spacing_value",
                                                  "Spacing size",
                                                  labelWidth=260,
                                                  valueType=float,
                                                  orientation="horizontal")

        self.method_box_1_2 = oasysgui.widgetBox(self.method_box_1,
                                                 "",
                                                 addSpace=True,
                                                 orientation="vertical")
        self.wi_noPts_x = oasysgui.lineEdit(self.method_box_1_2,
                                            self,
                                            "noPts_x",
                                            "X",
                                            labelWidth=260,
                                            valueType=int,
                                            orientation="horizontal")
        self.wi_noPts_y = oasysgui.lineEdit(self.method_box_1_2,
                                            self,
                                            "noPts_y",
                                            "Y",
                                            labelWidth=260,
                                            valueType=int,
                                            orientation="horizontal")

        self.set_Method()

        output_box = oasysgui.widgetBox(tab_input,
                                        "Output settings",
                                        addSpace=True,
                                        orientation="vertical")
        select_file_box_2 = oasysgui.widgetBox(output_box,
                                               "",
                                               addSpace=True,
                                               orientation="horizontal")
        self.wi_save_height_profile_file_name = oasysgui.lineEdit(
            select_file_box_2,
            self,
            "save_height_profile_file_name",
            "Output Array Path",
            labelWidth=120,
            valueType=str,
            orientation="horizontal")
        gui.button(select_file_box_2,
                   self,
                   "Browse",
                   callback=self.selectFile_save)

        gui.rubber(self.controlArea)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=580)
        out_box.layout().addWidget(self.shadow_output)

        gui.rubber(self.controlArea)

        self.figure, (self.axis, self.cax) = subplots(
            1, 2, gridspec_kw={'width_ratios': [95, 5]}, figsize=(600, 600))
        self.cax.grid()

        self.figure_canvas = FigureCanvasQTAgg(self.figure)
        self.mainArea.layout().addWidget(self.figure_canvas)

        gui.rubber(self.mainArea)
示例#9
0
    def __init__(self, show_automatic_box=True):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.WIDGET_WIDTH)),
                  round(min(geom.height() * 0.95, self.WIDGET_HEIGHT))))

        gen_box = gui.widgetBox(self.mainArea,
                                "Beamline Info",
                                addSpace=True,
                                orientation="horizontal")

        tabs_setting = oasysgui.tabWidget(gen_box)
        tabs_setting.setFixedHeight(self.WIDGET_HEIGHT - 60)
        tabs_setting.setFixedWidth(self.WIDGET_WIDTH - 60)

        tab_sys = oasysgui.createTabPage(tabs_setting, "Sys Info")
        tab_sys_plot_side = oasysgui.createTabPage(tabs_setting,
                                                   "Sys Plot (Side View)")
        tab_sys_plot_top = oasysgui.createTabPage(tabs_setting,
                                                  "Sys Plot (Top View)")
        tab_mir = oasysgui.createTabPage(tabs_setting, "OE Info")
        tab_sou = oasysgui.createTabPage(tabs_setting, "Source Info")
        tab_dis = oasysgui.createTabPage(tabs_setting, "Distances Summary")
        tab_scr = oasysgui.createTabPage(tabs_setting, "Python Script")
        tab_out = oasysgui.createTabPage(tabs_setting, "System Output")

        self.sysInfo = oasysgui.textArea()
        self.sysInfo.setMaximumHeight(self.WIDGET_HEIGHT - 100)

        self.sysPlotSide = oasysgui.plotWindow(tab_sys_plot_side)
        self.sysPlotSide.setMaximumHeight(self.WIDGET_HEIGHT - 100)

        self.sysPlotTop = oasysgui.plotWindow(tab_sys_plot_top)
        self.sysPlotTop.setMaximumHeight(self.WIDGET_HEIGHT - 100)

        self.mirInfo = oasysgui.textArea()
        self.mirInfo.setMaximumHeight(self.WIDGET_HEIGHT - 100)
        self.sourceInfo = oasysgui.textArea()
        self.sourceInfo.setMaximumHeight(self.WIDGET_HEIGHT - 100)
        self.distancesSummary = oasysgui.textArea()
        self.distancesSummary.setMaximumHeight(self.WIDGET_HEIGHT - 100)
        self.pythonScript = oasysgui.textArea(readOnly=False)
        self.pythonScript.setMaximumHeight(self.WIDGET_HEIGHT - 300)

        sys_box = oasysgui.widgetBox(tab_sys,
                                     "",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=self.WIDGET_HEIGHT - 80,
                                     width=self.WIDGET_WIDTH - 80)
        sys_box.layout().addWidget(self.sysInfo)

        sys_plot_side_box = oasysgui.widgetBox(tab_sys_plot_side,
                                               "",
                                               addSpace=True,
                                               orientation="horizontal",
                                               height=self.WIDGET_HEIGHT - 80,
                                               width=self.WIDGET_WIDTH - 80)
        sys_plot_side_box.layout().addWidget(self.sysPlotSide)

        sys_plot_top_box = oasysgui.widgetBox(tab_sys_plot_top,
                                              "",
                                              addSpace=True,
                                              orientation="horizontal",
                                              height=self.WIDGET_HEIGHT - 80,
                                              width=self.WIDGET_WIDTH - 80)
        sys_plot_top_box.layout().addWidget(self.sysPlotTop)

        mir_box = oasysgui.widgetBox(tab_mir,
                                     "",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=self.WIDGET_HEIGHT - 80,
                                     width=self.WIDGET_WIDTH - 80)
        mir_box.layout().addWidget(self.mirInfo)

        source_box = oasysgui.widgetBox(tab_sou,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal",
                                        height=self.WIDGET_HEIGHT - 80,
                                        width=self.WIDGET_WIDTH - 80)
        source_box.layout().addWidget(self.sourceInfo)

        dist_box = oasysgui.widgetBox(tab_dis,
                                      "",
                                      addSpace=True,
                                      orientation="horizontal",
                                      height=self.WIDGET_HEIGHT - 80,
                                      width=self.WIDGET_WIDTH - 80)
        dist_box.layout().addWidget(self.distancesSummary)

        script_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=True,
                                        orientation="vertical",
                                        height=self.WIDGET_HEIGHT - 80,
                                        width=self.WIDGET_WIDTH - 80)
        script_box.layout().addWidget(self.pythonScript)

        console_box = oasysgui.widgetBox(script_box,
                                         "",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=150,
                                         width=self.WIDGET_WIDTH - 80)

        self.console = PythonConsole(self.__dict__, self)
        console_box.layout().addWidget(self.console)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=self.WIDGET_HEIGHT - 80)
        out_box.layout().addWidget(self.shadow_output)

        #############################

        button_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Run Script",
                   callback=self.execute_script,
                   height=40)
        gui.button(button_box,
                   self,
                   "Save Script to File",
                   callback=self.save_script,
                   height=40)
    def initializeTabs(self):
        self.tabs = oasysgui.tabWidget(self.mainArea)

        self.tab = [
            oasysgui.createTabPage(self.tabs, "Info"),
            oasysgui.createTabPage(self.tabs, "Heights Profile"),
            oasysgui.createTabPage(self.tabs, "Slopes Profile"),
            oasysgui.createTabPage(self.tabs, "PSD Heights"),
            oasysgui.createTabPage(self.tabs, "CSD Heights"),
            oasysgui.createTabPage(self.tabs, "ACF"),
            oasysgui.createTabPage(self.tabs, "Generated 1D Profile"),
        ]

        for tab in self.tab:
            tab.setFixedHeight(self.IMAGE_HEIGHT)
            tab.setFixedWidth(self.IMAGE_WIDTH)

        self.plot_canvas = [None, None, None, None, None, None]

        self.plot_canvas[0] = oasysgui.plotWindow(roi=False,
                                                  control=False,
                                                  position=True)
        self.plot_canvas[0].setDefaultPlotLines(True)
        self.plot_canvas[0].setActiveCurveColor(color='blue')
        self.plot_canvas[0].setGraphYLabel("Z [nm]")
        self.plot_canvas[0].setGraphTitle("Heights Profile")
        self.plot_canvas[0].setInteractiveMode(mode='zoom')

        self.plot_canvas[1] = oasysgui.plotWindow(roi=False,
                                                  control=False,
                                                  position=True)
        self.plot_canvas[1].setDefaultPlotLines(True)
        self.plot_canvas[1].setActiveCurveColor(color='blue')
        self.plot_canvas[1].setGraphYLabel("Zp [$\mu$rad]")
        self.plot_canvas[1].setGraphTitle("Slopes Profile")
        self.plot_canvas[1].setInteractiveMode(mode='zoom')

        self.plot_canvas[2] = oasysgui.plotWindow(roi=False,
                                                  control=False,
                                                  position=True)
        self.plot_canvas[2].setDefaultPlotLines(True)
        self.plot_canvas[2].setActiveCurveColor(color='blue')
        self.plot_canvas[2].setGraphXLabel("f [m^-1]")
        self.plot_canvas[2].setGraphYLabel("PSD [m^3]")
        self.plot_canvas[2].setGraphTitle(
            "Power Spectral Density of Heights Profile")
        self.plot_canvas[2].setInteractiveMode(mode='zoom')
        self.plot_canvas[2].setXAxisLogarithmic(True)
        self.plot_canvas[2].setYAxisLogarithmic(True)

        self.plot_canvas[3] = oasysgui.plotWindow(roi=False,
                                                  control=False,
                                                  position=True)
        self.plot_canvas[3].setDefaultPlotLines(True)
        self.plot_canvas[3].setActiveCurveColor(color='blue')
        self.plot_canvas[3].setGraphXLabel("f [m^-1]")
        self.plot_canvas[3].setGraphYLabel("CSD [m^3]")
        self.plot_canvas[3].setGraphTitle(
            "Cumulative Spectral Density of Heights Profile")
        self.plot_canvas[3].setInteractiveMode(mode='zoom')
        self.plot_canvas[3].setXAxisLogarithmic(True)

        self.plot_canvas[4] = oasysgui.plotWindow(roi=False,
                                                  control=False,
                                                  position=True)
        self.plot_canvas[4].setDefaultPlotLines(True)
        self.plot_canvas[4].setActiveCurveColor(color='blue')
        self.plot_canvas[4].setGraphXLabel("Length [m]")
        self.plot_canvas[4].setGraphYLabel("ACF")
        self.plot_canvas[4].setGraphTitle(
            "Autocovariance Function of Heights Profile")
        self.plot_canvas[4].setInteractiveMode(mode='zoom')

        self.plot_canvas[5] = oasysgui.plotWindow(roi=False,
                                                  control=False,
                                                  position=True)
        self.plot_canvas[5].setDefaultPlotLines(True)
        self.plot_canvas[5].setActiveCurveColor(color='blue')
        self.plot_canvas[5].setGraphYLabel("Z [nm]")
        self.plot_canvas[5].setGraphTitle("Heights Profile")
        self.plot_canvas[5].setInteractiveMode(mode='zoom')

        self.profileInfo = oasysgui.textArea(height=self.IMAGE_HEIGHT - 5,
                                             width=400)

        profile_box = oasysgui.widgetBox(self.tab[0],
                                         "",
                                         addSpace=True,
                                         orientation="horizontal",
                                         height=self.IMAGE_HEIGHT,
                                         width=410)
        profile_box.layout().addWidget(self.profileInfo)

        for index in range(0, 6):
            self.tab[index + 1].layout().addWidget(self.plot_canvas[index])

        self.tabs.setCurrentIndex(1)
示例#11
0
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Compute", self)
        self.runaction.triggered.connect(self.compute)
        self.addAction(self.runaction)

        self.setFixedWidth(550)
        self.setFixedHeight(550)

        idx = -1

        gui.separator(self.controlArea)

        box0 = oasysgui.widgetBox(self.controlArea,
                                  "",
                                  orientation="horizontal")
        #widget buttons: compute, set defaults, help
        button = gui.button(box0, self, "Compute", callback=self.compute)
        button.setFixedHeight(45)
        button = gui.button(box0, self, "Defaults", callback=self.defaults)
        button.setFixedHeight(45)
        button = gui.button(box0, self, "Help", callback=self.help1)
        button.setFixedHeight(45)

        gui.separator(self.controlArea)

        tabs_setting = oasysgui.tabWidget(self.controlArea)

        tab_bas = oasysgui.createTabPage(tabs_setting, "Crystal Settings")
        tab_out = oasysgui.createTabPage(tabs_setting, "Output")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)

        #widget index 0
        idx += 1
        box = oasysgui.widgetBox(tab_bas,
                                 "Crystal Parameters",
                                 orientation="vertical")
        gui.comboBox(box,
                     self,
                     "DESCRIPTOR",
                     label=self.unitLabels()[idx],
                     addSpace=True,
                     items=self.crystals,
                     sendSelectedValue=False,
                     valueType=int,
                     orientation="horizontal",
                     labelWidth=350)
        self.show_at(self.unitFlags()[idx], box)

        #widget index 1
        idx += 1
        box_miller = oasysgui.widgetBox(box, "", orientation="horizontal")
        oasysgui.lineEdit(box_miller,
                          self,
                          "H_MILLER_INDEX",
                          label="Miller Indices [h k l]",
                          addSpace=True,
                          valueType=int,
                          validator=QIntValidator(),
                          labelWidth=350,
                          orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box_miller)

        #widget index 2
        idx += 1
        oasysgui.lineEdit(box_miller,
                          self,
                          "K_MILLER_INDEX",
                          addSpace=True,
                          valueType=int,
                          validator=QIntValidator())
        self.show_at(self.unitFlags()[idx], box)

        #widget index 3
        idx += 1
        oasysgui.lineEdit(box_miller,
                          self,
                          "L_MILLER_INDEX",
                          addSpace=True,
                          valueType=int,
                          validator=QIntValidator(),
                          orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        gui.separator(box)

        #widget index 4
        idx += 1
        oasysgui.lineEdit(box,
                          self,
                          "TEMPERATURE_FACTOR",
                          label=self.unitLabels()[idx],
                          addSpace=True,
                          valueType=float,
                          validator=QDoubleValidator(),
                          labelWidth=350,
                          orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 5
        idx += 1
        oasysgui.lineEdit(box,
                          self,
                          "E_MIN",
                          label=self.unitLabels()[idx],
                          addSpace=True,
                          valueType=float,
                          validator=QDoubleValidator(),
                          labelWidth=350,
                          orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 6
        idx += 1
        oasysgui.lineEdit(box,
                          self,
                          "E_MAX",
                          label=self.unitLabels()[idx],
                          addSpace=True,
                          valueType=float,
                          validator=QDoubleValidator(),
                          labelWidth=350,
                          orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 7
        idx += 1
        oasysgui.lineEdit(box,
                          self,
                          "E_STEP",
                          label=self.unitLabels()[idx],
                          addSpace=True,
                          valueType=float,
                          validator=QDoubleValidator(),
                          labelWidth=350,
                          orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 8
        idx += 1
        box_2 = oasysgui.widgetBox(box,
                                   "",
                                   addSpace=True,
                                   orientation="horizontal")

        self.le_SHADOW_FILE = oasysgui.lineEdit(box_2,
                                                self,
                                                "SHADOW_FILE",
                                                label=self.unitLabels()[idx],
                                                addSpace=True,
                                                labelWidth=180,
                                                orientation="horizontal")

        gui.button(box_2, self, "...", callback=self.selectFile)

        self.show_at(self.unitFlags()[idx], box)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=400)
        out_box.layout().addWidget(self.shadow_output)

        self.process_showers()

        gui.rubber(self.controlArea)
    def __init__(self):
        super().__init__()

        self.refresh_button = gui.button(self.controlArea,
                                         self,
                                         "Refresh",
                                         callback=self.plot_results,
                                         height=45,
                                         width=400)
        gui.separator(self.controlArea, 10)

        self.tabs_setting = oasysgui.tabWidget(self.controlArea)
        self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        # graph tab
        tab_set = oasysgui.createTabPage(self.tabs_setting, "Plot Settings")
        tab_gen = oasysgui.createTabPage(self.tabs_setting,
                                         "Histogram Settings")

        general_box = oasysgui.widgetBox(tab_set,
                                         "General Settings",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=250,
                                         width=390)

        self.x_column = gui.comboBox(general_box,
                                     self,
                                     "x_column_index",
                                     label="Intensity Cut",
                                     labelWidth=250,
                                     items=["Horizontal", "Vertical"],
                                     sendSelectedValue=False,
                                     orientation="horizontal")

        gui.comboBox(general_box,
                     self,
                     "x_range",
                     label="Position Range",
                     labelWidth=250,
                     items=["<Default>", "Set.."],
                     callback=self.set_XRange,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.xrange_box = oasysgui.widgetBox(general_box,
                                             "",
                                             addSpace=True,
                                             orientation="vertical",
                                             height=100)
        self.xrange_box_empty = oasysgui.widgetBox(general_box,
                                                   "",
                                                   addSpace=True,
                                                   orientation="vertical",
                                                   height=100)

        oasysgui.lineEdit(self.xrange_box,
                          self,
                          "x_range_min",
                          "Min [\u03bcm]",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(self.xrange_box,
                          self,
                          "x_range_max",
                          "Max [\u03bcm]",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")

        self.set_XRange()

        gui.comboBox(general_box,
                     self,
                     "polarization_component_to_be_extracted",
                     label="Polarization Component",
                     labelWidth=250,
                     items=["Total", "\u03c3", "\u03c0"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(general_box,
                     self,
                     "multi_electron",
                     label="Multi Electron (Convolution)",
                     labelWidth=250,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        incremental_box = oasysgui.widgetBox(tab_gen,
                                             "Incremental Result",
                                             addSpace=True,
                                             orientation="vertical",
                                             height=290)

        gui.button(incremental_box,
                   self,
                   "Clear Stored Data",
                   callback=self.clearResults,
                   height=30)
        gui.separator(incremental_box)

        gui.comboBox(incremental_box,
                     self,
                     "iterative_mode",
                     label="Iterative Mode",
                     labelWidth=250,
                     items=["None", "Accumulating", "Scanning"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_IterativeMode)

        self.box_scan_empty = oasysgui.widgetBox(incremental_box,
                                                 "",
                                                 addSpace=False,
                                                 orientation="vertical")
        self.box_scan = oasysgui.widgetBox(incremental_box,
                                           "",
                                           addSpace=False,
                                           orientation="vertical")

        gui.comboBox(self.box_scan,
                     self,
                     "plot_type",
                     label="Plot Type",
                     labelWidth=310,
                     items=["2D", "3D"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_PlotType)

        self.box_pt_1 = oasysgui.widgetBox(self.box_scan,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           height=25)

        gui.comboBox(self.box_pt_1,
                     self,
                     "add_labels",
                     label="Add Labels (Variable Name/Value)",
                     labelWidth=310,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.box_pt_2 = oasysgui.widgetBox(self.box_scan,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           height=25)

        gui.comboBox(self.box_pt_2,
                     self,
                     "plot_type_3D",
                     label="3D Plot Aspect",
                     labelWidth=310,
                     items=["Lines", "Surface"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(self.box_scan,
                     self,
                     "has_colormap",
                     label="Colormap",
                     labelWidth=310,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(self.box_scan)

        gui.comboBox(self.box_scan,
                     self,
                     "stats_to_plot",
                     label="Stats: Spot Dimension",
                     labelWidth=310,
                     items=["Sigma", "FWHM"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(self.box_scan,
                     self,
                     "stats_to_plot_2",
                     label="Stats: Intensity",
                     labelWidth=310,
                     items=["Peak", "Integral"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.button(self.box_scan,
                   self,
                   "Export Scanning Results/Stats",
                   callback=self.export_scanning_stats_analysis,
                   height=30)

        self.set_IterativeMode()

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")

        plot_tabs = oasysgui.tabWidget(plot_tab)
        intensity_tab = oasysgui.createTabPage(plot_tabs, "Intensity")
        phase_tab = oasysgui.createTabPage(plot_tabs, "Phase")

        self.image_box = gui.widgetBox(intensity_tab,
                                       "",
                                       addSpace=False,
                                       orientation="vertical")
        self.image_box.setFixedHeight(self.IMAGE_HEIGHT - 30)
        self.image_box.setFixedWidth(self.IMAGE_WIDTH - 20)

        self.image_box_2 = gui.widgetBox(phase_tab,
                                         "",
                                         addSpace=False,
                                         orientation="vertical")
        self.image_box_2.setFixedHeight(self.IMAGE_HEIGHT - 30)
        self.image_box_2.setFixedWidth(self.IMAGE_WIDTH - 20)

        plot_tab_stats = oasysgui.createTabPage(self.main_tabs, "Stats")

        self.image_box_stats = gui.widgetBox(plot_tab_stats,
                                             "Stats Result",
                                             addSpace=True,
                                             orientation="vertical")
        self.image_box_stats.setFixedHeight(self.IMAGE_HEIGHT)
        self.image_box_stats.setFixedWidth(self.IMAGE_WIDTH)

        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        self.srw_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab,
                                "System Output",
                                addSpace=True,
                                orientation="horizontal")
        out_box.layout().addWidget(self.srw_output)
示例#13
0
    def __init__(self):
        self.runaction = OWAction("Start", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Stop", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Suspend", self)
        self.runaction.triggered.connect(self.suspendLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Restart", self)
        self.runaction.triggered.connect(self.restartLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(1200)
        self.setFixedHeight(710)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(35)

        stop_button = gui.button(button_box,
                                 self,
                                 "Stop",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        self.stop_button = stop_button

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        suspend_button = gui.button(button_box,
                                    self,
                                    "Suspend",
                                    callback=self.suspendLoop)
        suspend_button.setFixedHeight(35)
        font = QFont(suspend_button.font())
        font.setBold(True)
        suspend_button.setFont(font)
        palette = QPalette(
            suspend_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('orange'))
        suspend_button.setPalette(palette)  # assign new palette

        self.re_start_button = gui.button(button_box,
                                          self,
                                          "Restart",
                                          callback=self.restartLoop)
        self.re_start_button.setFixedHeight(35)
        self.re_start_button.setEnabled(False)

        tabs = oasysgui.tabWidget(self.controlArea)
        tab_loop = oasysgui.createTabPage(tabs, "Loop Management")
        tab_und = oasysgui.createTabPage(tabs, "Undulator")

        left_box_2 = oasysgui.widgetBox(tab_und,
                                        "Parameters From Syned",
                                        addSpace=False,
                                        orientation="vertical",
                                        width=385,
                                        height=560)

        oasysgui.lineEdit(left_box_2,
                          self,
                          "electron_energy",
                          "Ring Energy [GeV]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "number_of_periods",
                          "Number of Periods",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "period_length",
                          "Undulator Period [m]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "K_vertical",
                          "K Vertical",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "K_horizontal",
                          "K Horizontal",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)

        left_box_1 = oasysgui.widgetBox(tab_loop,
                                        "",
                                        addSpace=False,
                                        orientation="vertical",
                                        width=385,
                                        height=560)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "seed_increment",
                          "Source Montecarlo Seed Increment",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")

        gui.separator(left_box_1)

        gui.comboBox(left_box_1,
                     self,
                     "autobinning",
                     label="Energy Binning",
                     items=[
                         "Manual", "Automatic (Constant Power)",
                         "Automatic (Constant Energy)"
                     ],
                     labelWidth=150,
                     callback=self.set_Autobinning,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.autobinning_box_1 = oasysgui.widgetBox(left_box_1,
                                                    "",
                                                    addSpace=False,
                                                    orientation="vertical",
                                                    height=50)
        self.autobinning_box_2 = oasysgui.widgetBox(left_box_1,
                                                    "",
                                                    addSpace=False,
                                                    orientation="vertical",
                                                    height=140)

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

        gui.button(self.autobinning_box_1,
                   self,
                   "Compute Bins",
                   callback=self.calculate_energy_binnings)

        oasysgui.widgetLabel(self.autobinning_box_1,
                             "Energy From, Energy To, Energy Step [eV]")

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

        oasysgui.lineEdit(self.autobinning_box_2,
                          self,
                          "auto_n_step",
                          "Number of Steps",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")
        oasysgui.lineEdit(self.autobinning_box_2,
                          self,
                          "auto_perc_total_power",
                          "% Total Power",
                          labelWidth=250,
                          valueType=float,
                          orientation="horizontal")
        gui.comboBox(self.autobinning_box_2,
                     self,
                     "send_power_step",
                     label="Send Power Step",
                     items=["No", "Yes"],
                     labelWidth=350,
                     sendSelectedValue=False,
                     orientation="horizontal")

        button_box = oasysgui.widgetBox(self.autobinning_box_2,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Reload Spectrum and Filters",
                   callback=self.read_spectrum_and_filters_file)
        gui.button(button_box,
                   self,
                   "Reload Spectrum Only",
                   callback=self.read_spectrum_file_only)

        oasysgui.widgetLabel(
            self.autobinning_box_2,
            "Energy Value [eV], Energy Step [eV], Power Step [W]")

        def write_text():
            self.energies = self.text_area.toPlainText()

        self.text_area = oasysgui.textArea(height=95,
                                           width=385,
                                           readOnly=False)
        self.text_area.setText(self.energies)
        self.text_area.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")
        self.text_area.textChanged.connect(write_text)

        left_box_1.layout().addWidget(self.text_area)

        gui.separator(left_box_1)

        self.le_number_of_new_objects = oasysgui.lineEdit(
            left_box_1,
            self,
            "total_new_objects",
            "Total Energy Values",
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_number_of_new_objects.setReadOnly(True)
        font = QFont(self.le_number_of_new_objects.font())
        font.setBold(True)
        self.le_number_of_new_objects.setFont(font)
        palette = QPalette(self.le_number_of_new_objects.palette()
                           )  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_number_of_new_objects.setPalette(palette)

        self.le_number_of_new_objects = oasysgui.lineEdit(
            left_box_1,
            self,
            "number_of_new_objects",
            "Current Binning Energy Values",
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_number_of_new_objects.setReadOnly(True)
        font = QFont(self.le_number_of_new_objects.font())
        font.setBold(True)
        self.le_number_of_new_objects.setFont(font)
        palette = QPalette(self.le_number_of_new_objects.palette()
                           )  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_number_of_new_objects.setPalette(palette)

        gui.separator(left_box_1)

        le_current_value = oasysgui.lineEdit(left_box_1,
                                             self,
                                             "total_current_new_object",
                                             "Total New " +
                                             self.get_object_name(),
                                             labelWidth=250,
                                             valueType=int,
                                             orientation="horizontal")
        le_current_value.setReadOnly(True)
        font = QFont(le_current_value.font())
        font.setBold(True)
        le_current_value.setFont(font)
        palette = QPalette(
            le_current_value.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        le_current_value.setPalette(palette)

        le_current_value = oasysgui.lineEdit(left_box_1,
                                             self,
                                             "current_new_object",
                                             "Current Binning New " +
                                             self.get_object_name(),
                                             labelWidth=250,
                                             valueType=int,
                                             orientation="horizontal")
        le_current_value.setReadOnly(True)
        font = QFont(le_current_value.font())
        font.setBold(True)
        le_current_value.setFont(font)
        palette = QPalette(
            le_current_value.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        le_current_value.setPalette(palette)

        le_current_value = oasysgui.lineEdit(left_box_1,
                                             self,
                                             "current_energy_value",
                                             "Current Energy Value",
                                             labelWidth=250,
                                             valueType=float,
                                             orientation="horizontal")
        le_current_value.setReadOnly(True)
        font = QFont(le_current_value.font())
        font.setBold(True)
        le_current_value.setFont(font)
        palette = QPalette(
            le_current_value.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        le_current_value.setPalette(palette)

        gui.rubber(self.controlArea)

        tabs = oasysgui.tabWidget(self.mainArea)
        tabs.setFixedHeight(self.height() - 15)
        tabs.setFixedWidth(775)

        tab_plot = oasysgui.createTabPage(tabs, "Cumulated Power")
        tab_flux = oasysgui.createTabPage(tabs, "Spectral Flux")
        tab_fil = oasysgui.createTabPage(tabs, "Filter")

        self.cumulated_power_plot = oasysgui.plotWindow(tab_plot,
                                                        position=True)
        self.cumulated_power_plot.setFixedHeight(self.height() - 20)
        self.cumulated_power_plot.setFixedWidth(775)
        self.cumulated_power_plot.setGraphXLabel("Energy [eV]")
        self.cumulated_power_plot.setGraphYLabel("Cumulated Power [W]")
        self.cumulated_power_plot.setGraphTitle("Cumulated Power")

        self.spectral_flux_plot = oasysgui.plotWindow(tab_flux, position=True)
        self.spectral_flux_plot.setFixedHeight(self.height() - 20)
        self.spectral_flux_plot.setFixedWidth(775)
        self.spectral_flux_plot.setGraphXLabel("Energy [eV]")
        self.spectral_flux_plot.setGraphYLabel("Flux [ph/s/.1%bw]")
        self.spectral_flux_plot.setGraphTitle("Spectral Flux")

        self.filter_plot = oasysgui.plotWindow(tab_fil, position=True)
        self.filter_plot.setFixedHeight(self.height() - 20)
        self.filter_plot.setFixedWidth(775)
        self.filter_plot.setGraphXLabel("Energy [eV]")
        self.filter_plot.setGraphYLabel("Intensity Factor")
        self.filter_plot.setGraphTitle("Filter on Flux")

        self.set_Autobinning()
    def __init__(self, show_general_option_box=True, show_automatic_box=True, show_view_box=True):
        super().__init__(show_general_option_box=show_general_option_box, show_automatic_box=show_automatic_box)

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        plot_tabs = oasysgui.tabWidget(plot_tab)
        plotting_tab = oasysgui.createTabPage(plot_tabs, "Output")

        self.view_box = oasysgui.widgetBox(plotting_tab, "", addSpace=False, orientation="horizontal")

        if show_view_box:
            view_box_1 = oasysgui.widgetBox(self.view_box, "", addSpace=False, orientation="vertical", width=350)

            self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="Plot Results",
                                                labelWidth=120,
                                                items=["No", "Yes (Total Polarization)", "Yes (Polarization Components)"],
                                                callback=self.set_PlotQuality, sendSelectedValue=False, orientation="horizontal")


            range_tab = oasysgui.createTabPage(plot_tabs, "Plot Setting")
            
            range_box_1 = oasysgui.widgetBox(range_tab, "", addSpace=False, orientation="vertical", width=450)


            range_box_2 = oasysgui.widgetBox(range_box_1, "", addSpace=False, orientation="horizontal", width=450)

            self.range_combo = gui.comboBox(range_box_2, self, "use_range", label="Plotting Range",
                                            labelWidth=120,
                                            items=["No", "Yes"],
                                            callback=self.set_PlottingRange, sendSelectedValue=False, orientation="horizontal")

            self.refresh_button = gui.button(range_box_2, self, "Refresh", callback=self.replot)

            self.plot_range_box_1 = oasysgui.widgetBox(range_box_1, "", addSpace=False, orientation="vertical", width=450, height=50)
            self.plot_range_box_2 = oasysgui.widgetBox(range_box_1, "", addSpace=False, orientation="vertical", width=450, height=50)

            range_box_2 = oasysgui.widgetBox(self.plot_range_box_1, "", addSpace=False, orientation="horizontal", width=450)

            oasysgui.lineEdit(range_box_2, self, "range_x_min", "Plotting Range X min [\u03bcm]", labelWidth=170, valueType=float, orientation="horizontal")
            oasysgui.lineEdit(range_box_2, self, "range_x_max", "max [\u03bcm]", labelWidth=80, valueType=float, orientation="horizontal")

            range_box_3 = oasysgui.widgetBox(self.plot_range_box_1, "", addSpace=False, orientation="horizontal", width=450)

            oasysgui.lineEdit(range_box_3, self, "range_y_min", "Plotting Range Y min [\u03bcm]", labelWidth=170, valueType=float, orientation="horizontal")
            oasysgui.lineEdit(range_box_3, self, "range_y_max", "max [\u03bcm]", labelWidth=80, valueType=float, orientation="horizontal")

            self.set_PlottingRange()
        else:
            self.view_type = 1
            self.view_type_combo = QtWidgets.QWidget()

        self.show_view_box = show_view_box

        #* -------------------------------------------------------------------------------------------------------------
        propagation_box = oasysgui.widgetBox(self.view_box, "", addSpace=False, orientation="vertical")

        self.le_srw_live_propagation_mode = gui.lineEdit(propagation_box, self, "srw_live_propagation_mode", "Propagation Mode", labelWidth=150, valueType=str, orientation="horizontal")
        self.le_srw_live_propagation_mode.setAlignment(Qt.AlignCenter)
        self.le_srw_live_propagation_mode.setReadOnly(True)
        font = QFont(self.le_srw_live_propagation_mode.font())
        font.setBold(True)
        self.le_srw_live_propagation_mode.setFont(font)

        self.set_srw_live_propagation_mode()

        #* -------------------------------------------------------------------------------------------------------------

        self.tab = []
        self.tabs = oasysgui.tabWidget(plot_tab)

        self.initializeTabs()

        self.srw_output = oasysgui.textArea(580, 800)

        out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal")
        out_box.layout().addWidget(self.srw_output)

        self.set_PlotQuality()
示例#15
0
    def __init__(self):
        self.runaction = OWAction("Start", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Stop", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Suspend", self)
        self.runaction.triggered.connect(self.suspendLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Restart", self)
        self.runaction.triggered.connect(self.restartLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(400)
        self.setFixedHeight(500)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(35)

        stop_button = gui.button(button_box,
                                 self,
                                 "Stop",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        self.stop_button = stop_button

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        suspend_button = gui.button(button_box,
                                    self,
                                    "Suspend",
                                    callback=self.suspendLoop)
        suspend_button.setFixedHeight(35)
        font = QFont(suspend_button.font())
        font.setBold(True)
        suspend_button.setFont(font)
        palette = QPalette(
            suspend_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('orange'))
        suspend_button.setPalette(palette)  # assign new palette

        self.re_start_button = gui.button(button_box,
                                          self,
                                          "Restart",
                                          callback=self.restartLoop)
        self.re_start_button.setFixedHeight(35)
        self.re_start_button.setEnabled(False)

        left_box_1 = oasysgui.widgetBox(self.controlArea,
                                        "Loop Management",
                                        addSpace=True,
                                        orientation="vertical",
                                        width=380,
                                        height=380)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_name",
                          "Variable Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_display_name",
                          "Variable Display Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")

        box_files = oasysgui.widgetBox(left_box_1,
                                       "",
                                       addSpace=False,
                                       orientation="vertical",
                                       height=170)

        gui.button(box_files,
                   self,
                   "Select Height Error Profile Data Files",
                   callback=self.select_files)

        self.files_area = oasysgui.textArea(height=120, width=360)

        self.refresh_files_text_area()

        box_files.layout().addWidget(self.files_area)

        gui.separator(left_box_1)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_new_object",
            "Current New " + self.get_object_name(),
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_variable_value",
            "Current Variable Value",
            labelWidth=250,
            valueType=str,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        gui.rubber(self.controlArea)
    def __init__(self):
        super().__init__(show_automatic_box=False)

        button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal")

        gui.button(button_box, self, "Plot Data", callback=self.plot_cumulated_data, height=45)
        gui.button(button_box, self, "Save Plot", callback=self.save_cumulated_data, height=45)

        gui.separator(self.controlArea, 10)

        self.tabs_setting = oasysgui.tabWidget(self.controlArea)
        self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5)

        # graph tab
        tab_set = oasysgui.createTabPage(self.tabs_setting, "Plot Settings")
        tab_gen = oasysgui.createTabPage(self.tabs_setting, "Histogram Settings")
        tab_post = oasysgui.createTabPage(self.tabs_setting, "Post Processing")

        screen_box = oasysgui.widgetBox(tab_set, "Screen Position Settings", addSpace=True, orientation="vertical", height=120)

        self.image_plane_combo = gui.comboBox(screen_box, self, "image_plane", label="Position of the Image",
                                            items=["On Image Plane", "Retraced"], labelWidth=260,
                                            callback=self.set_ImagePlane, sendSelectedValue=False, orientation="horizontal")

        self.image_plane_box = oasysgui.widgetBox(screen_box, "", addSpace=False, orientation="vertical", height=50)
        self.image_plane_box_empty = oasysgui.widgetBox(screen_box, "", addSpace=False, orientation="vertical", height=50)

        oasysgui.lineEdit(self.image_plane_box, self, "image_plane_new_position", "Image Plane new Position", labelWidth=220, valueType=float, orientation="horizontal")

        gui.comboBox(self.image_plane_box, self, "image_plane_rel_abs_position", label="Position Type", labelWidth=250,
                     items=["Absolute", "Relative"], sendSelectedValue=False, orientation="horizontal")

        self.set_ImagePlane()

        general_box = oasysgui.widgetBox(tab_set, "Variables Settings", addSpace=True, orientation="vertical", height=350)

        self.x_column = gui.comboBox(general_box, self, "x_column_index", label="X Column",labelWidth=70,
                                     items=["1: X",
                                            "2: Y",
                                            "3: Z",
                                     ],
                                     sendSelectedValue=False, orientation="horizontal")

        gui.comboBox(general_box, self, "x_range", label="X Range", labelWidth=250,
                                     items=["<Default>",
                                            "Set.."],
                                     callback=self.set_XRange, sendSelectedValue=False, orientation="horizontal")

        self.xrange_box = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100)
        self.xrange_box_empty = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100)

        oasysgui.lineEdit(self.xrange_box, self, "x_range_min", "X min", labelWidth=220, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(self.xrange_box, self, "x_range_max", "X max", labelWidth=220, valueType=float, orientation="horizontal")

        self.set_XRange()

        self.y_column = gui.comboBox(general_box, self, "y_column_index", label="Y Column",labelWidth=70,
                                     items=["1: X",
                                            "2: Y",
                                            "3: Z",
                                     ],

                                     sendSelectedValue=False, orientation="horizontal")

        gui.comboBox(general_box, self, "y_range", label="Y Range",labelWidth=250,
                                     items=["<Default>",
                                            "Set.."],
                                     callback=self.set_YRange, sendSelectedValue=False, orientation="horizontal")

        self.yrange_box = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100)
        self.yrange_box_empty = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100)

        oasysgui.lineEdit(self.yrange_box, self, "y_range_min", "Y min", labelWidth=220, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(self.yrange_box, self, "y_range_max", "Y max", labelWidth=220, valueType=float, orientation="horizontal")

        self.set_YRange()

        self.cb_rays = gui.comboBox(general_box, self, "rays", label="Power", labelWidth=250,
                                    items=["Transmitted", "Absorbed (Lost)", "Absorbed (Still Good)"],
                                    sendSelectedValue=False, orientation="horizontal")

        autosave_box = oasysgui.widgetBox(tab_gen, "Autosave", addSpace=True, orientation="vertical", height=85)

        gui.comboBox(autosave_box, self, "autosave", label="Save automatically plot into file", labelWidth=250,
                                         items=["No", "Yes"],
                                         sendSelectedValue=False, orientation="horizontal", callback=self.set_autosave)

        self.autosave_box_1 = oasysgui.widgetBox(autosave_box, "", addSpace=False, orientation="horizontal", height=25)
        self.autosave_box_2 = oasysgui.widgetBox(autosave_box, "", addSpace=False, orientation="horizontal", height=25)

        self.le_autosave_file_name = oasysgui.lineEdit(self.autosave_box_1, self, "autosave_file_name", "File Name", labelWidth=100,  valueType=str, orientation="horizontal")

        gui.button(self.autosave_box_1, self, "...", callback=self.selectAutosaveFile)

        incremental_box = oasysgui.widgetBox(tab_gen, "Incremental Result", addSpace=True, orientation="vertical", height=120)

        gui.comboBox(incremental_box, self, "keep_result", label="Keep Result", labelWidth=250,
                     items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal", callback=self.set_autosave)

        self.cb_autosave_partial_results = gui.comboBox(incremental_box, self, "autosave_partial_results", label="Save partial plots into file", labelWidth=250,
                                                        items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal")

        gui.button(incremental_box, self, "Clear", callback=self.clearResults)

        self.set_autosave()

        histograms_box = oasysgui.widgetBox(tab_gen, "Histograms settings", addSpace=True, orientation="vertical", height=270)

        oasysgui.lineEdit(histograms_box, self, "number_of_bins", "Number of Bins", labelWidth=250, valueType=int, orientation="horizontal")

        gui.separator(histograms_box)

        gui.comboBox(histograms_box, self, "kind_of_calculation", label="Kind of Calculation", labelWidth=200,
                     items=["From Rays", "Flat Distribution", "Gaussian Distribution", "Lorentzian Distribution"], sendSelectedValue=False, orientation="horizontal", callback=self.set_kind_of_calculation)

        self.poor_statics_cb = gui.comboBox(histograms_box, self, "replace_poor_statistic", label="Activate on Poor Statistics", labelWidth=250,
                                            items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal", callback=self.set_manage_poor_statistics)

        self.poor_statistics_box_1 = oasysgui.widgetBox(histograms_box, "", addSpace=False, orientation="vertical", height=30)
        self.poor_statistics_box_2 = oasysgui.widgetBox(histograms_box, "", addSpace=False, orientation="vertical", height=30)

        self.le_autosave_file_name = oasysgui.lineEdit(self.poor_statistics_box_1, self, "good_rays_limit", "Good Rays Limit", labelWidth=100,  valueType=int, orientation="horizontal")

        self.kind_of_calculation_box_1 = oasysgui.widgetBox(histograms_box, "", addSpace=False, orientation="vertical", height=110)
        self.kind_of_calculation_box_2 = oasysgui.widgetBox(histograms_box, "", addSpace=False, orientation="vertical", height=110)
        self.kind_of_calculation_box_3 = oasysgui.widgetBox(histograms_box, "", addSpace=False, orientation="vertical", height=110)

        self.le_g_sigma_x = oasysgui.lineEdit(self.kind_of_calculation_box_2, self, "sigma_x", "Sigma H", labelWidth=100,  valueType=float, orientation="horizontal")
        self.le_g_sigma_y = oasysgui.lineEdit(self.kind_of_calculation_box_2, self, "sigma_y", "Sigma V", labelWidth=100,  valueType=float, orientation="horizontal")
        self.le_g_center_x = oasysgui.lineEdit(self.kind_of_calculation_box_2, self, "center_x", "Center H", labelWidth=100,  valueType=float, orientation="horizontal")
        self.le_g_center_y = oasysgui.lineEdit(self.kind_of_calculation_box_2, self, "center_y", "Center V", labelWidth=100,  valueType=float, orientation="horizontal")

        self.le_l_gamma = oasysgui.lineEdit(self.kind_of_calculation_box_3, self, "gamma", "Gamma", labelWidth=100,  valueType=float, orientation="horizontal")
        self.le_l_center_x = oasysgui.lineEdit(self.kind_of_calculation_box_3, self, "center_x", "Center H", labelWidth=100,  valueType=float, orientation="horizontal")
        self.le_l_center_y = oasysgui.lineEdit(self.kind_of_calculation_box_3, self, "center_y", "Center V", labelWidth=100,  valueType=float, orientation="horizontal")

        self.set_kind_of_calculation()

        # post porcessing

        post_box = oasysgui.widgetBox(tab_post, "Post Processing Setting", addSpace=False, orientation="vertical", height=400)

        post_box_1 = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="horizontal", height=25)
        self.le_loaded_plot_file_name = oasysgui.lineEdit(post_box_1, self, "loaded_plot_file_name", "Loaded File", labelWidth=100,  valueType=str, orientation="horizontal")
        gui.button(post_box_1, self, "...", callback=self.selectPlotFile)

        gui.separator(post_box)

        button_box = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="horizontal")
        gui.button(button_box, self, "Rebin Plot", callback=self.rebinPlot, height=35)
        gui.button(button_box, self, "Reset", callback=self.reloadPlot, height=35)

        post_box_0 = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="vertical", height=60)
        oasysgui.lineEdit(post_box_0, self, "new_nbins_h", "Nr. Bins H", labelWidth=200,  valueType=int, orientation="horizontal")
        oasysgui.lineEdit(post_box_0, self, "new_nbins_v", "Nr. Bins V", labelWidth=200,  valueType=int, orientation="horizontal")

        button_box = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="horizontal")
        gui.button(button_box, self, "Smooth Plot", callback=self.smoothPlot, height=35)
        gui.button(button_box, self, "Reset", callback=self.reloadPlot, height=35)

        gui.separator(post_box)

        gui.comboBox(post_box, self, "filter", label="Filter", labelWidth=200,
                     items=["Gaussian",
                            "Spline",
                            "Uniform",
                            "Fourier-Gaussian",
                            "Fourier-Ellipsoid",
                            "Fourier-Uniform",
                            "Fill Holes"
                            ], sendSelectedValue=False, orientation="horizontal", callback=self.set_Filter)

        self.post_box_1 = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="vertical", height=110)
        self.post_box_2 = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="vertical", height=110)
        self.post_box_3 = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="vertical", height=110)
        self.post_box_4 = oasysgui.widgetBox(post_box, "", addSpace=False, orientation="vertical", height=110)

        oasysgui.lineEdit(self.post_box_1, self, "filter_sigma_h", "Sigma/Size H", labelWidth=200,  valueType=float, orientation="horizontal")
        oasysgui.lineEdit(self.post_box_1, self, "filter_sigma_v", "Sigma/Size V", labelWidth=200,  valueType=float, orientation="horizontal")

        oasysgui.lineEdit(self.post_box_2, self, "filter_sigma_h", "Sigma/Size H", labelWidth=200,  valueType=float, orientation="horizontal")
        oasysgui.lineEdit(self.post_box_2, self, "filter_sigma_v", "Sigma/Size V", labelWidth=200,  valueType=float, orientation="horizontal")

        self.cb_filter_mode = gui.comboBox(self.post_box_2, self, "filter_mode", label="Mode", labelWidth=200,
                                           items=["reflect", "constant", "nearest", "mirror", "wrap"],
                                           sendSelectedValue=False, orientation="horizontal", callback=self.set_FilterMode)

        self.le_filter_cval = oasysgui.lineEdit(self.post_box_2, self, "filter_cval", "Constant Value", labelWidth=250,  valueType=float, orientation="horizontal")

        oasysgui.lineEdit(self.post_box_3, self, "filter_spline_order", "Spline Order", labelWidth=250,  valueType=int, orientation="horizontal")

        gui.separator(post_box)

        oasysgui.lineEdit(post_box, self, "masking_level", "Mask if < factor of max value", labelWidth=250,  valueType=float, orientation="horizontal")

        self.set_Filter()

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        view_box = oasysgui.widgetBox(plot_tab, "Plotting", addSpace=False, orientation="vertical", width=self.IMAGE_WIDTH)
        view_box_1 = oasysgui.widgetBox(view_box, "", addSpace=False, orientation="vertical", width=350)

        gui.comboBox(view_box_1, self, "view_type", label="Plot Accumulated Results", labelWidth=320,
                     items=["No", "Yes"],  sendSelectedValue=False, orientation="horizontal")

        self.image_box = gui.widgetBox(plot_tab, "Plot Result", addSpace=True, orientation="vertical")
        self.image_box.setFixedHeight(self.IMAGE_HEIGHT)
        self.image_box.setFixedWidth(self.IMAGE_WIDTH)

        self.shadow_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal")
        out_box.layout().addWidget(self.shadow_output)
示例#17
0
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Compute", self)
        self.runaction.triggered.connect(self.compute)
        self.addAction(self.runaction)

        self.setFixedWidth(550)
        self.setFixedHeight(550)

        gui.separator(self.controlArea)

        box0 = gui.widgetBox(self.controlArea, "",orientation="horizontal")
        #widget buttons: compute, set defaults, help
        button = gui.button(box0, self, "Compute", callback=self.compute)
        button.setFixedHeight(45)
        button = gui.button(box0, self, "Defaults", callback=self.defaults)
        button.setFixedHeight(45)
        button = gui.button(box0, self, "Help", callback=self.help1)
        button.setFixedHeight(45)

        gui.separator(self.controlArea)

        tabs_setting = oasysgui.tabWidget(self.controlArea)

        tab_bas = oasysgui.createTabPage(tabs_setting, "Reflectivity Settings")
        tab_out = oasysgui.createTabPage(tabs_setting, "Output")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa, "", addSpace=True, orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)

        box = oasysgui.widgetBox(tab_bas, "Reflectivity Parameters", orientation="vertical")
        
        idx = -1 
        
        #widget index 0 
        idx += 1 
        oasysgui.lineEdit(box, self, "SYMBOL",
                     label=self.unitLabels()[idx], addSpace=True, labelWidth=350, orientation="horizontal", callback=self.set_Density)
        self.show_at(self.unitFlags()[idx], box)

        #widget index 1
        idx += 1
        oasysgui.lineEdit(box, self, "DENSITY",
                     label=self.unitLabels()[idx], addSpace=True, valueType=float, labelWidth=350, orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 2
        idx += 1
        box_2 = oasysgui.widgetBox(box, "", addSpace=True, orientation="horizontal")

        self.le_SHADOW_FILE = oasysgui.lineEdit(box_2, self, "SHADOW_FILE",
                                                 label=self.unitLabels()[idx], addSpace=True, labelWidth=180, orientation="horizontal")

        gui.button(box_2, self, "...", callback=self.selectFile)

        self.show_at(self.unitFlags()[idx], box)

        #widget index 3
        idx += 1
        oasysgui.lineEdit(box, self, "E_MIN",
                     label=self.unitLabels()[idx], addSpace=True,
                    valueType=float, labelWidth=350, orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 4
        idx += 1
        oasysgui.lineEdit(box, self, "E_MAX",
                     label=self.unitLabels()[idx], addSpace=True,
                    valueType=float, labelWidth=350, orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        #widget index 5
        idx += 1
        oasysgui.lineEdit(box, self, "E_STEP",
                     label=self.unitLabels()[idx], addSpace=True,
                    valueType=float, labelWidth=350, orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box)

        self.process_showers()

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=400)
        out_box.layout().addWidget(self.shadow_output)

        gui.rubber(self.controlArea)
示例#18
0
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Run Hybrid", self)
        self.runaction.triggered.connect(self.run_hybrid)
        self.addAction(self.runaction)

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal")

        button = gui.button(button_box, self, "Run HYBRID", callback=self.run_hybrid)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette) # assign new palette
        button.setFixedHeight(45)

        main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(main_tabs, "Output")

        view_box = oasysgui.widgetBox(plot_tab, "", addSpace=False, orientation="horizontal")
        view_box_1 = oasysgui.widgetBox(view_box, "", addSpace=False, orientation="vertical", width=350)

        self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="Plot Results",
                                            labelWidth=220,
                                            items=["No", "Yes"],
                                            callback=self.set_PlotQuality, sendSelectedValue=False, orientation="horizontal")

        self.tabs = oasysgui.tabWidget(plot_tab)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5)

        tab_bas = oasysgui.createTabPage(tabs_setting, "Basic Setting")
        tab_adv = oasysgui.createTabPage(tabs_setting, "Advanced Setting")

        box_1 = oasysgui.widgetBox(tab_bas, "Calculation Parameters", addSpace=True, orientation="vertical", height=120)

        gui.comboBox(box_1, self, "ghy_diff_plane", label="Diffraction Plane", labelWidth=310,
                     items=["Sagittal", "Tangential", "Both (2D)", "Both (1D+1D)"],
                     callback=self.set_DiffPlane,
                     sendSelectedValue=False, orientation="horizontal")

        gui.comboBox(box_1, self, "ghy_calcType", label="Calculation", labelWidth=70,
                     items=self.get_calculation_type_items(),
                     callback=self.set_CalculationType,
                     sendSelectedValue=False, orientation="vertical")

        gui.separator(box_1, 10)


        box_2 = oasysgui.widgetBox(tab_bas, "Numerical Control Parameters", addSpace=True, orientation="vertical", height=140)

        self.le_nbins_x = oasysgui.lineEdit(box_2, self, "ghy_nbins_x", "Number of bins for I(Sagittal) histogram", labelWidth=260, valueType=int, orientation="horizontal")
        self.le_nbins_z = oasysgui.lineEdit(box_2, self, "ghy_nbins_z", "Number of bins for I(Tangential) histogram", labelWidth=260, valueType=int, orientation="horizontal")
        self.le_npeak   = oasysgui.lineEdit(box_2, self, "ghy_npeak", "Number of diffraction peaks", labelWidth=260, valueType=int, orientation="horizontal")
        self.le_fftnpts = oasysgui.lineEdit(box_2, self, "ghy_fftnpts", "Number of points for FFT", labelWidth=260, valueType=int, orientation="horizontal")

        box_3 = oasysgui.widgetBox(tab_adv, "Propagation Parameters", addSpace=True, orientation="vertical", height=240)


        self.cb_focal_length_calc = gui.comboBox(box_3, self, "focal_length_calc", label="Focal Length", labelWidth=180,
                     items=["Use O.E. Focal Distance", "Specify Value"],
                     callback=self.set_FocalLengthCalc,
                     sendSelectedValue=False, orientation="horizontal")

        self.le_focal_length = oasysgui.lineEdit(box_3, self, "ghy_focallength", "Focal Length value", labelWidth=260, valueType=float, orientation="horizontal")

        gui.separator(box_3)

        self.cb_distance_to_image_calc = gui.comboBox(box_3, self, "distance_to_image_calc", label="Distance to image", labelWidth=150,
                     items=["Use O.E. Image Plane Distance", "Specify Value"],
                     callback=self.set_DistanceToImageCalc,
                     sendSelectedValue=False, orientation="horizontal")

        self.le_distance_to_image = oasysgui.lineEdit(box_3, self, "ghy_distance", "Distance to Image value", labelWidth=260, valueType=float, orientation="horizontal")

        gui.separator(box_3)

        self.cb_nf = gui.comboBox(box_3, self, "ghy_nf", label="Near Field Calculation", labelWidth=310,
                                             items=["No", "Yes"],
                                             sendSelectedValue=False, orientation="horizontal", callback=self.set_NF)

        gui.separator(box_3)

        gui.comboBox(box_3, self, "send_original_beam", label="Send Original Beam in case of failure", labelWidth=310,
                                             items=["No", "Yes"],
                                             sendSelectedValue=False, orientation="horizontal")


        box_4 = oasysgui.widgetBox(tab_adv, "Geometrical Parameters", addSpace=True, orientation="vertical", height=70)

        gui.comboBox(box_4, self, "ghy_automatic", label="Analize geometry to avoid unuseful calculations", labelWidth=310,
                     items=["No", "Yes"],
                     sendSelectedValue=False, orientation="horizontal")

        self.set_DiffPlane()
        self.set_DistanceToImageCalc()
        self.set_CalculationType()
        self.set_NF()

        self.initializeTabs()

        adv_other_box = oasysgui.widgetBox(tab_bas, "Optional file output", addSpace=False, orientation="vertical")

        gui.comboBox(adv_other_box, self, "file_to_write_out", label="Files to write out", labelWidth=220,
                     items=["None", "Debug (star.xx)"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.shadow_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal")
        out_box.layout().addWidget(self.shadow_output)

        self.set_PlotQuality()
示例#19
0
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Calculate Waviness", self)
        self.runaction.triggered.connect(self.calculate_waviness_ni)
        self.addAction(self.runaction)

        self.runaction = widget.OWAction("Generate Waviness File", self)
        self.runaction.triggered.connect(self.generate_waviness_file)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        gui.separator(self.controlArea)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Calculate\nWaviness",
                            callback=self.calculate_waviness)
        button.setFixedHeight(45)

        button = gui.button(button_box,
                            self,
                            "Generate\nWaviness File",
                            callback=self.generate_waviness_file)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)
        button.setFixedWidth(150)

        button = gui.button(button_box,
                            self,
                            "Reset Fields",
                            callback=self.call_reset_settings)
        font = QFont(button.font())
        font.setItalic(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Red'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        gui.separator(self.controlArea)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        tab_input = oasysgui.createTabPage(tabs_setting, "Input Parameter")
        tab_harmonics = oasysgui.createTabPage(tabs_setting, "Harmonics")
        tab_out = oasysgui.createTabPage(tabs_setting, "Output")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)

        self.input_box = oasysgui.widgetBox(tab_input,
                                            "Inputs",
                                            addSpace=True,
                                            orientation="vertical")

        gui.button(self.input_box,
                   self,
                   "Load xsh_waviness input file ...",
                   callback=self.load_inp_file)

        gui.separator(self.input_box)

        oasysgui.lineEdit(self.input_box,
                          self,
                          "number_of_points_x",
                          "Number of Points (<201) X (width)",
                          labelWidth=260,
                          valueType=int,
                          orientation="horizontal")
        oasysgui.lineEdit(self.input_box,
                          self,
                          "number_of_points_y",
                          "Number of Points (<201) Y (length)",
                          labelWidth=260,
                          valueType=int,
                          orientation="horizontal")

        gui.separator(self.input_box)

        self.le_dimension_x = oasysgui.lineEdit(self.input_box,
                                                self,
                                                "dimension_x",
                                                "Dimensions X (width)",
                                                labelWidth=260,
                                                valueType=float,
                                                orientation="horizontal")
        self.le_dimension_y = oasysgui.lineEdit(self.input_box,
                                                self,
                                                "dimension_y",
                                                "Dimensions Y (length)",
                                                labelWidth=260,
                                                valueType=float,
                                                orientation="horizontal")

        gui.separator(self.input_box)

        oasysgui.lineEdit(self.input_box,
                          self,
                          "estimated_slope_error",
                          "Estimated slope error [arcsec]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(self.input_box,
                          self,
                          "montecarlo_seed",
                          "Monte Carlo initial seed",
                          labelWidth=260,
                          valueType=int,
                          orientation="horizontal")

        self.output_box = oasysgui.widgetBox(tab_input,
                                             "Outputs",
                                             addSpace=True,
                                             orientation="vertical")

        gui.button(self.output_box,
                   self,
                   "Write xsh_waviness input file (optional) ...",
                   callback=self.write_inp_file)

        gui.separator(self.output_box)

        self.select_file_box = oasysgui.widgetBox(self.output_box,
                                                  "",
                                                  addSpace=True,
                                                  orientation="horizontal")

        self.le_waviness_file_name = oasysgui.lineEdit(
            self.select_file_box,
            self,
            "waviness_file_name",
            "Output File Name",
            labelWidth=120,
            valueType=str,
            orientation="horizontal")

        gui.button(self.select_file_box, self, "...", callback=self.selectFile)

        self.harmonics_box = oasysgui.widgetBox(tab_harmonics,
                                                "Harmonics",
                                                addSpace=True,
                                                orientation="vertical",
                                                height=580)

        oasysgui.lineEdit(self.harmonics_box,
                          self,
                          "harmonic_maximum_index",
                          "Harmonic Maximum Index",
                          labelWidth=260,
                          valueType=int,
                          orientation="horizontal",
                          callback=self.set_harmonics)

        gui.separator(self.harmonics_box)

        self.scrollarea = QScrollArea()
        self.scrollarea.setMaximumWidth(400)

        self.harmonics_box.layout().addWidget(self.scrollarea,
                                              alignment=Qt.AlignHCenter)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=580)
        out_box.layout().addWidget(self.shadow_output)

        gui.rubber(self.controlArea)

        self.figure = Figure(figsize=(600, 600))
        self.figure.patch.set_facecolor('white')

        self.axis = self.figure.add_subplot(111, projection='3d')

        self.axis.set_zlabel("Z [nm]")

        self.figure_canvas = FigureCanvas3D(ax=self.axis, fig=self.figure)
        self.mainArea.layout().addWidget(self.figure_canvas)

        gui.rubber(self.mainArea)
示例#20
0
    def __init__(self):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.runaction = OWAction("Run Action", self)
        self.runaction.triggered.connect(self.run_action)
        self.addAction(self.runaction)

        # CONTROL AREA
        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        general_options_box = oasysgui.widgetBox(self.controlArea,
                                                 "General Options",
                                                 addSpace=True,
                                                 orientation="vertical",
                                                 width=400)

        oasysgui.lineEdit(general_options_box,
                          self,
                          "field_1",
                          label="Field 1",
                          labelWidth=250,
                          addSpace=False,
                          valueType=float,
                          orientation="horizontal")

        oasysgui.lineEdit(general_options_box,
                          self,
                          "field_2",
                          label="Field 2",
                          labelWidth=250,
                          addSpace=False,
                          valueType=str,
                          orientation="horizontal")

        gui.comboBox(general_options_box,
                     self,
                     "field_3",
                     label="Field 3",
                     items=["Option 1", "Option 2", "Option 3", "Option 4"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_field_3)

        gui.radioButtons(general_options_box,
                         self,
                         "field_4",
                         ["Option 1", "Option 2", "Option 3", "Option 4"],
                         callback=self.set_field_4)

        gui.checkBox(general_options_box, self, 'field_5', 'Field 5')

        file_box = oasysgui.widgetBox(general_options_box,
                                      "",
                                      addSpace=False,
                                      orientation="horizontal",
                                      height=25)

        self.le_file = oasysgui.lineEdit(file_box,
                                         self,
                                         "file",
                                         label="some file",
                                         addSpace=False,
                                         orientation="horizontal")

        gui.button(file_box, self, "...", callback=self.select_file)

        text_area_box = oasysgui.widgetBox(general_options_box,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           width=390,
                                           height=330)

        self.text_area = oasysgui.textArea(height=320,
                                           width=380,
                                           readOnly=False)
        self.text_area.setText(self.notes)
        self.text_area.textChanged.connect(self.set_text_area)

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

        gui.separator(general_options_box)

        gui.button(general_options_box,
                   self,
                   "Run Action",
                   callback=self.run_action,
                   height=45)

        self.call_callbacks()

        # MAIN AREA
        self.main_tabs = oasysgui.tabWidget(self.mainArea)

        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")
示例#21
0
    def __init__(self, show_automatic_box=True):
        super().__init__()

        gui.button(self.controlArea,
                   self,
                   "Calculate",
                   callback=self.calculate,
                   height=45)

        general_box = oasysgui.widgetBox(self.controlArea,
                                         "General Settings",
                                         addSpace=True,
                                         orientation="vertical",
                                         width=self.CONTROL_AREA_WIDTH - 8,
                                         height=220)

        gui.comboBox(general_box,
                     self,
                     "mode",
                     label="Mode",
                     labelWidth=250,
                     items=[
                         "Center at Origin", "Center at Baricenter",
                         "Define Center..."
                     ],
                     callback=self.set_Center,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.center_box = oasysgui.widgetBox(general_box,
                                             "",
                                             addSpace=False,
                                             orientation="vertical",
                                             height=50)
        self.center_box_empty = oasysgui.widgetBox(general_box,
                                                   "",
                                                   addSpace=False,
                                                   orientation="vertical",
                                                   height=50)

        self.le_center_x = oasysgui.lineEdit(self.center_box,
                                             self,
                                             "center_x",
                                             "Center X",
                                             labelWidth=260,
                                             valueType=float,
                                             orientation="horizontal")
        self.le_center_z = oasysgui.lineEdit(self.center_box,
                                             self,
                                             "center_z",
                                             "Center Z",
                                             labelWidth=260,
                                             valueType=float,
                                             orientation="horizontal")

        self.set_Center()

        gui.comboBox(general_box,
                     self,
                     "y_range",
                     label="Y Range",
                     labelWidth=250,
                     items=["<Default>", "Set.."],
                     callback=self.set_YRange,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.yrange_box = oasysgui.widgetBox(general_box,
                                             "",
                                             addSpace=False,
                                             orientation="vertical",
                                             height=100)
        self.yrange_box_empty = oasysgui.widgetBox(general_box,
                                                   "",
                                                   addSpace=False,
                                                   orientation="vertical",
                                                   height=100)

        self.le_y_range_min = oasysgui.lineEdit(self.yrange_box,
                                                self,
                                                "y_range_min",
                                                "Y min",
                                                labelWidth=260,
                                                valueType=float,
                                                orientation="horizontal")
        self.le_y_range_max = oasysgui.lineEdit(self.yrange_box,
                                                self,
                                                "y_range_max",
                                                "Y max",
                                                labelWidth=260,
                                                valueType=float,
                                                orientation="horizontal")
        oasysgui.lineEdit(self.yrange_box,
                          self,
                          "y_npoints",
                          "Points",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")

        self.set_YRange()

        screen_box = oasysgui.widgetBox(self.controlArea,
                                        "Screen Position Settings",
                                        addSpace=True,
                                        orientation="vertical",
                                        height=110)

        self.image_plane_combo = gui.comboBox(
            screen_box,
            self,
            "image_plane",
            label="Position of the Image",
            items=["On Image Plane", "Retraced"],
            labelWidth=260,
            callback=self.set_ImagePlane,
            sendSelectedValue=False,
            orientation="horizontal")

        self.image_plane_box = oasysgui.widgetBox(screen_box,
                                                  "",
                                                  addSpace=True,
                                                  orientation="vertical",
                                                  height=110)
        self.image_plane_box_empty = oasysgui.widgetBox(screen_box,
                                                        "",
                                                        addSpace=True,
                                                        orientation="vertical",
                                                        height=110)

        oasysgui.lineEdit(self.image_plane_box,
                          self,
                          "image_plane_new_position",
                          "Image Plane new Position",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")

        gui.comboBox(self.image_plane_box,
                     self,
                     "image_plane_rel_abs_position",
                     label="Position Type",
                     labelWidth=250,
                     items=["Absolute", "Relative"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.set_ImagePlane()

        gui.separator(self.controlArea, height=200)

        tabs_setting = oasysgui.tabWidget(self.mainArea)
        tabs_setting.setFixedHeight(self.IMAGE_HEIGHT + 5)
        tabs_setting.setFixedWidth(self.IMAGE_WIDTH)

        tab_info = oasysgui.createTabPage(tabs_setting, "Focnew Info")
        tab_scan = oasysgui.createTabPage(tabs_setting, "Focnew Scan")

        self.focnewInfo = oasysgui.textArea(height=self.IMAGE_HEIGHT - 35)

        info_box = oasysgui.widgetBox(tab_info,
                                      "",
                                      addSpace=True,
                                      orientation="horizontal",
                                      height=self.IMAGE_HEIGHT - 20,
                                      width=self.IMAGE_WIDTH - 20)
        info_box.layout().addWidget(self.focnewInfo)

        self.image_box = gui.widgetBox(tab_scan,
                                       "Scan",
                                       addSpace=True,
                                       orientation="vertical")
        self.image_box.setFixedHeight(self.IMAGE_HEIGHT - 30)
        self.image_box.setFixedWidth(self.IMAGE_WIDTH - 20)
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Run Hybrid", self)
        self.runaction.triggered.connect(self.run_hybrid)
        self.addAction(self.runaction)

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Run HYBRID",
                            callback=self.run_hybrid)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(main_tabs, "Output")

        self.tabs = oasysgui.tabWidget(plot_tab)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        tab_bas = oasysgui.createTabPage(tabs_setting, "Basic Setting")
        tab_adv = oasysgui.createTabPage(tabs_setting, "Advanced Setting")

        box_1 = oasysgui.widgetBox(tab_bas,
                                   "Calculation Parameters",
                                   addSpace=True,
                                   orientation="vertical",
                                   height=100)

        gui.comboBox(
            box_1,
            self,
            "ghy_diff_plane",
            label="Diffraction Plane",
            labelWidth=310,
            items=["Sagittal", "Tangential", "Both (2D)", "Both (1D+1D)"],
            callback=self.set_DiffPlane,
            sendSelectedValue=False,
            orientation="horizontal")

        gui.comboBox(box_1,
                     self,
                     "ghy_calcType",
                     label="Calculation",
                     labelWidth=70,
                     items=[
                         "Diffraction by Mirror Size + Figure Errors",
                         "Diffraction by Grating Size + Figure Errors",
                     ],
                     callback=self.set_CalculationType,
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(box_1, 10)

        box_files = oasysgui.widgetBox(tab_bas,
                                       "Height Error Profiles",
                                       addSpace=True,
                                       orientation="vertical",
                                       height=180)

        gui.button(box_files,
                   self,
                   "Select Height Error Profile Data Files",
                   callback=self.select_files)

        self.files_area = oasysgui.textArea(height=120, width=360)

        self.refresh_files_text_area()

        box_files.layout().addWidget(self.files_area)

        box_2 = oasysgui.widgetBox(tab_bas,
                                   "Numerical Control Parameters",
                                   addSpace=True,
                                   orientation="vertical",
                                   height=140)

        self.le_nbins_x = oasysgui.lineEdit(
            box_2,
            self,
            "ghy_nbins_x",
            "Number of bins for I(Sagittal) histogram",
            labelWidth=260,
            valueType=int,
            orientation="horizontal")
        self.le_nbins_z = oasysgui.lineEdit(
            box_2,
            self,
            "ghy_nbins_z",
            "Number of bins for I(Tangential) histogram",
            labelWidth=260,
            valueType=int,
            orientation="horizontal")
        self.le_npeak = oasysgui.lineEdit(box_2,
                                          self,
                                          "ghy_npeak",
                                          "Number of diffraction peaks",
                                          labelWidth=260,
                                          valueType=int,
                                          orientation="horizontal")
        self.le_fftnpts = oasysgui.lineEdit(box_2,
                                            self,
                                            "ghy_fftnpts",
                                            "Number of points for FFT",
                                            labelWidth=260,
                                            valueType=int,
                                            orientation="horizontal")

        box_3 = oasysgui.widgetBox(tab_adv,
                                   "Propagation Parameters",
                                   addSpace=True,
                                   orientation="vertical",
                                   height=200)

        self.cb_focal_length_calc = gui.comboBox(
            box_3,
            self,
            "focal_length_calc",
            label="Focal Length",
            labelWidth=180,
            items=["Use O.E. Focal Distance", "Specify Value"],
            callback=self.set_FocalLengthCalc,
            sendSelectedValue=False,
            orientation="horizontal")

        self.le_focal_length = oasysgui.lineEdit(box_3,
                                                 self,
                                                 "ghy_focallength",
                                                 "Focal Length value",
                                                 labelWidth=260,
                                                 valueType=float,
                                                 orientation="horizontal")

        gui.separator(box_3)

        self.cb_distance_to_image_calc = gui.comboBox(
            box_3,
            self,
            "distance_to_image_calc",
            label="Distance to image",
            labelWidth=150,
            items=["Use O.E. Image Plane Distance", "Specify Value"],
            callback=self.set_DistanceToImageCalc,
            sendSelectedValue=False,
            orientation="horizontal")

        self.le_distance_to_image = oasysgui.lineEdit(
            box_3,
            self,
            "ghy_distance",
            "Distance to Image value",
            labelWidth=260,
            valueType=float,
            orientation="horizontal")

        gui.separator(box_3)

        self.cb_nf = gui.comboBox(box_3,
                                  self,
                                  "ghy_nf",
                                  label="Near Field Calculation",
                                  labelWidth=310,
                                  items=["No", "Yes"],
                                  sendSelectedValue=False,
                                  orientation="horizontal",
                                  callback=self.set_NF)

        box_4 = oasysgui.widgetBox(tab_adv,
                                   "Geometrical Parameters",
                                   addSpace=True,
                                   orientation="vertical",
                                   height=70)

        gui.comboBox(box_4,
                     self,
                     "ghy_automatic",
                     label="Analize geometry to avoid unuseful calculations",
                     labelWidth=310,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        box_5 = oasysgui.widgetBox(tab_adv,
                                   "Plot Setting",
                                   addSpace=True,
                                   orientation="vertical",
                                   height=150)

        gui.comboBox(box_5,
                     self,
                     "plot_type",
                     label="Plot Type",
                     labelWidth=310,
                     items=["2D", "3D"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_PlotType)

        self.box_pt_1 = oasysgui.widgetBox(box_5,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           height=30)
        self.box_pt_2 = oasysgui.widgetBox(box_5,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           height=30)

        gui.comboBox(self.box_pt_2,
                     self,
                     "plot_type_3D",
                     label="3D Plot Aspect",
                     labelWidth=310,
                     items=["Lines", "Surface"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.set_DiffPlane()
        self.set_DistanceToImageCalc()
        self.set_CalculationType()
        self.set_NF()
        self.set_PlotType()

        self.initializeTabs()

        adv_other_box = oasysgui.widgetBox(tab_bas,
                                           "Export Data",
                                           addSpace=False,
                                           orientation="vertical")

        gui.button(adv_other_box,
                   self,
                   "Export Error Analysis",
                   callback=self.export_error_analysis)

        self.shadow_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab,
                                "System Output",
                                addSpace=True,
                                orientation="horizontal")
        out_box.layout().addWidget(self.shadow_output)
示例#23
0
    def __init__(self, show_automatic_box=True):
        super().__init__(show_automatic_box=show_automatic_box)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Refresh Script",
                            callback=self.refresh_script)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        button = gui.button(button_box,
                            self,
                            "Reset Fields",
                            callback=self.callResetSettings)
        font = QFont(button.font())
        font.setItalic(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Red'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)
        button.setFixedWidth(150)

        gui.separator(self.controlArea)

        gen_box = oasysgui.widgetBox(self.controlArea,
                                     "COMSYL Beamline Propagation",
                                     addSpace=False,
                                     orientation="vertical",
                                     height=530,
                                     width=self.CONTROL_AREA_WIDTH - 5)

        figure_box0 = oasysgui.widgetBox(gen_box,
                                         "",
                                         addSpace=True,
                                         orientation="horizontal")
        self.id_comsyl_af_file = oasysgui.lineEdit(figure_box0,
                                                   self,
                                                   "COMSYL_AF_FILE",
                                                   "Comsyl File with Modes:",
                                                   labelWidth=90,
                                                   valueType=str,
                                                   orientation="horizontal")
        gui.button(figure_box0,
                   self,
                   "...",
                   callback=self.select_comsyl_af_file)

        figure_box = oasysgui.widgetBox(gen_box,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")
        self.id_bl_pickle_file = oasysgui.lineEdit(figure_box,
                                                   self,
                                                   "BL_PICKLE_FILE",
                                                   "BL Pickle File:",
                                                   labelWidth=90,
                                                   valueType=str,
                                                   orientation="horizontal")
        gui.button(figure_box,
                   self,
                   "...",
                   callback=self.select_bl_pickle_file)

        oasysgui.lineEdit(gen_box,
                          self,
                          "MODE_INDEX",
                          label="Maximum Mode index",
                          addSpace=False,
                          valueType=int,
                          validator=QIntValidator(),
                          orientation="horizontal",
                          labelWidth=150)

        oasysgui.lineEdit(gen_box,
                          self,
                          "DIRECTORY_NAME",
                          "Temporal Directory",
                          labelWidth=160,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(gen_box,
                          self,
                          "PYTHON_INTERPRETER",
                          "Python interpreter",
                          labelWidth=160,
                          valueType=str,
                          orientation="horizontal")

        tabs_setting = oasysgui.tabWidget(self.mainArea)
        tabs_setting.setFixedHeight(self.IMAGE_HEIGHT)
        tabs_setting.setFixedWidth(self.IMAGE_WIDTH)

        tab_scr = oasysgui.createTabPage(tabs_setting, "Python Script")
        tab_out = oasysgui.createTabPage(tabs_setting, "System Output")

        self.pythonScript = oasysgui.textArea(readOnly=False)
        self.pythonScript.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")
        self.pythonScript.setMaximumHeight(self.IMAGE_HEIGHT - 250)

        script_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=False,
                                        orientation="vertical",
                                        height=self.IMAGE_HEIGHT - 10,
                                        width=self.IMAGE_WIDTH - 10)
        script_box.layout().addWidget(self.pythonScript)

        console_box = oasysgui.widgetBox(script_box,
                                         "",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=150,
                                         width=self.IMAGE_WIDTH - 10)

        self.console = PythonConsole(self.__dict__, self)
        console_box.layout().addWidget(self.console)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=self.IMAGE_WIDTH - 45)
        out_box.layout().addWidget(self.shadow_output)

        button_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Run Script",
                   callback=self.execute_script,
                   height=40)
        gui.button(button_box,
                   self,
                   "Save Script to File",
                   callback=self.save_script,
                   height=40)
示例#24
0
    def __init__(self):
        super().__init__()

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Refresh",
                   callback=self.plot_results,
                   height=45)
        gui.button(button_box,
                   self,
                   "Save Current Plot",
                   callback=self.save_results,
                   height=45)

        gui.separator(self.controlArea, 10)

        self.tabs_setting = oasysgui.tabWidget(self.controlArea)
        self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        # graph tab
        tab_set = oasysgui.createTabPage(self.tabs_setting, "Plot Settings")
        tab_gen = oasysgui.createTabPage(self.tabs_setting,
                                         "Histogram Settings")

        screen_box = oasysgui.widgetBox(tab_set,
                                        "Screen Position Settings",
                                        addSpace=True,
                                        orientation="vertical",
                                        height=120)

        self.image_plane_combo = gui.comboBox(
            screen_box,
            self,
            "image_plane",
            label="Position of the Image",
            items=["On Image Plane", "Retraced"],
            labelWidth=260,
            callback=self.set_ImagePlane,
            sendSelectedValue=False,
            orientation="horizontal")

        self.image_plane_box = oasysgui.widgetBox(screen_box,
                                                  "",
                                                  addSpace=False,
                                                  orientation="vertical",
                                                  height=50)
        self.image_plane_box_empty = oasysgui.widgetBox(screen_box,
                                                        "",
                                                        addSpace=False,
                                                        orientation="vertical",
                                                        height=50)

        oasysgui.lineEdit(self.image_plane_box,
                          self,
                          "image_plane_new_position",
                          "Image Plane new Position",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")

        gui.comboBox(self.image_plane_box,
                     self,
                     "image_plane_rel_abs_position",
                     label="Position Type",
                     labelWidth=250,
                     items=["Absolute", "Relative"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.set_ImagePlane()

        general_box = oasysgui.widgetBox(tab_set,
                                         "General Settings",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=250)

        self.x_column = gui.comboBox(
            general_box,
            self,
            "x_column_index",
            label="Column",
            labelWidth=70,
            items=[
                "1: X",
                "2: Y",
                "3: Z",
                "4: X'",
                "5: Y'",
                "6: Z'",
                "7: E\u03c3 X",
                "8: E\u03c3 Y",
                "9: E\u03c3 Z",
                "10: Ray Flag",
                "11: Energy",
                "12: Ray Index",
                "13: Optical Path",
                "14: Phase \u03c3",
                "15: Phase \u03c0",
                "16: E\u03c0 X",
                "17: E\u03c0 Y",
                "18: E\u03c0 Z",
                "19: Wavelength",
                "20: R = sqrt(X\u00b2 + Y\u00b2 + Z\u00b2)",
                "21: Theta (angle from Y axis)",
                "22: Magnitude = |E\u03c3| + |E\u03c0|",
                "23: Total Intensity = |E\u03c3|\u00b2 + |E\u03c0|\u00b2",
                "24: \u03a3 Intensity = |E\u03c3|\u00b2",
                "25: \u03a0 Intensity = |E\u03c0|\u00b2",
                "26: |K|",
                "27: K X",
                "28: K Y",
                "29: K Z",
                "30: S0-stokes = |E\u03c0|\u00b2 + |E\u03c3|\u00b2",
                "31: S1-stokes = |E\u03c0|\u00b2 - |E\u03c3|\u00b2",
                "32: S2-stokes = 2|E\u03c3||E\u03c0|cos(Phase \u03c3-Phase \u03c0)",
                "33: S3-stokes = 2|E\u03c3||E\u03c0|sin(Phase \u03c3-Phase \u03c0)",
                "34: Power = Intensity * Energy",
            ],
            sendSelectedValue=False,
            orientation="horizontal")

        gui.comboBox(general_box,
                     self,
                     "x_range",
                     label="X Range",
                     labelWidth=250,
                     items=["<Default>", "Set.."],
                     callback=self.set_XRange,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.xrange_box = oasysgui.widgetBox(general_box,
                                             "",
                                             addSpace=True,
                                             orientation="vertical",
                                             height=100)
        self.xrange_box_empty = oasysgui.widgetBox(general_box,
                                                   "",
                                                   addSpace=True,
                                                   orientation="vertical",
                                                   height=100)

        oasysgui.lineEdit(self.xrange_box,
                          self,
                          "x_range_min",
                          "X min",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(self.xrange_box,
                          self,
                          "x_range_max",
                          "X max",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")

        self.set_XRange()

        self.weight_column = gui.comboBox(
            general_box,
            self,
            "weight_column_index",
            label="Weight",
            labelWidth=70,
            items=[
                "0: No Weight",
                "1: X",
                "2: Y",
                "3: Z",
                "4: X'",
                "5: Y'",
                "6: Z'",
                "7: E\u03c3 X",
                "8: E\u03c3 Y",
                "9: E\u03c3 Z",
                "10: Ray Flag",
                "11: Energy",
                "12: Ray Index",
                "13: Optical Path",
                "14: Phase \u03c3",
                "15: Phase \u03c0",
                "16: E\u03c0 X",
                "17: E\u03c0 Y",
                "18: E\u03c0 Z",
                "19: Wavelength",
                "20: R = sqrt(X\u00b2 + Y\u00b2 + Z\u00b2)",
                "21: Theta (angle from Y axis)",
                "22: Magnitude = |E\u03c3| + |E\u03c0|",
                "23: Total Intensity = |E\u03c3|\u00b2 + |E\u03c0|\u00b2",
                "24: \u03a3 Intensity = |E\u03c3|\u00b2",
                "25: \u03a0 Intensity = |E\u03c0|\u00b2",
                "26: |K|",
                "27: K X",
                "28: K Y",
                "29: K Z",
                "30: S0-stokes = |E\u03c0|\u00b2 + |E\u03c3|\u00b2",
                "31: S1-stokes = |E\u03c0|\u00b2 - |E\u03c3|\u00b2",
                "32: S2-stokes = 2|E\u03c3||E\u03c0|cos(Phase \u03c3-Phase \u03c0)",
                "33: S3-stokes = 2|E\u03c3||E\u03c0|sin(Phase \u03c3-Phase \u03c0)",
                "34: Power = Intensity * Energy",
            ],
            sendSelectedValue=False,
            orientation="horizontal")

        gui.comboBox(general_box,
                     self,
                     "rays",
                     label="Rays",
                     labelWidth=250,
                     items=["All rays", "Good Only", "Lost Only"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        autosave_box = oasysgui.widgetBox(tab_gen,
                                          "Autosave",
                                          addSpace=True,
                                          orientation="vertical",
                                          height=85)

        gui.comboBox(autosave_box,
                     self,
                     "autosave",
                     label="Save automatically plot into file",
                     labelWidth=250,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_autosave)

        self.autosave_box_1 = oasysgui.widgetBox(autosave_box,
                                                 "",
                                                 addSpace=False,
                                                 orientation="horizontal",
                                                 height=25)
        self.autosave_box_2 = oasysgui.widgetBox(autosave_box,
                                                 "",
                                                 addSpace=False,
                                                 orientation="horizontal",
                                                 height=25)

        self.le_autosave_file_name = oasysgui.lineEdit(
            self.autosave_box_1,
            self,
            "autosave_file_name",
            "File Name",
            labelWidth=100,
            valueType=str,
            orientation="horizontal")

        gui.button(self.autosave_box_1,
                   self,
                   "...",
                   callback=self.selectAutosaveFile)

        incremental_box = oasysgui.widgetBox(tab_gen,
                                             "Incremental Result",
                                             addSpace=True,
                                             orientation="vertical",
                                             height=120)

        gui.comboBox(incremental_box,
                     self,
                     "keep_result",
                     label="Keep Result",
                     labelWidth=250,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_autosave)

        self.cb_autosave_partial_results = gui.comboBox(
            incremental_box,
            self,
            "autosave_partial_results",
            label="Save partial plots into file",
            labelWidth=250,
            items=["No", "Yes"],
            sendSelectedValue=False,
            orientation="horizontal")

        gui.button(incremental_box, self, "Clear", callback=self.clearResults)

        histograms_box = oasysgui.widgetBox(tab_gen,
                                            "Histograms settings",
                                            addSpace=True,
                                            orientation="vertical",
                                            height=90)

        oasysgui.lineEdit(histograms_box,
                          self,
                          "number_of_bins",
                          "Number of Bins",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")

        gui.comboBox(histograms_box,
                     self,
                     "is_conversion_active",
                     label="Is U.M. conversion active",
                     labelWidth=250,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.set_autosave()

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        self.image_box = gui.widgetBox(plot_tab,
                                       "Plot Result",
                                       addSpace=True,
                                       orientation="vertical")
        self.image_box.setFixedHeight(self.IMAGE_HEIGHT)
        self.image_box.setFixedWidth(self.IMAGE_WIDTH)

        self.shadow_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab,
                                "System Output",
                                addSpace=True,
                                orientation="horizontal")
        out_box.layout().addWidget(self.shadow_output)
示例#25
0
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Compute", self)
        self.runaction.triggered.connect(self.compute)
        self.addAction(self.runaction)

        self.setFixedWidth(1170)
        self.setFixedHeight(500)

        gui.separator(self.controlArea)

        box0 = oasysgui.widgetBox(self.controlArea,
                                  "",
                                  orientation="horizontal")
        #widget buttons: compute, set defaults, help
        button = gui.button(box0, self, "Compute", callback=self.compute)
        button.setFixedHeight(45)
        button = gui.button(box0, self, "Defaults", callback=self.defaults)
        button.setFixedHeight(45)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(425)

        tab_step_1 = oasysgui.createTabPage(tabs_setting,
                                            "Line Density Calculation")
        tab_step_2 = oasysgui.createTabPage(tabs_setting, "Angles Calculation")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)

        box = oasysgui.widgetBox(tab_step_1,
                                 "VLS-PGM Layout Parameters",
                                 orientation="vertical")

        self.le_r_a = oasysgui.lineEdit(box,
                                        self,
                                        "r_a",
                                        "Distance Source-Grating",
                                        labelWidth=260,
                                        valueType=float,
                                        orientation="horizontal")
        self.le_r_b = oasysgui.lineEdit(box,
                                        self,
                                        "r_b",
                                        "Distance Grating-Exit Slits",
                                        labelWidth=260,
                                        valueType=float,
                                        orientation="horizontal")
        self.le_h = oasysgui.lineEdit(box,
                                      self,
                                      "h",
                                      "Vertical Distance Mirror-Grating",
                                      labelWidth=260,
                                      valueType=float,
                                      orientation="horizontal")
        self.le_l_e = oasysgui.lineEdit(
            box,
            self,
            "last_element_distance",
            "Distance Source-Last Image Plane\nbefore Mirror (if present)",
            labelWidth=260,
            valueType=float,
            orientation="horizontal")

        self.le_k = oasysgui.lineEdit(box,
                                      self,
                                      "k",
                                      "Line Density (0th coeff.)",
                                      labelWidth=260,
                                      valueType=float,
                                      orientation="horizontal")

        gui.separator(box)

        box_2 = oasysgui.widgetBox(tab_step_1,
                                   "Grating Design Parameters",
                                   orientation="vertical")

        gui.comboBox(box_2,
                     self,
                     "units_in_use",
                     label="Units in use",
                     labelWidth=260,
                     items=["eV", "Angstroms"],
                     callback=self.set_UnitsInUse,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.autosetting_box_units_1 = oasysgui.widgetBox(
            box_2, "", addSpace=False, orientation="vertical")

        oasysgui.lineEdit(self.autosetting_box_units_1,
                          self,
                          "photon_energy",
                          "Photon energy [eV]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")

        self.autosetting_box_units_2 = oasysgui.widgetBox(
            box_2, "", addSpace=False, orientation="vertical")

        oasysgui.lineEdit(self.autosetting_box_units_2,
                          self,
                          "photon_wavelength",
                          "Wavelength [Å]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")

        self.set_UnitsInUse()

        oasysgui.lineEdit(box_2,
                          self,
                          "c",
                          "C factor for optimized energy",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(box_2,
                          self,
                          "grating_diffraction_order",
                          "Diffraction Order (- for inside orders)",
                          labelWidth=260,
                          valueType=int,
                          orientation="horizontal")

        ##################################

        box_3 = oasysgui.widgetBox(tab_step_2,
                                   "Ray-Tracing Parameter",
                                   orientation="vertical")

        gui.comboBox(box_3,
                     self,
                     "new_units_in_use",
                     label="Units in use",
                     labelWidth=260,
                     items=["eV", "Angstroms"],
                     callback=self.set_UnitsInUse2,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.autosetting_box_units_3 = oasysgui.widgetBox(
            box_3, "", addSpace=False, orientation="vertical")

        oasysgui.lineEdit(self.autosetting_box_units_3,
                          self,
                          "new_photon_energy",
                          "New photon energy [eV]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")

        self.autosetting_box_units_4 = oasysgui.widgetBox(
            box_3, "", addSpace=False, orientation="vertical")

        oasysgui.lineEdit(self.autosetting_box_units_4,
                          self,
                          "new_photon_wavelength",
                          "New wavelength [Å]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal")

        self.set_UnitsInUse2()

        tabs_out = oasysgui.tabWidget(self.mainArea)

        tab_out_1 = oasysgui.createTabPage(tabs_out, "Calculation Results")
        tab_out_2 = oasysgui.createTabPage(tabs_out, "Output")

        figure_box_1 = oasysgui.widgetBox(tab_out_1,
                                          "",
                                          addSpace=True,
                                          orientation="horizontal")

        label = QLabel("")
        label.setPixmap(QPixmap(self.image_path))

        figure_box_1.layout().addWidget(label)

        output_box = oasysgui.widgetBox(tab_out_1,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        output_box_1 = oasysgui.widgetBox(output_box,
                                          "Design Ouput",
                                          addSpace=True,
                                          orientation="vertical")

        oasysgui.lineEdit(output_box_1,
                          self,
                          "design_alpha",
                          "Alpha [deg]",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(output_box_1,
                          self,
                          "design_beta",
                          "Beta [deg]",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        gui.separator(output_box_1)
        self.le_shadow_coeff_0 = oasysgui.lineEdit(output_box_1,
                                                   self,
                                                   "shadow_coeff_0",
                                                   "Line Density 0-coeff.",
                                                   labelWidth=220,
                                                   valueType=float,
                                                   orientation="horizontal")
        self.le_shadow_coeff_1 = oasysgui.lineEdit(output_box_1,
                                                   self,
                                                   "shadow_coeff_1",
                                                   "Line Density 1-coeff.",
                                                   labelWidth=220,
                                                   valueType=float,
                                                   orientation="horizontal")
        self.le_shadow_coeff_2 = oasysgui.lineEdit(output_box_1,
                                                   self,
                                                   "shadow_coeff_2",
                                                   "Line Density 2-coeff.",
                                                   labelWidth=220,
                                                   valueType=float,
                                                   orientation="horizontal")
        self.le_shadow_coeff_3 = oasysgui.lineEdit(output_box_1,
                                                   self,
                                                   "shadow_coeff_3",
                                                   "Line Density 3-coeff.",
                                                   labelWidth=220,
                                                   valueType=float,
                                                   orientation="horizontal")

        output_box_2 = oasysgui.widgetBox(output_box,
                                          "Ray-Tracing Ouput",
                                          addSpace=True,
                                          orientation="vertical")

        oasysgui.lineEdit(output_box_2,
                          self,
                          "raytracing_alpha",
                          "Alpha [deg]",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(output_box_2,
                          self,
                          "raytracing_beta",
                          "Beta [deg]",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        gui.separator(output_box_2)
        self.le_d_source_to_mirror = oasysgui.lineEdit(
            output_box_2,
            self,
            "d_source_to_mirror",
            "Source to Mirror distance",
            labelWidth=230,
            valueType=float,
            orientation="horizontal")
        self.le_d_source_plane_to_mirror = oasysgui.lineEdit(
            output_box_2,
            self,
            "d_source_plane_to_mirror",
            "Source Plane to Mirror distance",
            labelWidth=230,
            valueType=float,
            orientation="horizontal")
        self.le_d_mirror_to_grating = oasysgui.lineEdit(
            output_box_2,
            self,
            "d_mirror_to_grating",
            "Mirror to Grating distance",
            labelWidth=230,
            valueType=float,
            orientation="horizontal")

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out_2,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=400)
        out_box.layout().addWidget(self.shadow_output)

        gui.rubber(self.controlArea)
    def __init__(self, show_automatic_box=True, show_general_option_box=True):
        super().__init__()  # show_automatic_box=show_automatic_box)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

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

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

        #
        #
        #
        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Refresh Script",
                            callback=self.refresh_script)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        gui.separator(self.controlArea)

        gen_box = oasysgui.widgetBox(self.controlArea,
                                     "Scan modes",
                                     addSpace=False,
                                     orientation="vertical",
                                     width=self.CONTROL_AREA_WIDTH - 5)
        oasysgui.lineEdit(gen_box,
                          self,
                          "mode_index_max",
                          "Max mode (index)",
                          labelWidth=150,
                          valueType=int,
                          orientation="horizontal",
                          callback=self.refresh_script)

        gen_box = oasysgui.widgetBox(self.controlArea,
                                     "Script file",
                                     addSpace=False,
                                     orientation="vertical",
                                     width=self.CONTROL_AREA_WIDTH - 5)
        gui.comboBox(gen_box,
                     self,
                     "script_file_flag",
                     label="write file with script",
                     items=["No", "Yes"],
                     labelWidth=300,
                     sendSelectedValue=False,
                     orientation="horizontal")
        box1 = gui.widgetBox(gen_box, orientation="horizontal")
        oasysgui.lineEdit(box1,
                          self,
                          "script_file_name",
                          "Script File Name",
                          labelWidth=150,
                          valueType=str,
                          orientation="horizontal")
        self.show_at("self.script_file_flag == 1", box1)

        gen_box = oasysgui.widgetBox(self.controlArea,
                                     "Output Graph and Data",
                                     addSpace=False,
                                     orientation="vertical",
                                     width=self.CONTROL_AREA_WIDTH - 5)
        gui.comboBox(gen_box,
                     self,
                     "show_graph_flag",
                     label="show plots",
                     items=["No", "Yes"],
                     labelWidth=300,
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(gen_box,
                     self,
                     "graph_file_flag",
                     label="dump plots to file",
                     items=["No", "Yes [png]", "Yes [pdf]"],
                     labelWidth=300,
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(gen_box,
                     self,
                     "data_file_flag",
                     label="dump plot data to file",
                     items=["No", "Yes"],
                     labelWidth=300,
                     sendSelectedValue=False,
                     orientation="horizontal")

        box3 = gui.widgetBox(gen_box, orientation="horizontal")
        oasysgui.lineEdit(box3,
                          self,
                          "root_file_name",
                          "Data File Name Root",
                          labelWidth=150,
                          valueType=str,
                          orientation="horizontal")

        self.show_at("self.graph_file_flag > 0 or self.data_file_flag == 1",
                     box3)

        tabs_setting = oasysgui.tabWidget(self.mainArea)
        tabs_setting.setFixedHeight(self.IMAGE_HEIGHT)
        tabs_setting.setFixedWidth(self.IMAGE_WIDTH)

        tab_scr = oasysgui.createTabPage(tabs_setting, "Python Script")
        tab_out = oasysgui.createTabPage(tabs_setting, "System Output")

        self.pythonScript = oasysgui.textArea(readOnly=False)
        self.pythonScript.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")
        self.pythonScript.setMaximumHeight(self.IMAGE_HEIGHT - 250)

        script_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=False,
                                        orientation="vertical",
                                        height=self.IMAGE_HEIGHT - 10,
                                        width=self.IMAGE_WIDTH - 10)
        script_box.layout().addWidget(self.pythonScript)

        console_box = oasysgui.widgetBox(script_box,
                                         "",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=150,
                                         width=self.IMAGE_WIDTH - 10)

        self.console = PythonConsole(self.__dict__, self)
        console_box.layout().addWidget(self.console)

        self.wofry_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=self.IMAGE_WIDTH - 45)
        out_box.layout().addWidget(self.wofry_output)

        #############################

        button_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Run Script",
                   callback=self.execute_script,
                   height=40)
        # gui.button(button_box, self, "Save Script to File", callback=self.save_script, height=40)

        gui.rubber(self.controlArea)

        self.process_showers()
示例#27
0
    def __init__(self):
        super().__init__()

        self.refresh_button = gui.button(self.controlArea,
                                         self,
                                         "Refresh",
                                         callback=self.plot_results,
                                         height=45)
        gui.separator(self.controlArea, 10)

        self.tabs_setting = oasysgui.tabWidget(self.controlArea)
        self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        # graph tab
        tab_set = oasysgui.createTabPage(self.tabs_setting, "Plot Settings")
        tab_gen = oasysgui.createTabPage(self.tabs_setting,
                                         "Histogram Settings")

        screen_box = oasysgui.widgetBox(tab_set,
                                        "Screen Position Settings",
                                        addSpace=True,
                                        orientation="vertical",
                                        height=120)

        self.image_plane_combo = gui.comboBox(
            screen_box,
            self,
            "image_plane",
            label="Position of the Image",
            items=["On Image Plane", "Retraced"],
            labelWidth=260,
            callback=self.set_ImagePlane,
            sendSelectedValue=False,
            orientation="horizontal")

        self.image_plane_box = oasysgui.widgetBox(screen_box,
                                                  "",
                                                  addSpace=False,
                                                  orientation="vertical",
                                                  height=50)
        self.image_plane_box_empty = oasysgui.widgetBox(screen_box,
                                                        "",
                                                        addSpace=False,
                                                        orientation="vertical",
                                                        height=50)

        oasysgui.lineEdit(self.image_plane_box,
                          self,
                          "image_plane_new_position",
                          "Image Plane new Position",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")

        gui.comboBox(self.image_plane_box,
                     self,
                     "image_plane_rel_abs_position",
                     label="Position Type",
                     labelWidth=250,
                     items=["Absolute", "Relative"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.set_ImagePlane()

        general_box = oasysgui.widgetBox(tab_set,
                                         "General Settings",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=250)

        self.x_column = gui.comboBox(
            general_box,
            self,
            "x_column_index",
            label="Column",
            labelWidth=70,
            items=[
                "1: X",
                "2: Y",
                "3: Z",
                "4: X'",
                "5: Y'",
                "6: Z'",
                "7: E\u03c3 X",
                "8: E\u03c3 Y",
                "9: E\u03c3 Z",
                "10: Ray Flag",
                "11: Energy",
                "12: Ray Index",
                "13: Optical Path",
                "14: Phase \u03c3",
                "15: Phase \u03c0",
                "16: E\u03c0 X",
                "17: E\u03c0 Y",
                "18: E\u03c0 Z",
                "19: Wavelength",
                "20: R = sqrt(X\u00b2 + Y\u00b2 + Z\u00b2)",
                "21: Theta (angle from Y axis)",
                "22: Magnitude = |E\u03c3| + |E\u03c0|",
                "23: Total Intensity = |E\u03c3|\u00b2 + |E\u03c0|\u00b2",
                "24: \u03a3 Intensity = |E\u03c3|\u00b2",
                "25: \u03a0 Intensity = |E\u03c0|\u00b2",
                "26: |K|",
                "27: K X",
                "28: K Y",
                "29: K Z",
                "30: S0-stokes = |E\u03c0|\u00b2 + |E\u03c3|\u00b2",
                "31: S1-stokes = |E\u03c0|\u00b2 - |E\u03c3|\u00b2",
                "32: S2-stokes = 2|E\u03c3||E\u03c0|cos(Phase \u03c3-Phase \u03c0)",
                "33: S3-stokes = 2|E\u03c3||E\u03c0|sin(Phase \u03c3-Phase \u03c0)",
                "34: Power = Intensity * Energy",
            ],
            sendSelectedValue=False,
            orientation="horizontal")

        gui.comboBox(general_box,
                     self,
                     "x_range",
                     label="X Range",
                     labelWidth=250,
                     items=["<Default>", "Set.."],
                     callback=self.set_XRange,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.xrange_box = oasysgui.widgetBox(general_box,
                                             "",
                                             addSpace=True,
                                             orientation="vertical",
                                             height=100)
        self.xrange_box_empty = oasysgui.widgetBox(general_box,
                                                   "",
                                                   addSpace=True,
                                                   orientation="vertical",
                                                   height=100)

        oasysgui.lineEdit(self.xrange_box,
                          self,
                          "x_range_min",
                          "X min",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(self.xrange_box,
                          self,
                          "x_range_max",
                          "X max",
                          labelWidth=220,
                          valueType=float,
                          orientation="horizontal")

        self.set_XRange()

        self.weight_column = gui.comboBox(
            general_box,
            self,
            "weight_column_index",
            label="Weight",
            labelWidth=70,
            items=[
                "0: No Weight",
                "1: X",
                "2: Y",
                "3: Z",
                "4: X'",
                "5: Y'",
                "6: Z'",
                "7: E\u03c3 X",
                "8: E\u03c3 Y",
                "9: E\u03c3 Z",
                "10: Ray Flag",
                "11: Energy",
                "12: Ray Index",
                "13: Optical Path",
                "14: Phase \u03c3",
                "15: Phase \u03c0",
                "16: E\u03c0 X",
                "17: E\u03c0 Y",
                "18: E\u03c0 Z",
                "19: Wavelength",
                "20: R = sqrt(X\u00b2 + Y\u00b2 + Z\u00b2)",
                "21: Theta (angle from Y axis)",
                "22: Magnitude = |E\u03c3| + |E\u03c0|",
                "23: Total Intensity = |E\u03c3|\u00b2 + |E\u03c0|\u00b2",
                "24: \u03a3 Intensity = |E\u03c3|\u00b2",
                "25: \u03a0 Intensity = |E\u03c0|\u00b2",
                "26: |K|",
                "27: K X",
                "28: K Y",
                "29: K Z",
                "30: S0-stokes = |E\u03c0|\u00b2 + |E\u03c3|\u00b2",
                "31: S1-stokes = |E\u03c0|\u00b2 - |E\u03c3|\u00b2",
                "32: S2-stokes = 2|E\u03c3||E\u03c0|cos(Phase \u03c3-Phase \u03c0)",
                "33: S3-stokes = 2|E\u03c3||E\u03c0|sin(Phase \u03c3-Phase \u03c0)",
                "34: Power = Intensity * Energy",
            ],
            sendSelectedValue=False,
            orientation="horizontal")

        gui.comboBox(general_box,
                     self,
                     "rays",
                     label="Rays",
                     labelWidth=250,
                     items=["All rays", "Good Only", "Lost Only"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        incremental_box = oasysgui.widgetBox(tab_gen,
                                             "Incremental Result",
                                             addSpace=True,
                                             orientation="vertical",
                                             height=320)

        gui.button(incremental_box,
                   self,
                   "Clear Stored Data",
                   callback=self.clearResults,
                   height=30)
        gui.separator(incremental_box)

        gui.comboBox(incremental_box,
                     self,
                     "iterative_mode",
                     label="Iterative Mode",
                     labelWidth=250,
                     items=["None", "Accumulating", "Scanning"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_IterativeMode)

        self.box_scan_empty = oasysgui.widgetBox(incremental_box,
                                                 "",
                                                 addSpace=False,
                                                 orientation="vertical")
        self.box_scan = oasysgui.widgetBox(incremental_box,
                                           "",
                                           addSpace=False,
                                           orientation="vertical")

        gui.comboBox(self.box_scan,
                     self,
                     "plot_type",
                     label="Plot Type",
                     labelWidth=310,
                     items=["2D", "3D"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_PlotType)

        self.box_pt_1 = oasysgui.widgetBox(self.box_scan,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           height=25)

        gui.comboBox(self.box_pt_1,
                     self,
                     "add_labels",
                     label="Add Labels (Variable Name/Value)",
                     labelWidth=310,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.box_pt_2 = oasysgui.widgetBox(self.box_scan,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           height=25)

        gui.comboBox(self.box_pt_2,
                     self,
                     "plot_type_3D",
                     label="3D Plot Aspect",
                     labelWidth=310,
                     items=["Lines", "Surface"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(self.box_scan,
                     self,
                     "has_colormap",
                     label="Colormap",
                     labelWidth=310,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(self.box_scan)

        gui.comboBox(self.box_scan,
                     self,
                     "sigma_fwhm_size",
                     label="Stats: Spot Dimension",
                     labelWidth=310,
                     items=["Sigma", "FWHM"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(self.box_scan,
                     self,
                     "peak_integral_intensity",
                     label="Stats: Intensity (1)",
                     labelWidth=310,
                     items=["Peak", "Integral"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.comboBox(self.box_scan,
                     self,
                     "absolute_relative_intensity",
                     label="Stats: Intensity (2)",
                     labelWidth=310,
                     items=["Relative", "Absolute"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.button(self.box_scan,
                   self,
                   "Export Scanning Results/Stats",
                   callback=self.export_scanning_stats_analysis,
                   height=30)

        self.set_IterativeMode()

        histograms_box = oasysgui.widgetBox(tab_gen,
                                            "Histograms settings",
                                            addSpace=True,
                                            orientation="vertical",
                                            height=90)

        oasysgui.lineEdit(histograms_box,
                          self,
                          "number_of_bins",
                          "Number of Bins",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")

        gui.comboBox(histograms_box,
                     self,
                     "is_conversion_active",
                     label="Is U.M. conversion active",
                     labelWidth=250,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        plot_tab_stats = oasysgui.createTabPage(self.main_tabs, "Stats")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        self.image_box = gui.widgetBox(plot_tab,
                                       "Plot Result",
                                       addSpace=True,
                                       orientation="vertical")
        self.image_box.setFixedHeight(self.IMAGE_HEIGHT)
        self.image_box.setFixedWidth(self.IMAGE_WIDTH)

        self.image_box_stats = gui.widgetBox(plot_tab_stats,
                                             "Stats Result",
                                             addSpace=True,
                                             orientation="vertical")
        self.image_box_stats.setFixedHeight(self.IMAGE_HEIGHT)
        self.image_box_stats.setFixedWidth(self.IMAGE_WIDTH)

        self.shadow_output = oasysgui.textArea(height=580, width=800)

        out_box = gui.widgetBox(out_tab,
                                "System Output",
                                addSpace=True,
                                orientation="horizontal")
        out_box.layout().addWidget(self.shadow_output)
    def __init__(self, show_automatic_box=True):
        super().__init__(show_automatic_box=show_automatic_box)

        button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal")

        button = gui.button(button_box, self, "Refresh Script", callback=self.refresh_script)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette) # assign new palette
        button.setFixedHeight(45)

        button = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings)
        font = QFont(button.font())
        font.setItalic(True)
        button.setFont(font)
        palette = QPalette(button.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Red'))
        button.setPalette(palette) # assign new palette
        button.setFixedHeight(45)
        button.setFixedWidth(150)

        gui.separator(self.controlArea)

        gen_box = oasysgui.widgetBox(self.controlArea, "SRW Native Code: ME", addSpace=False, orientation="vertical", height=530, width=self.CONTROL_AREA_WIDTH-5)

        oasysgui.lineEdit(gen_box, self, "sampFactNxNyForProp", "Sampling factor for adjusting nx, ny\n(effective if > 0)", labelWidth=260, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(gen_box, self, "nMacroElec", "Total Nr. of Electrons (Wavefronts)", labelWidth=260, valueType=int, orientation="horizontal")
        oasysgui.lineEdit(gen_box, self, "nMacroElecAvgOneProc", "Nr. of Electrons (Wavefronts) to average on each node\n(for MPI calculations)", labelWidth=260, valueType=int, orientation="horizontal")
        oasysgui.lineEdit(gen_box, self, "nMacroElecSavePer", "Saving periodicity (in terms of Electrons)\nfor the Resulting Intensity", labelWidth=260, valueType=int, orientation="horizontal")
        oasysgui.lineEdit(gen_box, self, "srCalcMeth", "SR calculation method (1 - undulator)", labelWidth=260, valueType=int, orientation="horizontal")
        oasysgui.lineEdit(gen_box, self, "srCalcPrec", "SR calculation relative accuracy", labelWidth=260, valueType=float, orientation="horizontal")
        oasysgui.lineEdit(gen_box, self, "strIntPropME_OutFileName", "Output File Name", labelWidth=150, valueType=str, orientation="horizontal")

        gui.comboBox(gen_box, self, "_char", label="Calculation",
                     items=["Total Intensity", "Mutual Intensity"], labelWidth=300,
                     sendSelectedValue=False, orientation="horizontal")

        tabs_setting = oasysgui.tabWidget(self.mainArea)
        tabs_setting.setFixedHeight(self.IMAGE_HEIGHT)
        tabs_setting.setFixedWidth(self.IMAGE_WIDTH)

        tab_scr = oasysgui.createTabPage(tabs_setting, "Python Script")
        tab_out = oasysgui.createTabPage(tabs_setting, "System Output")

        self.pythonScript = oasysgui.textArea(readOnly=False)
        self.pythonScript.setStyleSheet("background-color: white; font-family: Courier, monospace;")
        self.pythonScript.setMaximumHeight(self.IMAGE_HEIGHT - 250)

        script_box = oasysgui.widgetBox(tab_scr, "", addSpace=False, orientation="vertical", height=self.IMAGE_HEIGHT - 10, width=self.IMAGE_WIDTH - 10)
        script_box.layout().addWidget(self.pythonScript)

        console_box = oasysgui.widgetBox(script_box, "", addSpace=True, orientation="vertical",
                                          height=150, width=self.IMAGE_WIDTH - 10)

        self.console = PythonConsole(self.__dict__, self)
        console_box.layout().addWidget(self.console)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=self.IMAGE_WIDTH - 45)
        out_box.layout().addWidget(self.shadow_output)

        #############################

        button_box = oasysgui.widgetBox(tab_scr, "", addSpace=True, orientation="horizontal")

        gui.button(button_box, self, "Run Script", callback=self.execute_script, height=40)
        gui.button(button_box, self, "Save Script to File", callback=self.save_script, height=40)
    def __init__(self):
        super().__init__()

        self.runaction = widget.OWAction("Calculate Height Profile", self)
        self.runaction.triggered.connect(self.calculate_heigth_profile_ni)
        self.addAction(self.runaction)

        self.runaction = widget.OWAction("Generate Height Profile File", self)
        self.runaction.triggered.connect(self.generate_heigth_profile_file_ni)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        # DABAM INITIALIZATION
        self.server = dabam.dabam()
        self.server.set_input_silent(True)

        gui.separator(self.controlArea)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Calculate Height\nProfile",
                            callback=self.calculate_heigth_profile)
        button.setFixedHeight(45)

        button = gui.button(button_box,
                            self,
                            "Generate Height\nProfile File",
                            callback=self.generate_heigth_profile_file)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Blue'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)
        button.setFixedWidth(150)

        button = gui.button(button_box,
                            self,
                            "Reset Fields",
                            callback=self.call_reset_settings)
        font = QFont(button.font())
        font.setItalic(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('Dark Red'))
        button.setPalette(palette)  # assign new palette
        button.setFixedHeight(45)

        gui.separator(self.controlArea)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        tab_input = oasysgui.createTabPage(tabs_setting,
                                           "DABAM Search Setting")
        tab_gener = oasysgui.createTabPage(tabs_setting,
                                           "DABAM Generation Setting")
        tab_out = oasysgui.createTabPage(tabs_setting, "Output")

        manual_box = oasysgui.widgetBox(tab_input,
                                        "Manual Entry",
                                        addSpace=True,
                                        orientation="vertical")

        oasysgui.lineEdit(manual_box,
                          self,
                          "entry_number",
                          "Entry Number",
                          labelWidth=300,
                          valueType=int,
                          orientation="horizontal")

        gui.separator(manual_box)

        button = gui.button(manual_box,
                            self,
                            "Retrieve Profile",
                            callback=self.retrieve_profile)
        button.setFixedHeight(35)
        button.setFixedWidth(self.CONTROL_AREA_WIDTH - 35)

        input_box = oasysgui.widgetBox(tab_input,
                                       "Search Parameters",
                                       addSpace=True,
                                       orientation="vertical")

        gui.comboBox(input_box,
                     self,
                     "shape",
                     label="Mirror Shape",
                     labelWidth=300,
                     items=[
                         "All", "Plane", "Cylindrical", "Elliptical",
                         "Toroidal", "Spherical"
                     ],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(input_box)

        input_box_1 = oasysgui.widgetBox(input_box,
                                         "",
                                         addSpace=True,
                                         orientation="horizontal")

        oasysgui.lineEdit(input_box_1,
                          self,
                          "slope_error_from",
                          "Slope Error From (" + u"\u03BC" + "rad)",
                          labelWidth=150,
                          valueType=float,
                          orientation="horizontal")
        oasysgui.lineEdit(input_box_1,
                          self,
                          "slope_error_to",
                          "To (" + u"\u03BC" + "rad)",
                          labelWidth=60,
                          valueType=float,
                          orientation="horizontal")

        input_box_2 = oasysgui.widgetBox(input_box,
                                         "",
                                         addSpace=True,
                                         orientation="horizontal")

        self.le_dimension_y_from = oasysgui.lineEdit(input_box_2,
                                                     self,
                                                     "dimension_y_from",
                                                     "Mirror Length From",
                                                     labelWidth=150,
                                                     valueType=float,
                                                     orientation="horizontal")
        self.le_dimension_y_to = oasysgui.lineEdit(input_box_2,
                                                   self,
                                                   "dimension_y_to",
                                                   "To",
                                                   labelWidth=60,
                                                   valueType=float,
                                                   orientation="horizontal")

        table_box = oasysgui.widgetBox(tab_input,
                                       "Search Results",
                                       addSpace=True,
                                       orientation="vertical",
                                       height=250)

        self.overlay_search = Overlay(table_box, self.search_profiles)
        self.overlay_search.hide()

        button = gui.button(input_box,
                            self,
                            "Search",
                            callback=self.overlay_search.show)
        button.setFixedHeight(35)
        button.setFixedWidth(self.CONTROL_AREA_WIDTH - 35)

        gui.comboBox(table_box,
                     self,
                     "use_undetrended",
                     label="Use Undetrended Profile",
                     labelWidth=300,
                     items=["No", "Yes"],
                     callback=self.table_item_clicked,
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(table_box)

        self.scrollarea = QScrollArea()
        self.scrollarea.setMinimumWidth(self.CONTROL_AREA_WIDTH - 35)

        table_box.layout().addWidget(self.scrollarea,
                                     alignment=Qt.AlignHCenter)

        self.table = QTableWidget(1, 5)
        self.table.setStyleSheet("background-color: #FBFBFB;")
        self.table.setAlternatingRowColors(True)
        self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Fixed)
        self.table.verticalHeader().setVisible(False)

        self.table.setColumnWidth(0, 40)
        self.table.setColumnWidth(1, 70)
        self.table.setColumnWidth(2, 70)
        self.table.setColumnWidth(3, 85)
        self.table.setColumnWidth(4, 80)

        self.table.resizeRowsToContents()
        self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.table.itemClicked.connect(self.table_item_clicked)

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

        output_profile_box = oasysgui.widgetBox(
            tab_gener,
            "Surface Generation Parameters",
            addSpace=True,
            orientation="vertical",
            height=370)

        gui.comboBox(output_profile_box,
                     self,
                     "center_y",
                     label="Center Profile in the middle of O.E.",
                     labelWidth=300,
                     items=["No", "Yes"],
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(output_profile_box)

        gui.comboBox(output_profile_box,
                     self,
                     "modify_y",
                     label="Modify Length?",
                     labelWidth=150,
                     items=[
                         "No", "Rescale to new length",
                         "Fit to new length (fill or cut)"
                     ],
                     callback=self.set_ModifyY,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.modify_box_1 = oasysgui.widgetBox(output_profile_box,
                                               "",
                                               addSpace=False,
                                               orientation="vertical",
                                               height=60)

        self.modify_box_2 = oasysgui.widgetBox(output_profile_box,
                                               "",
                                               addSpace=False,
                                               orientation="vertical",
                                               height=60)
        self.le_new_length_1 = oasysgui.lineEdit(self.modify_box_2,
                                                 self,
                                                 "new_length",
                                                 "New Length",
                                                 labelWidth=300,
                                                 valueType=float,
                                                 orientation="horizontal")

        self.modify_box_3 = oasysgui.widgetBox(output_profile_box,
                                               "",
                                               addSpace=False,
                                               orientation="vertical",
                                               height=60)
        self.le_new_length_2 = oasysgui.lineEdit(self.modify_box_3,
                                                 self,
                                                 "new_length",
                                                 "New Length",
                                                 labelWidth=300,
                                                 valueType=float,
                                                 orientation="horizontal")
        oasysgui.lineEdit(self.modify_box_3,
                          self,
                          "filler_value",
                          "Filler Value (if new length > profile length) [nm]",
                          labelWidth=300,
                          valueType=float,
                          orientation="horizontal")

        self.set_ModifyY()

        gui.comboBox(output_profile_box,
                     self,
                     "renormalize_y",
                     label="Renormalize Length Profile to different RMS",
                     labelWidth=300,
                     items=["No", "Yes"],
                     callback=self.set_RenormalizeY,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.output_profile_box_1 = oasysgui.widgetBox(output_profile_box,
                                                       "",
                                                       addSpace=False,
                                                       orientation="vertical",
                                                       height=60)
        self.output_profile_box_2 = oasysgui.widgetBox(output_profile_box,
                                                       "",
                                                       addSpace=False,
                                                       orientation="vertical",
                                                       height=60)

        gui.comboBox(
            self.output_profile_box_1,
            self,
            "error_type_y",
            label="Normalization to",
            labelWidth=270,
            items=["Figure Error (nm)", "Slope Error (" + u"\u03BC" + "rad)"],
            sendSelectedValue=False,
            orientation="horizontal")

        oasysgui.lineEdit(self.output_profile_box_1,
                          self,
                          "rms_y",
                          "Rms Value",
                          labelWidth=300,
                          valueType=float,
                          orientation="horizontal")

        self.set_RenormalizeY()

        output_box = oasysgui.widgetBox(tab_gener,
                                        "Outputs",
                                        addSpace=True,
                                        orientation="vertical")

        select_file_box = oasysgui.widgetBox(output_box,
                                             "",
                                             addSpace=True,
                                             orientation="horizontal")

        self.le_heigth_profile_file_name = oasysgui.lineEdit(
            select_file_box,
            self,
            "heigth_profile_file_name",
            "Output File Name",
            labelWidth=120,
            valueType=str,
            orientation="horizontal")

        gui.button(select_file_box, self, "...", callback=self.selectFile)

        self.shadow_output = oasysgui.textArea(height=400)

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=500)
        out_box.layout().addWidget(self.shadow_output)

        gui.rubber(self.controlArea)

        self.initializeTabs()

        gui.rubber(self.mainArea)

        self.overlay_search.raise_()
    def __init__(self, show_automatic_box=True):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.WIDGET_WIDTH)),
                  round(min(geom.height() * 0.95, self.WIDGET_HEIGHT))))

        self.setMaximumHeight(self.WIDGET_HEIGHT)
        self.setMaximumWidth(self.WIDGET_WIDTH)

        gen_box = gui.widgetBox(self.mainArea,
                                "SRW Native Code: SE",
                                addSpace=False,
                                orientation="horizontal")

        tabs_setting = oasysgui.tabWidget(gen_box)
        tabs_setting.setFixedHeight(self.WIDGET_HEIGHT - 60)
        tabs_setting.setFixedWidth(self.WIDGET_WIDTH - 60)

        tab_scr = oasysgui.createTabPage(tabs_setting, "Python Script")
        tab_out = oasysgui.createTabPage(tabs_setting, "System Output")

        self.pythonScript = oasysgui.textArea(readOnly=False)
        self.pythonScript.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")
        self.pythonScript.setMaximumHeight(self.WIDGET_HEIGHT - 300)

        script_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=False,
                                        orientation="vertical",
                                        height=self.WIDGET_HEIGHT - 80,
                                        width=self.WIDGET_WIDTH - 80)
        script_box.layout().addWidget(self.pythonScript)

        console_box = oasysgui.widgetBox(script_box,
                                         "",
                                         addSpace=True,
                                         orientation="vertical",
                                         height=150,
                                         width=self.WIDGET_WIDTH - 80)

        self.console = PythonConsole(self.__dict__, self)
        console_box.layout().addWidget(self.console)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=self.WIDGET_HEIGHT - 80)
        out_box.layout().addWidget(self.shadow_output)

        #############################

        button_box = oasysgui.widgetBox(tab_scr,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Run Script",
                   callback=self.execute_script,
                   height=40)
        gui.button(button_box,
                   self,
                   "Save Script to File",
                   callback=self.save_script,
                   height=40)