def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecProcessScriptAutoRgv1_0.postProcess")
        # Create some output data
#        2.83326 0.011646 2.04258e+07 18565.3 47 81 0.783626 1 bioSaxsMerged.dat
        strOutput = self.readProcessLogFile()
        xsDataResult = XSDataResultAutoRg()
        listXSDOut = []
        for line in strOutput.split(os.linesep):
            words = line.split(None, 8)
            if len(words) < 8:
                break
            try:
                xsData = XSDataAutoRg()
                xsData.filename = XSDataFile(XSDataString(words[-1]))
                xsData.rg = XSDataLength(float(words[0]))
                xsData.rgStdev = XSDataLength(float(words[1]))
                xsData.i0 = XSDataDouble(float(words[2]))
                xsData.i0Stdev = XSDataDouble(float(words[3]))
                xsData.firstPointUsed = XSDataInteger(int(words[4]))
                xsData.lastPointUsed = XSDataInteger(int(words[5]))
                xsData.quality = XSDataDouble(float(words[6]))
                xsData.isagregated = XSDataBoolean(bool(int(words[7])))
            except Exception:
                strError = "Error in parsing output:" + line
                self.error(strError)
                self.setFailure()
            listXSDOut.append(xsData)
        xsDataResult.autoRgOut = listXSDOut
        self.setDataOutput(xsDataResult)
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecProcessScriptAutoRgv1_0.postProcess")
     # Create some output data
     #        2.83326 0.011646 2.04258e+07 18565.3 47 81 0.783626 1 bioSaxsMerged.dat
     strOutput = self.readProcessLogFile()
     xsDataResult = XSDataResultAutoRg()
     listXSDOut = []
     for line in strOutput.split(os.linesep):
         words = line.split(None, 8)
         if len(words) < 8:
             break
         try:
             xsData = XSDataAutoRg()
             xsData.filename = XSDataFile(XSDataString(words[-1]))
             xsData.rg = XSDataLength(float(words[0]))
             xsData.rgStdev = XSDataLength(float(words[1]))
             xsData.i0 = XSDataDouble(float(words[2]))
             xsData.i0Stdev = XSDataDouble(float(words[3]))
             xsData.firstPointUsed = XSDataInteger(int(words[4]))
             xsData.lastPointUsed = XSDataInteger(int(words[5]))
             xsData.quality = XSDataDouble(float(words[6]))
             xsData.isagregated = XSDataBoolean(bool(int(words[7])))
         except Exception:
             strError = "Error in parsing output:" + line
             self.error(strError)
             self.setFailure()
         listXSDOut.append(xsData)
     xsDataResult.autoRgOut = listXSDOut
     self.setDataOutput(xsDataResult)
Exemple #3
0
    def process(self):
        EDPluginExecProcessScript.process(self)
        self.DEBUG("EDPluginExecProcessScriptAutoRgv1_0.process")
        # Create some output data
#        2.83326 0.011646 2.04258e+07 18565.3 47 81 0.783626 1 bioSaxsMerged.dat
        strOutput = self.readProcessLogFile()
        xsDataResult = XSDataResultAutoRg()
        dic_Rg = {} #key: filename, value: XSDataAutoRg
        listXSDOut = []
        for line in strOutput.split(os.linesep):
            words = line.split(None, 8)
            if len(words) < 8:
                break
            try:
                xsData = XSDataAutoRg()
                filename = words[-1]
                xsData.rg = XSDataLength(float(words[0]))
                xsData.rgStdev = XSDataLength(float(words[1]))
                xsData.i0 = XSDataDouble(float(words[2]))
                xsData.i0Stdev = XSDataDouble(float(words[3]))
                xsData.firstPointUsed = XSDataInteger(int(words[4]))
                xsData.lastPointUsed = XSDataInteger(int(words[5]))
                xsData.quality = XSDataDouble(float(words[6]))
                xsData.isagregated = XSDataDouble(float(words[7]))
            except Exception:
                strError = "Error in parsing output:" + line
                self.error(strError)
                self.setFailure()
            else:
                xsData.filename = XSDataFile(XSDataString(filename))
                dic_Rg[filename] = xsData
