Exemple #1
0
    def runSequenceLineEditEvent(self):
        run_sequence = self.runSequenceLineEdit.text()
        self.is_manual_edit_of_tableWidget = False
        oListRuns = RunSequenceBreaker(run_sequence)
        _new_runs = oListRuns.getFinalList()

        _old_runs = self.loaded_list_of_runs
        _list_runs = np.unique(np.hstack([_old_runs, _new_runs]))
        o_load_and_sort_nxsdata = LoadAndSortNXSDataForSFcalculator(_list_runs, parent=self, read_options=self.read_options)
        self.update_table(o_load_and_sort_nxsdata)
        self.is_manual_edit_of_tableWidget = True
Exemple #2
0
    def runSequenceLineEditEvent(self):
        run_sequence = self.runSequenceLineEdit.text()
        self.is_manual_edit_of_tableWidget = False
        oListRuns = RunSequenceBreaker(run_sequence)
        _new_runs = oListRuns.getFinalList()

        _old_runs = self.loaded_list_of_runs
        _list_runs = np.unique(np.hstack([_old_runs, _new_runs]))
        o_load_and_sort_nxsdata = LoadAndSortNXSDataForSFcalculator(
            _list_runs, parent=self, read_options=self.read_options)
        self.update_table(o_load_and_sort_nxsdata)
        self.is_manual_edit_of_tableWidget = True
