예제 #1
0
    def select_normalization(self, text='Normalization: '):

        layout = QtGui.QHBoxLayout()
        # dividend
        box = QtGui.QComboBox()
        box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        sdds = ['PFY_SDD1', 'PFY_SDD2', 'PFY_SDD3', 'PFY_SDD4']
        for sdd in sorted(sdds):
            box.addItem(sdd)

        self.select_dividend_box = box
        # self.select_abs_layout = layout

        # divisor
        box2 = QtGui.QComboBox()
        box2.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        sdds2 = ['I0', 'TEY', 'DIODE']
        for sdd2 in sorted(sdds2):
            box2.addItem(sdd2)

        box2.setCurrentIndex(1)
        self.select_divisor_box = box2

        layout.addWidget(QtGui.QLabel(text))
        layout.addWidget(box)
        layout.addWidget(box2)
        layout.addStretch()
        return layout
예제 #2
0
    def __init__(self, mgr):
        super(ExecWindow, self).__init__()

        self.mgr = mgr

        self.outputViews = {}

        self.label = QtGui.QLabel()
        self.combobox = QtGui.QComboBox()
        self.combobox.SizeAdjustPolicy = \
            QtGui.QComboBox.AdjustToContents

        button_layout = QtGui.QHBoxLayout()
        self.refresher = QtGui.QPushButton('Refresh')
        self.refresher.clicked.connect(self.refresh)
        self.outviewer = QtGui.QPushButton('Show Output')
        self.outviewer.clicked.connect(self.outview)
        self.killer = QtGui.QPushButton('Kill')
        self.killer.clicked.connect(self.kill_task)
        button_layout.addWidget(self.refresher)
        button_layout.addWidget(self.outviewer)
        button_layout.addWidget(self.killer)
        button_layout.addStretch()

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.combobox)
        layout.addLayout(button_layout)
        self.setLayout(layout)
        self.setWindowTitle("Execution list")
        self.refresh()
예제 #3
0
 def make_filterbox(self):
     filterbox = QtGui.QWidget()
     layout = QtGui.QGridLayout()
     layout.setSpacing(10)
     prefix_label = QtGui.QLabel('File Prefix')
     self.prefix_box = QtGui.QLineEdit()
     self.prefix_box.editingFinished.connect(self.set_range)
     suffix_label = QtGui.QLabel('File Suffix')
     self.suffix_box = QtGui.QLineEdit('')
     self.suffix_box.editingFinished.connect(self.get_prefixes)
     extension_label = QtGui.QLabel('File Extension')
     self.extension_box = QtGui.QLineEdit()
     self.extension_box.editingFinished.connect(self.set_extension)
     layout.addWidget(prefix_label, 0, 0)
     layout.addWidget(self.prefix_box, 0, 1)
     layout.addWidget(suffix_label, 0, 2)
     layout.addWidget(self.suffix_box, 0, 3)
     layout.addWidget(extension_label, 0, 4)
     layout.addWidget(self.extension_box, 0, 5)
     self.prefix_combo = QtGui.QComboBox()
     self.prefix_combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
     self.prefix_combo.activated.connect(self.choose_prefix)
     self.extension_combo = QtGui.QComboBox()
     self.extension_combo.setSizeAdjustPolicy(
         QtGui.QComboBox.AdjustToContents)
     self.extension_combo.activated.connect(self.choose_extension)
     layout.addWidget(self.prefix_combo,
                      1,
                      1,
                      alignment=QtCore.Qt.AlignHCenter)
     layout.addWidget(self.extension_combo,
                      1,
                      5,
                      alignment=QtCore.Qt.AlignHCenter)
     filterbox.setLayout(layout)
     filterbox.setVisible(False)
     return filterbox
예제 #4
0
    def select_sdd(self, text='Select SDD :'):
        layout = QtGui.QHBoxLayout()
        box = QtGui.QComboBox()
        box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        sdds = ['SDD1', 'SDD2', 'SDD3', 'SDD4']
        for sdd in sorted(sdds):
            box.addItem(sdd)

        self.select_sdd_box = box
        self.select_sdd_layout = layout

        layout.addWidget(QtGui.QLabel(text))
        layout.addWidget(box)
        layout.addStretch()
        return layout
예제 #5
0
    def select_eem_entry(self, text='Select entry :'):
        layout = QtGui.QHBoxLayout()
        box = QtGui.QComboBox()
        box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        entries = []
        for entry in range(len(self.root.NXentry)):
            entries.append(entry)
        for entry in sorted(entries):
            box.addItem(str(entry + 1))

        self.select_eem_entry_box = box
        self.select_eem_entry_layout = layout

        layout.addWidget(QtGui.QLabel(text))
        layout.addWidget(box)
        layout.addStretch()
        return layout
