Пример #1
0
    def get_state(self):
        """ Returns a RunSetupScript with the state of Run_Setup_Interface
        Set up all the class parameters in RunSetupScrpt with values in the content
        """
        s = RunSetupScript(self._instrument_name)

        s.runnumbers = self._content.runnumbers_edit.text()
        rtup = self.validateIntegerList(s.runnumbers)
        isvalid = rtup[0]
        if isvalid is False:
            raise NotImplementedError("Run number error @ %s" % (rtup[1]))

        s.calibfilename = self._content.calfile_edit.text()
        s.charfilename = self._content.charfile_edit.text()
        s.dosum = self._content.sum_checkbox.isChecked()
        s.binning = self._content.binning_edit.text()
        bintypestr = self._content.bintype_combo.currentText()
        if s.binning != "" and s.binning is not None:
            if bintypestr.count("Linear") == 1:
                s.binning = abs(float(s.binning))
            else:
                s.binning = -1.0 * abs(float(s.binning))
        s.binindspace = self._content.binind_checkbox.isChecked()
        s.resamplex = int(self._content.resamplex_edit.text())
        s.outputdir = self._content.outputdir_edit.text()
        s.saveas = str(self._content.saveas_combo.currentText())
        s.finalunits = str(self._content.unit_combo.currentText())

        s.bkgdrunnumber = self._content.emptyrun_edit.text()
        s.disablebkgdcorrection = self._content.disablebkgdcorr_chkbox.isChecked()

        s.vanrunnumber = self._content.vanrun_edit.text()
        s.disablevancorrection = self._content.disablevancorr_chkbox.isChecked()

        s.vanbkgdrunnumber = self._content.vanbkgdrun_edit.text()
        s.disablevanbkgdcorrection = self._content.disablevanbkgdcorr_chkbox.isChecked()

        s.dosamplex = self._content.resamplex_button.isChecked()

        # s.vannoiserunnumber = self._content.vannoiserun_edit.text()

        return s
Пример #2
0
    def get_state(self):
        """ Returns a RunSetupScript with the state of Run_Setup_Interface
        Set up all the class parameters in RunSetupScrpt with values in the content
        i.e., get the all parameters from GUI
        """
        s = RunSetupScript(self._instrument_name)

        s.runnumbers = str(self._content.runnumbers_edit.text())
        rtup = self.validateIntegerList(s.runnumbers)
        isvalid = rtup[0]
        if isvalid is False:
            raise NotImplementedError("Run number error @ %s" % (rtup[1]))
        else:
            # s.runnumbers = rtup[2]
            pass

        s.calibfilename = self._content.calfile_edit.text()
        s.groupfilename = self._content.groupfile_edit.text()
        s.exp_ini_file_name = str(self._content.lineEdit_expIniFile.text())
        s.charfilename = self._content.charfile_edit.text()
        s.dosum = self._content.sum_checkbox.isChecked()

        bintypestr = str(self._content.bintype_combo.currentText())
        s.binindspace = self._content.binind_checkbox.isChecked()

        if self._content.resamplex_button.isChecked() is True:
            # use ResampleX: do not touch pre-saved s.binning
            s.doresamplex = True
            try:
                s.resamplex = int(self._content.resamplex_edit.text())
            except ValueError:
                raise RuntimeError('ResampleX parameter is not given!')

            if s.resamplex < 0 and bintypestr.startswith('Linear'):
                self._content.bintype_combo.setCurrentIndex(1)
            elif s.resamplex > 0 and bintypestr.startswith('Logarithmic'):
                s.resamplex = -1 * s.resamplex
            elif s.resamplex == 0:
                raise RuntimeError('ResampleX\'s parameter cannot be equal to 0!')
        else:
            # use binning: do not touch pre-saved s.resamplex
            s.doresamplex = False
            try:
                s.binning = float(self._content.binning_edit.text())
            except ValueError:
                raise RuntimeError('Binning parameter is not given!')

            if s.binning < 0. and bintypestr.startswith('Linear'):
                self._content.bintype_combo.setCurrentIndex(1)
            elif s.binning > 0. and bintypestr.startswith('Logarithmic'):
                s.binning = -1 * s.binning
            elif abs(s.binning) < 1.0E-20:
                raise RuntimeError('Binning\'s parameter cannot be equal to 0!')
        # END-IF-ELSE (binning/resampleX)

        s.outputdir = self._content.outputdir_edit.text()
        s.saveas = str(self._content.saveas_combo.currentText())
        s.finalunits = str(self._content.unit_combo.currentText())

        s.bkgdrunnumber = self._content.emptyrun_edit.text()
        s.disablebkgdcorrection = self._content.disablebkgdcorr_chkbox.isChecked()

        s.vanrunnumber = self._content.vanrun_edit.text()
        s.disablevancorrection = self._content.disablevancorr_chkbox.isChecked()

        s.vanbkgdrunnumber = self._content.vanbkgdrun_edit.text()
        s.disablevanbkgdcorrection = self._content.disablevanbkgdcorr_chkbox.isChecked()

        return s