Exemple #3
0
    def loadNxs(self):
        self.clearMetadataTable()
        run_sequence = self.ui.runNumberEdit.text()
        oListRuns = RunSequenceBreaker(run_sequence)
        _list_runs = oListRuns.getFinalList()
        if len(_list_runs) > self.WARNING_NBR_FILES:
            msgBox = QMessageBox()
            _str = "Program is about to load " + str(len(_list_runs)) + " files. Do you want to continue ?"                                                                   
            msgBox.setText(_str)
            msgBox.addButton(QPushButton('NO'), QMessageBox.NoRole)
            msgBox.addButton(QPushButton('YES'), QMessageBox.YesRole)
            ret = msgBox.exec_()
            if ret == 0:
                self.ui.inputErrorLabel.setVisible(False)
                return

        if _list_runs[0] == -1:
            if self.list_nxs == []:
                return
            else:
                _list_runs = self.list_runs
                _list_nxs = self.list_nxs
                _list_filename = self.list_filename

        elif _list_runs[0] == -2:
            self.ui.inputErrorLabel.setVisible(True)
            return

        else:
            self.list_runs = _list_runs
            self.list_filename = []
            self.list_nxs = []
            for _runs in _list_runs:
                try:
                    _filename = RefRed.nexus_utilities.findNeXusFullPath(_runs)
                except:
                    self.ui.inputErrorLabel.setVisible(True)                    
                    return
                self.list_filename.append(_filename)
                randomString = RefRed.utilities.generate_random_workspace_name();print("About to load %s" % _filename)
                _nxs = LoadEventNexus(Filename = _filename, OutputWorkspace = randomString, MetaDataOnly=True)
                self.list_nxs.append(_nxs)

        self.ui.inputErrorLabel.setVisible(False)
        list_metadata_selected = self.list_metadata_selected

        _header = ['Run #','IPTS']
        for name in list_metadata_selected:
            self.ui.metadataTable.insertColumn(2)
            _header.append(name)
        self.ui.metadataTable.setHorizontalHeaderLabels(_header)
        list_nxs = self.list_nxs
    def loadNxs(self):
        self.clearMetadataTable()
        run_sequence = self.ui.runNumberEdit.text()
        oListRuns = RunSequenceBreaker(run_sequence)
        _list_runs = oListRuns.getFinalList()
        if len(_list_runs) > self.WARNING_NBR_FILES:
            msgBox = QMessageBox()
            _str = "Program is about to load " + str(len(_list_runs)) + " files. Do you want to continue ?"
            msgBox.setText(_str)
            msgBox.addButton(QPushButton("NO"), QMessageBox.NoRole)
            msgBox.addButton(QPushButton("YES"), QMessageBox.YesRole)
            ret = msgBox.exec_()
            if ret == 0:
                self.ui.inputErrorLabel.setVisible(False)
                return

        if _list_runs[0] == -1:
            if self.list_nxs == []:
                return
            else:
                _list_runs = self.list_runs
                _list_nxs = self.list_nxs
                _list_filename = self.list_filename

        elif _list_runs[0] == -2:
            self.ui.inputErrorLabel.setVisible(True)
            return

        else:
            self.list_runs = _list_runs
            self.list_filename = []
            self.list_nxs = []
            for _runs in _list_runs:
                try:
                    _filename = RefRed.nexus_utilities.findNeXusFullPath(_runs)
                except:
                    self.ui.inputErrorLabel.setVisible(True)
                    return
                self.list_filename.append(_filename)
                randomString = RefRed.utilities.generate_random_workspace_name()
                _nxs = LoadEventNexus(Filename=_filename, OutputWorkspace=randomString, MetaDataOnly=True)
                self.list_nxs.append(_nxs)

        self.ui.inputErrorLabel.setVisible(False)
        list_metadata_selected = self.list_metadata_selected

        _header = ["Run #", "IPTS"]
        for name in list_metadata_selected:
            self.ui.metadataTable.insertColumn(2)
            _header.append(name)
        self.ui.metadataTable.setHorizontalHeaderLabels(_header)
        list_nxs = self.list_nxs
    def __init__(self, parent=None, row=0, col=1, runs=None):
        self.parent = parent
        self.row = row
        self.col = col

        item = self.parent.ui.reductionTable.item(row, col)
        if item.text() == '':
            self.clear_cell(row, col)
            self.parent.file_loaded_signal.emit()
            QApplication.processEvents()
            return

        data_type = 'data' if col == 1 else 'norm'
        self.is_data_displayed = True if (col == 1) else False

        self.raw_runs = str(runs)
        run_breaker = RunSequenceBreaker(run_sequence=self.raw_runs)
        list_run = run_breaker.final_list

        # check if nexus can be found
        list_run_object = LocateListRun(list_run=list_run)
        if list_run_object.list_run_not_found != []:
            str_list_run_not_found = [
                str(x) for x in list_run_object.list_run_not_found
            ]
            runs_not_located = ', '.join(str_list_run_not_found)
            mess = "Can not locate %s run(s): %s" % (data_type,
                                                     runs_not_located)
            self.parent.ui.reductionTable.item(row, 8).setText(mess)
            _color = QtGui.QColor(RefRed.colors.VALUE_BAD)
            self.parent.ui.reductionTable.item(row, 8).setBackground(_color)
        else:
            mess = "%s runs have been located!" % data_type
            self.parent.ui.reductionTable.item(row, 8).setText(mess)
            _color = QtGui.QColor(RefRed.colors.VALUE_OK)
            self.parent.ui.reductionTable.item(row, 8).setBackground(_color)

        list_run_found = list(list_run_object.list_run_found)

        if list_run_found == []:
            self.parent.ui.reductionTable.item(row, col).setText('')
            return
        str_list_run_found = [str(x) for x in list_run_found]
        final_list_run_found = ','.join(str_list_run_found)
        self.parent.ui.reductionTable.item(row,
                                           col).setText(final_list_run_found)

        list_nexus_found = list_run_object.list_nexus_found
        thread_index = ((self.col - 1) + 2 * self.row)
        self.parent.loading_nxs_thread[
            thread_index] = CheckListRunCompatibilityAndDisplayThread()
        self.parent.loading_nxs_thread[thread_index].setup(
            parent=self.parent,
            list_run=list_run_found,
            list_nexus=list_nexus_found,
            row=row,
            is_working_with_data_column=self.is_data_displayed,
            is_display_requested=self.display_of_this_row_checked())
        self.parent.loading_nxs_thread[thread_index].start()
 def calculate_discrete_list_of_runs(self):
     _raw_run_from_input = self.raw_run_from_input
     sequence_breaker = RunSequenceBreaker(_raw_run_from_input)
     self.list_of_run_from_input = sequence_breaker.final_list