Exemplo n.º 1
0
    def _filterEvents(self, run, ws_name):
        r"""
        Filter out ExcludeTimeSegment if applicable

        Parameters
        ----------
        run: str
            run number
        ws_name : str
            name of the workspace to filter
        """
        for run_fragment in self.getProperty('ExcludeTimeSegment').value.split(
                ','):
            if run + ':' in run_fragment:
                self.generateSplitterWorkspace(run_fragment.split(':')[1])
                sapi.FilterEvents(InputWorkspace=ws_name,
                                  SplitterWorkspace='splitter',
                                  OutputWorkspaceBaseName='splitted',
                                  GroupWorkspaces=True,
                                  OutputWorkspaceIndexedFrom1=True,
                                  RelativeTime=True)
                sapi.UnGroupWorkspace('splitted')
                sapi.RenameWorkspace(InputWorkspace='splitted_0',
                                     OutputWorkspace=ws_name)
                break
Exemplo n.º 2
0
    def splitWksp(self, splitws, infows):
        """ Run FilterEvents
        """
        dogroupws = self.ui.checkBox_groupWS.isChecked()
        filterbypulse = self.ui.checkBox_filterByPulse.isChecked()
        startfrom1 = self.ui.checkBox_from1.isChecked()
        splitsamplelog = self.ui.checkBox_splitLog.isChecked()

        corr2sample = str(self.ui.comboBox_tofCorr.currentText())
        how2skip = str(self.ui.comboBox_skipSpectrum.currentText())

        kwargs = {}
        if corr2sample == "Direct":
            ei = float(self.ui.lineEdit_Ei.text())
            kwargs["IncidentEnergy"] = ei
        elif corr2sample == "Customized":
            corrws = str(self.ui.comboBox_corrWS.currentText())
            kwargs["DetectorTOFCorrectionWorkspace"] = corrws

        # Output workspace name
        outbasewsname = str(self.ui.lineEdit_outwsname.text())
        if len(outbasewsname) == 0:
            outbasewsname = "tempsplitted"
            self.ui.lineEdit_outwsname.setText(outbasewsname)

        api.FilterEvents(InputWorkspace=self._dataWS,
                         SplitterWorkspace=splitws,
                         InformationWorkspace=infows,
                         OutputWorkspaceBaseName=outbasewsname,
                         GroupWorkspaces=dogroupws,
                         FilterByPulseTime=filterbypulse,
                         CorrectionToSample=corr2sample,
                         SpectrumWithoutDetector=how2skip,
                         SplitSampleLogs=splitsamplelog,
                         OutputWorkspaceIndexedFrom1=startfrom1,
                         OutputTOFCorrectionWorkspace='TOFCorrTable',
                         **kwargs)

        return