예제 #6
0
 def get_members(self):
     if self.member_combo is None:
         member_layout = QtGui.QHBoxLayout()
         self.member_combo = QtGui.QComboBox()
         self.member_combo.setSizeAdjustPolicy(
             QtGui.QComboBox.AdjustToContents)
         self.member_combo.currentIndexChanged.connect(self.get_member)
         member_layout.addWidget(QtGui.QLabel('Member: '))
         member_layout.addWidget(self.member_combo)
         member_layout.addStretch()
         self.layout.insertLayout(2, member_layout)
     else:
         self.member_combo.clear()
     for member in self.globus.get_members(self.dataset):
         try:
             self.member_combo.addItem(member['data_uri'])
         except:
             pass
예제 #7
0
    def __init__(self, defaults=(None, None)):

        super(RemoteDialog, self).__init__()

        token_file = os.path.join(os.path.expanduser('~'), '.nexpy',
                                  'globusonline', 'gotoken.txt')
        self.globus = GlobusCatalog(token_file)

        catalog_layout = QtGui.QHBoxLayout()
        self.catalog_combo = QtGui.QComboBox()
        for catalog in self.globus.get_catalogs():
            try:
                self.catalog_combo.addItem(catalog['config']['name'])
            except:
                pass
        self.catalog_combo.setSizeAdjustPolicy(
            QtGui.QComboBox.AdjustToContents)
        self.catalog_combo.currentIndexChanged.connect(self.get_datasets)
        catalog_layout.addWidget(QtGui.QLabel('Catalog: '))
        catalog_layout.addWidget(self.catalog_combo)
        catalog_layout.addStretch()
        self.layout = QtGui.QVBoxLayout()
        self.layout.addLayout(catalog_layout)
        self.layout.addWidget(self.close_buttons())
        self.setLayout(self.layout)
        self.dataset_combo = None
        self.member_combo = None
        self.ssh_controls = False  # SSH controls not yet constructed

        catalog, dataset = defaults

        if catalog:
            try:
                idx = self.catalog_combo.findText(catalog)
                self.catalog_combo.setCurrentIndex(idx)
                self.get_datasets()
                if dataset:
                    idx = self.dataset_combo.findText(dataset)
                    self.dataset_combo.setCurrentIndex(idx)
                    self.get_members()
            except:
                pass

        self.setWindowTitle("Open Remote File")
예제 #8
0
    def select_abs(self, text='Select Detector :'):
        layout = QtGui.QHBoxLayout()
        box = QtGui.QComboBox()
        box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        sdds = [
            'TEY', 'I0', 'DIODE', 'PFY_SDD1', 'PFY_SDD2', 'PFY_SDD3',
            'PFY_SDD4'
        ]
        for sdd in sorted(sdds):
            box.addItem(sdd)

        box.setCurrentIndex(2)
        self.select_abs_box = box
        self.select_abs_layout = layout

        layout.addWidget(QtGui.QLabel(text))
        layout.addWidget(box)
        layout.addStretch()
        return layout
예제 #9
0
 def get_datasets(self):
     if self.dataset_combo is None:
         dataset_layout = QtGui.QHBoxLayout()
         self.dataset_combo = QtGui.QComboBox()
         self.dataset_combo.setSizeAdjustPolicy(
             QtGui.QComboBox.AdjustToContents)
         self.dataset_combo.currentIndexChanged.connect(self.get_members)
         dataset_layout.addWidget(QtGui.QLabel('Dataset: '))
         dataset_layout.addWidget(self.dataset_combo)
         dataset_layout.addStretch()
         self.layout.insertLayout(1, dataset_layout)
     else:
         self.dataset_combo.clear()
         if self.member_combo is not None:
             self.member_combo.clear()
     for dataset in self.globus.get_datasets(self.catalog):
         try:
             self.dataset_combo.addItem(dataset['name'])
         except:
             pass
예제 #10
0
    def select_entry_num(self, text='Select Entry :', other=False):
        layout = QtGui.QHBoxLayout()
        box = QtGui.QComboBox()
        box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        entries = []
        for entry in range(len(self.root.NXentry)):
            entries.append(entry)
        for entry in sorted(entries):
            box.addItem(str(entry + 1))

        layout.addWidget(QtGui.QLabel(text))
        layout.addWidget(box)
        layout.addStretch()
        if not other:
            self.entry_num_box = box
            self.entry_num_layout = layout
        else:
            self.other_entry_num_box = box
            self.other_entry_num_layout = layout

        return layout
