Example #1
0
    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)
Example #2
0
 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)
Example #3
0
 def doFailureExecAutoRg(self, _edPlugin=None):
     self.DEBUG("EDPluginAutoSubv1_1.doFailureExecAutoRg")
     self.retrieveFailureMessages(_edPlugin, "EDPluginAutoSubv1_1.doFailureExecAutoRg")
     self.lstProcessLog.append("Failure in AutoRg")
     if len(_edPlugin.dataInput.inputCurve) == 2:
         # we were comparing 2 buffers but were analyzed by AutoRg
         for fn in self.buffers:
             self.dictRg[fn] = (0, numpy.loadtxt(fn, unpack=True)[1].sum())
     elif os.path.exists(self.subtractedCurve):
         #we don't want to fail the subtraction plugin because the result has no Rg - default to 0
         res = XSDataAutoRg()
         res.rg = XSDataLength(0.0)
         res.rgStdev = XSDataLength(0.0)
         res.i0 = XSDataDouble(0.0)
         res.i0Stdev = XSDataDouble(0.0)
         res.firstPointUsed = XSDataInteger(0)
         res.lastPointUsed = XSDataInteger(0)
         res.quality = XSDataDouble(0.0)
         res.isagregated = XSDataDouble(bool(0))
         res.filename = XSDataFile(XSDataString(self.subtractedCurve))
         self.xsDataResult.autoRg = res
     else:
         self.setFailure()
Example #4
0
 def doFailureExecAutoRg(self, _edPlugin=None):
     self.DEBUG("EDPluginAutoSubv1_0.doFailureExecAutoRg")
     self.retrieveFailureMessages(
         _edPlugin, "EDPluginAutoSubv1_0.doFailureExecAutoRg")
     self.lstProcessLog.append("Failure in AutoRg")
     if len(_edPlugin.dataInput.inputCurve) == 2:
         # we were comparing 2 buffers but were analyzed by AutoRg
         for fn in self.buffers:
             self.dictRg[fn] = (0, numpy.loadtxt(fn, unpack=True)[1].sum())
     elif os.path.exists(self.subtractedCurve):
         #we don't want to fail the subtraction plugin because the result has no Rg - default to 0
         res = XSDataAutoRg()
         res.rg = XSDataLength(0.0)
         res.rgStdev = XSDataLength(0.0)
         res.i0 = XSDataDouble(0.0)
         res.i0Stdev = XSDataDouble(0.0)
         res.firstPointUsed = XSDataInteger(0)
         res.lastPointUsed = XSDataInteger(0)
         res.quality = XSDataDouble(0.0)
         res.isagregated = XSDataBoolean(bool(0))
         res.filename = XSDataFile(XSDataString(self.subtractedCurve))
         self.xsDataResult.autoRg = res
     else:
         self.setFailure()
Example #5
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)
Example #6
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)