#                listXSDOut.append(xsData)

        if self.isFailure():
            # Change failure output for ATSAS version >= 2.5 to micmic old version
            strErrOutput = self.readProcessErrorLogFile()
            for line in strErrOutput.split(os.linesep):
                if 'Not enough valid data' in line:
                    words = line.split()
                    try:
                        xsData = XSDataAutoRg()
                        filename = words[-1].strip("'.")
                        xsData.rg = XSDataLength(0.0)
                        xsData.rgStdev = XSDataLength(0.0)
                        xsData.i0 = XSDataDouble(0.0)
                        xsData.i0Stdev = XSDataDouble(0.0)
                        xsData.firstPointUsed = XSDataInteger(0)
                        xsData.lastPointUsed = XSDataInteger(0)
                        xsData.quality = XSDataDouble(0.0)
                        xsData.isagregated = XSDataDouble(0.0)
                    except Exception:
                        strError = "Error in parsing output:" + line
                        self.error(strError)
                        self.setFailure()
                    else:
                        xsData.filename = XSDataFile(XSDataString(filename))
                        dic_Rg[filename] = xsData
        if self.isFailure() and dic_Rg:
            # we have some data ... unset the failure flag
            self.setFailure(False)
        xsData_zero = XSDataAutoRg(isagregated=XSDataDouble(1.0),
                                   quality=XSDataDouble(0.0),
                                   lastPointUsed=XSDataInteger(0),
                                   firstPointUsed=XSDataInteger(0),
                                   i0Stdev=XSDataDouble(0.0),
                                   i0=XSDataDouble(0.0),
                                   rgStdev=XSDataLength(0.0),
                                   rg=XSDataLength(0.0))
        for filename in self.inputCurve:
            if filename in dic_Rg:
                listXSDOut.append(dic_Rg[filename])
            else:
                xsData_zero.filename = XSDataFile(XSDataString(filename))
                listXSDOut.append(xsData_zero)

        xsDataResult.autoRgOut = listXSDOut
        self.setDataOutput(xsDataResult)
Exemple #4
0
    def process(self):
        EDPluginExecProcessScript.process(self)
        self.DEBUG("EDPluginExecProcessScriptAutoRgv1_0.process")
        # Create some output data
        #        2.83326 0.011646 2.04258e+07 18565.3 47 81 0.783626 1 bioSaxsMerged.dat
        strOutput = self.readProcessLogFile()
        xsDataResult = XSDataResultAutoRg()
        dic_Rg = {}  #key: filename, value: XSDataAutoRg
        listXSDOut = []
        for line in strOutput.split(os.linesep):
            words = line.split(None, 8)
            if len(words) < 8:
                break
            try:
                xsData = XSDataAutoRg()
                filename = words[-1]
                xsData.rg = XSDataLength(float(words[0]))
                xsData.rgStdev = XSDataLength(float(words[1]))
                xsData.i0 = XSDataDouble(float(words[2]))
                xsData.i0Stdev = XSDataDouble(float(words[3]))
                xsData.firstPointUsed = XSDataInteger(int(words[4]))
                xsData.lastPointUsed = XSDataInteger(int(words[5]))
                xsData.quality = XSDataDouble(float(words[6]))
                xsData.isagregated = XSDataDouble(float(words[7]))
            except Exception:
                strError = "Error in parsing output:" + line
                self.error(strError)
                self.setFailure()
            else:
                xsData.filename = XSDataFile(XSDataString(filename))
                dic_Rg[filename] = xsData
#                listXSDOut.append(xsData)

        if self.isFailure():
            # Change failure output for ATSAS version >= 2.5 to micmic old version
            strErrOutput = self.readProcessErrorLogFile()
            for line in strErrOutput.split(os.linesep):
                if 'Not enough valid data' in line:
                    words = line.split()
                    try:
                        xsData = XSDataAutoRg()
                        filename = words[-1].strip("'.")
                        xsData.rg = XSDataLength(0.0)
                        xsData.rgStdev = XSDataLength(0.0)
                        xsData.i0 = XSDataDouble(0.0)
                        xsData.i0Stdev = XSDataDouble(0.0)
                        xsData.firstPointUsed = XSDataInteger(0)
                        xsData.lastPointUsed = XSDataInteger(0)
                        xsData.quality = XSDataDouble(0.0)
                        xsData.isagregated = XSDataDouble(0.0)
                    except Exception:
                        strError = "Error in parsing output:" + line
                        self.error(strError)
                        self.setFailure()
                    else:
                        xsData.filename = XSDataFile(XSDataString(filename))
                        dic_Rg[filename] = xsData
        if self.isFailure() and dic_Rg:
            # we have some data ... unset the failure flag
            self.setFailure(False)
        xsData_zero = XSDataAutoRg(isagregated=XSDataDouble(1.0),
                                   quality=XSDataDouble(0.0),
                                   lastPointUsed=XSDataInteger(0),
                                   firstPointUsed=XSDataInteger(0),
                                   i0Stdev=XSDataDouble(0.0),
                                   i0=XSDataDouble(0.0),
                                   rgStdev=XSDataLength(0.0),
                                   rg=XSDataLength(0.0))
        for filename in self.inputCurve:
            if filename in dic_Rg:
                listXSDOut.append(dic_Rg[filename])
            else:
                xsData_zero.filename = XSDataFile(XSDataString(filename))
                listXSDOut.append(xsData_zero)

        xsDataResult.autoRgOut = listXSDOut
        self.setDataOutput(xsDataResult)