예제 #11
0
    def __init__(self, entry, parent=None):

        super(FitDialog, self).__init__(parent)
        self.setMinimumWidth(850)

        self.data = self.initialize_data(entry.data)

        from nexpy.gui.consoleapp import _tree
        self.tree = _tree

        from nexpy.gui.plotview import plotview
        self.plotview = plotview
        self.functions = []
        self.parameters = []

        self.first_time = True
        self.fitted = False
        self.fit = None

        self.initialize_functions()

        function_layout = QtGui.QHBoxLayout()
        self.functioncombo = QtGui.QComboBox()
        for name in sorted(self.function_module.keys()):
            self.functioncombo.addItem(name)
        self.functioncombo.setSizeAdjustPolicy(
            QtGui.QComboBox.AdjustToContents)
        self.functioncombo.setMinimumWidth(100)
        add_button = QtGui.QPushButton("Add Function")
        add_button.clicked.connect(self.add_function)
        function_layout.addWidget(self.functioncombo)
        function_layout.addWidget(add_button)
        function_layout.addStretch()

        self.header_font = QtGui.QFont()
        self.header_font.setBold(True)

        self.parameter_layout = self.initialize_parameter_grid()

        self.remove_layout = QtGui.QHBoxLayout()
        remove_button = QtGui.QPushButton("Remove Function")
        remove_button.clicked.connect(self.remove_function)
        self.removecombo = QtGui.QComboBox()
        self.removecombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        self.removecombo.setMinimumWidth(100)
        self.remove_layout.addWidget(remove_button)
        self.remove_layout.addWidget(self.removecombo)
        self.remove_layout.addStretch()

        self.plot_layout = QtGui.QHBoxLayout()
        plot_data_button = QtGui.QPushButton('Plot Data')
        plot_data_button.clicked.connect(self.plot_data)
        plot_function_button = QtGui.QPushButton('Plot Function')
        plot_function_button.clicked.connect(self.plot_model)
        self.plotcombo = QtGui.QComboBox()
        self.plotcombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        self.plotcombo.setMinimumWidth(100)
        plot_label = QtGui.QLabel('X-axis:')
        self.plot_minbox = QtGui.QLineEdit(str(self.plotview.xtab.axis.min))
        self.plot_minbox.setAlignment(QtCore.Qt.AlignRight)
        plot_tolabel = QtGui.QLabel(' to ')
        self.plot_maxbox = QtGui.QLineEdit(str(self.plotview.xtab.axis.max))
        self.plot_maxbox.setAlignment(QtCore.Qt.AlignRight)
        self.plot_checkbox = QtGui.QCheckBox('Use Data Points')
        self.plot_layout.addWidget(plot_data_button)
        self.plot_layout.addWidget(plot_function_button)
        self.plot_layout.addWidget(self.plotcombo)
        self.plot_layout.addWidget(plot_label)
        self.plot_layout.addWidget(self.plot_minbox)
        self.plot_layout.addWidget(plot_tolabel)
        self.plot_layout.addWidget(self.plot_maxbox)
        self.plot_layout.addWidget(self.plot_checkbox)
        self.plot_layout.addStretch()

        self.action_layout = QtGui.QHBoxLayout()
        fit_button = QtGui.QPushButton("Fit")
        fit_button.clicked.connect(self.fit_data)
        self.fit_label = QtGui.QLabel()
        if self.data.nxerrors:
            self.fit_checkbox = QtGui.QCheckBox('Use Errors')
            self.fit_checkbox.setCheckState(QtCore.Qt.Checked)
        else:
            self.fit_checkbox = QtGui.QCheckBox('Use Poisson Errors')
            self.fit_checkbox.setCheckState(QtCore.Qt.Unchecked)
            self.fit_checkbox.stateChanged.connect(self.define_errors)
        self.report_button = QtGui.QPushButton("Show Fit Report")
        self.report_button.clicked.connect(self.report_fit)
        self.save_button = QtGui.QPushButton("Save Parameters")
        self.save_button.clicked.connect(self.save_fit)
        self.restore_button = QtGui.QPushButton("Restore Parameters")
        self.restore_button.clicked.connect(self.restore_parameters)
        self.action_layout.addWidget(fit_button)
        self.action_layout.addWidget(self.fit_label)
        self.action_layout.addStretch()
        self.action_layout.addWidget(self.fit_checkbox)
        self.action_layout.addWidget(self.save_button)

        self.layout = QtGui.QVBoxLayout()
        self.layout.addLayout(function_layout)
        self.layout.addWidget(self.close_buttons())

        self.setLayout(self.layout)

        self.setWindowTitle("Fit NeXus Data")

        self.load_entry(entry)