Пример #1
0
 def getBonlyOutputFromLog(self, _strBestLog):
     listLog = _strBestLog.split("\n")
     indexLine = 0
     xsDataResultBest = XSDataResultBest()
     xsDataBestCollectionPlan = XSDataBestCollectionPlan()
     xsDataCrystalScale = XSDataCrystalScale()
     #
     while not "Relative scale" in listLog[indexLine]:
         indexLine += 1
     xsDataCrystalScale.scale = XSDataDouble(listLog[indexLine].split()[-1])
     #
     while not "Overall B-factor" in listLog[indexLine]:
         indexLine += 1
     xsDataCrystalScale.bFactor = XSDataDouble(listLog[indexLine].split()[-2])
     xsDataBestCollectionPlan.crystalScale = xsDataCrystalScale
     xsDataResultBest.addCollectionPlan(xsDataBestCollectionPlan)
     return xsDataResultBest
Пример #2
0
 def getBonlyOutputFromLog(self, _strBestLog):
     listLog = _strBestLog.split("\n")
     indexLine = 0
     xsDataResultBest = XSDataResultBest()
     xsDataBestCollectionPlan = XSDataBestCollectionPlan()
     xsDataCrystalScale = XSDataCrystalScale()
     #
     while not "Relative scale" in listLog[indexLine]:
         indexLine += 1
     xsDataCrystalScale.scale = XSDataDouble(listLog[indexLine].split()[-1])
     #
     while not "Overall B-factor" in listLog[indexLine]:
         indexLine += 1
     xsDataCrystalScale.bFactor = XSDataDouble(
         listLog[indexLine].split()[-2])
     xsDataBestCollectionPlan.crystalScale = xsDataCrystalScale
     xsDataResultBest.addCollectionPlan(xsDataBestCollectionPlan)
     return xsDataResultBest
Пример #3
0
    def getDataCollectionOutputDataFromLog(self, _strBestLog):
        xsDataResultBest = XSDataResultBest()
        # loop through the lines of the log file
        isScanningWedge = False
        indexLine = 0
        listLog = _strBestLog.split("\n")
        iCollectionPlanNumber = 1
        while indexLine < len(listLog):
            if "Plan of data collection for radiation damage characterisation" in listLog[indexLine]:
                xsDataBestCollectionPlan = XSDataBestCollectionPlan()
                xsDataBestStrategySummary = XSDataBestStrategySummary()
                indexLine += 2
                regEx = re.compile(""" Resolution limit =\s*(\d+\.\d+) Angstrom\s*Distance =\s*(\d+\.\d+)mm""")
                matchObj = regEx.search(listLog[indexLine])
                if matchObj == None:
                    raise BaseException("Cannot parse best log file!")
                resultMatch = matchObj.groups()
                resultion = float(resultMatch[0])
                distance = float(resultMatch[1])
                xsDataBestStrategySummary.resolution = XSDataDouble(resultion)
                xsDataBestStrategySummary.distance = XSDataLength(distance)
                xsDataBestCollectionPlan.strategySummary = xsDataBestStrategySummary
                # Burn strategy
                indexLine += 7
                collectionRunNumber = 1
                while not listLog[indexLine].startswith("-------------------------------"):
                    listLine = listLog[indexLine].split()
                    if listLine[0].startswith("exposure") or listLine[0].startswith("burn"):
                        xsDataBestCollectionRun = XSDataBestCollectionRun()
                        xsDataBestCollectionRun.collectionRunNumber = XSDataInteger(collectionRunNumber)
                        xsDataBestCollectionRun.action = XSDataString(listLine[0])
                        xsDataBestCollectionRun.phiStart = XSDataAngle(listLine[1])
                        xsDataBestCollectionRun.phiWidth = XSDataAngle(listLine[2])
                        xsDataBestCollectionRun.exposureTime = XSDataTime(listLine[3])
                        xsDataBestCollectionRun.numberOfImages = XSDataInteger(listLine[4].split("|")[0])
                        xsDataBestCollectionRun.transmission = XSDataDouble(listLine[5])
                        xsDataBestCollectionPlan.addCollectionRun(xsDataBestCollectionRun)
                        collectionRunNumber += 1
                    indexLine += 1
                xsDataBestCollectionPlan.collectionPlanNumber = XSDataInteger(iCollectionPlanNumber)
                xsDataResultBest.addCollectionPlan(xsDataBestCollectionPlan)
            if "Main Wedge" in listLog[indexLine] or "Low resolution Wedge" in listLog[indexLine] \
                or "Strategy for SAD data collection" in listLog[indexLine]:
                isScanningWedge = True
                xsDataBestCollectionPlan = XSDataBestCollectionPlan()
                xsDataBestStrategySummary = XSDataBestStrategySummary()
                if "Main Wedge" in listLog[indexLine]:
                    indexLine += 2
                    # ResolutionReasoning
                    xsDataBestStrategySummary.resolutionReasoning = XSDataString(listLog[indexLine].strip())
                elif "Strategy for SAD data collection" in listLog[indexLine]:
                    indexLine += 2
                    xsDataBestStrategySummary.resolutionReasoning = XSDataString(listLog[indexLine].strip())
                else:
                    xsDataBestStrategySummary.resolutionReasoning = XSDataString("Low-resolution pass, no overloads and full completeness")
                # Resolution, transmission, distance
                indexLine += 1
                while not "Resolution limit" in listLog[indexLine]:
                    indexLine += 1
                regEx = re.compile(""" Resolution limit =\s*(\d+\.\d+) Angstrom   Transmission =\s*(\d+\.\d+)%  Distance =\s*(\d+\.\d+)mm""")
                matchObj = regEx.search(listLog[indexLine])
                if matchObj == None:
                    raise BaseException("Cannot parse best log file!")
                resultMatch = matchObj.groups()
                resultion = float(resultMatch[0])
                transmission = float(resultMatch[1])
                distance = float(resultMatch[2])
                xsDataBestStrategySummary.resolution = XSDataDouble(resultion)
                xsDataBestStrategySummary.transmission = XSDataDouble(transmission)
                xsDataBestStrategySummary.distance = XSDataLength(distance)
                # Resolution, transmission, distance
                indexLine += 8
                while not listLog[indexLine].startswith("-------------------------------"):
                    listLine = listLog[indexLine].split()
                    xsDataBestCollectionRun = XSDataBestCollectionRun()
                    xsDataBestCollectionRun.collectionRunNumber = XSDataInteger(listLine[0])
                    xsDataBestCollectionRun.phiStart = XSDataAngle(listLine[1])
                    xsDataBestCollectionRun.phiWidth = XSDataAngle(listLine[2])
                    xsDataBestCollectionRun.exposureTime = XSDataTime(listLine[3])
                    xsDataBestCollectionRun.numberOfImages = XSDataInteger(listLine[4].split("|")[0])
                    xsDataBestCollectionRun.overlaps = XSDataString(listLine[5])
                    xsDataBestCollectionPlan.addCollectionRun(xsDataBestCollectionRun)
                    indexLine += 1
                #
                xsDataBestStrategySummary.completeness = XSDataDouble(listLine[11])
                #
                while not "Redundancy" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.redundancy = XSDataDouble(listLog[indexLine].split()[-1])
                #
                while not "I/Sigma (outer shell)" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.iSigma = XSDataDouble(listLog[indexLine].split()[6].replace(")", ""))
                #
                while not "Total Exposure time" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.totalExposureTime = XSDataTime(listLog[indexLine].split()[4])
                #
                while not "Total Data Collection time" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.totalDataCollectionTime = XSDataTime(listLog[indexLine].split()[5])
                #
                while not "Wedge Data Collection Statistics according to the Strategy" in listLog[indexLine]:
                    indexLine += 1
                (xsDataBestStatisticalPrediction, indexLine) = self.getXSDataBestStatisticalPrediction(listLog, indexLine)

                xsDataBestCollectionPlan.strategySummary = xsDataBestStrategySummary
                xsDataBestCollectionPlan.statisticalPrediction = xsDataBestStatisticalPrediction
                xsDataBestCollectionPlan.collectionPlanNumber = XSDataInteger(iCollectionPlanNumber)
                iCollectionPlanNumber += 1
                xsDataResultBest.addCollectionPlan(xsDataBestCollectionPlan)
            if "Additional information" in listLog[indexLine]:
                #
                while not "Relative scale" in listLog[indexLine]:
                    indexLine += 1
                scale = float(listLog[indexLine].split()[-1])
                #
                while not "Overall B-factor" in listLog[indexLine]:
                    indexLine += 1
                #
                bFactor = float(listLog[indexLine].split()[-2])
                while not "Estimated limit of resolution" in listLog[indexLine]:
                    indexLine += 1
                rankingResolution = float(listLog[indexLine].split()[5])
                for collectionPlan in xsDataResultBest.collectionPlan:
                    xsDataCrystalScale = XSDataCrystalScale()
                    xsDataCrystalScale.scale = XSDataDouble(scale)
                    xsDataCrystalScale.bFactor = XSDataDouble(bFactor)
                    collectionPlan.crystalScale = xsDataCrystalScale
                    collectionPlan.strategySummary.rankingResolution = XSDataDouble(rankingResolution)
            indexLine += 1
        return xsDataResultBest
Пример #4
0
    def getDataCollectionOutputDataFromLog(self, _strBestLog):
        xsDataResultBest = XSDataResultBest()
        # loop through the lines of the log file
        isScanningWedge = False
        indexLine = 0
        listLog = _strBestLog.split("\n")
        iCollectionPlanNumber = 1
        while indexLine < len(listLog):
            if "Plan of data collection for radiation damage characterisation" in listLog[
                    indexLine]:
                xsDataBestCollectionPlan = XSDataBestCollectionPlan()
                xsDataBestStrategySummary = XSDataBestStrategySummary()
                indexLine += 2
                regEx = re.compile(
                    """ Resolution limit =\s*(\d+\.\d+) Angstrom\s*Distance =\s*(\d+\.\d+)mm"""
                )
                matchObj = regEx.search(listLog[indexLine])
                if matchObj == None:
                    raise BaseException("Cannot parse best log file!")
                resultMatch = matchObj.groups()
                resultion = float(resultMatch[0])
                distance = float(resultMatch[1])
                xsDataBestStrategySummary.resolution = XSDataDouble(resultion)
                xsDataBestStrategySummary.distance = XSDataLength(distance)
                xsDataBestCollectionPlan.strategySummary = xsDataBestStrategySummary
                # Burn strategy
                indexLine += 7
                collectionRunNumber = 1
                while not listLog[indexLine].startswith(
                        "-------------------------------"):
                    listLine = listLog[indexLine].split()
                    if listLine[0].startswith(
                            "exposure") or listLine[0].startswith("burn"):
                        xsDataBestCollectionRun = XSDataBestCollectionRun()
                        xsDataBestCollectionRun.collectionRunNumber = XSDataInteger(
                            collectionRunNumber)
                        xsDataBestCollectionRun.action = XSDataString(
                            listLine[0])
                        xsDataBestCollectionRun.phiStart = XSDataAngle(
                            listLine[1])
                        xsDataBestCollectionRun.phiWidth = XSDataAngle(
                            listLine[2])
                        xsDataBestCollectionRun.exposureTime = XSDataTime(
                            listLine[3])
                        xsDataBestCollectionRun.numberOfImages = XSDataInteger(
                            listLine[4].split("|")[0])
                        xsDataBestCollectionRun.transmission = XSDataDouble(
                            listLine[5])
                        xsDataBestCollectionPlan.addCollectionRun(
                            xsDataBestCollectionRun)
                        collectionRunNumber += 1
                    indexLine += 1
                xsDataBestCollectionPlan.collectionPlanNumber = XSDataInteger(
                    iCollectionPlanNumber)
                xsDataResultBest.addCollectionPlan(xsDataBestCollectionPlan)
            if "Main Wedge" in listLog[indexLine] or "Low resolution Wedge" in listLog[indexLine] \
                or "Strategy for SAD data collection" in listLog[indexLine]:
                isScanningWedge = True
                xsDataBestCollectionPlan = XSDataBestCollectionPlan()
                xsDataBestStrategySummary = XSDataBestStrategySummary()
                if "Main Wedge" in listLog[indexLine]:
                    indexLine += 2
                    # ResolutionReasoning
                    xsDataBestStrategySummary.resolutionReasoning = XSDataString(
                        listLog[indexLine].strip())
                elif "Strategy for SAD data collection" in listLog[indexLine]:
                    indexLine += 2
                    xsDataBestStrategySummary.resolutionReasoning = XSDataString(
                        listLog[indexLine].strip())
                else:
                    xsDataBestStrategySummary.resolutionReasoning = XSDataString(
                        "Low-resolution pass, no overloads and full completeness"
                    )
                # Resolution, transmission, distance
                indexLine += 1
                while not "Resolution limit" in listLog[indexLine]:
                    indexLine += 1
                regEx = re.compile(
                    """ Resolution limit =\s*(\d+\.\d+) Angstrom   Transmission =\s*(\d+\.\d+)%  Distance =\s*(\d+\.\d+)mm"""
                )
                matchObj = regEx.search(listLog[indexLine])
                if matchObj == None:
                    raise BaseException("Cannot parse best log file!")
                resultMatch = matchObj.groups()
                resultion = float(resultMatch[0])
                transmission = float(resultMatch[1])
                distance = float(resultMatch[2])
                xsDataBestStrategySummary.resolution = XSDataDouble(resultion)
                xsDataBestStrategySummary.transmission = XSDataDouble(
                    transmission)
                xsDataBestStrategySummary.distance = XSDataLength(distance)
                # Resolution, transmission, distance
                indexLine += 8
                while not listLog[indexLine].startswith(
                        "-------------------------------"):
                    listLine = listLog[indexLine].split()
                    xsDataBestCollectionRun = XSDataBestCollectionRun()
                    xsDataBestCollectionRun.collectionRunNumber = XSDataInteger(
                        listLine[0])
                    xsDataBestCollectionRun.phiStart = XSDataAngle(listLine[1])
                    xsDataBestCollectionRun.phiWidth = XSDataAngle(listLine[2])
                    xsDataBestCollectionRun.exposureTime = XSDataTime(
                        listLine[3])
                    xsDataBestCollectionRun.numberOfImages = XSDataInteger(
                        listLine[4].split("|")[0])
                    xsDataBestCollectionRun.overlaps = XSDataString(
                        listLine[5])
                    xsDataBestCollectionPlan.addCollectionRun(
                        xsDataBestCollectionRun)
                    indexLine += 1
                #
                xsDataBestStrategySummary.completeness = XSDataDouble(
                    listLine[11])
                #
                while not "Redundancy" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.redundancy = XSDataDouble(
                    listLog[indexLine].split()[-1])
                #
                while not "I/Sigma (outer shell)" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.iSigma = XSDataDouble(
                    listLog[indexLine].split()[6].replace(")", ""))
                #
                while not "Total Exposure time" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.totalExposureTime = XSDataTime(
                    listLog[indexLine].split()[4])
                #
                while not "Total Data Collection time" in listLog[indexLine]:
                    indexLine += 1
                xsDataBestStrategySummary.totalDataCollectionTime = XSDataTime(
                    listLog[indexLine].split()[5])
                #
                while not "Wedge Data Collection Statistics according to the Strategy" in listLog[
                        indexLine]:
                    indexLine += 1
                (xsDataBestStatisticalPrediction,
                 indexLine) = self.getXSDataBestStatisticalPrediction(
                     listLog, indexLine)

                xsDataBestCollectionPlan.strategySummary = xsDataBestStrategySummary
                xsDataBestCollectionPlan.statisticalPrediction = xsDataBestStatisticalPrediction
                xsDataBestCollectionPlan.collectionPlanNumber = XSDataInteger(
                    iCollectionPlanNumber)
                iCollectionPlanNumber += 1
                xsDataResultBest.addCollectionPlan(xsDataBestCollectionPlan)
            if "Additional information" in listLog[indexLine]:
                #
                while not "Relative scale" in listLog[indexLine]:
                    indexLine += 1
                scale = float(listLog[indexLine].split()[-1])
                #
                while not "Overall B-factor" in listLog[indexLine]:
                    indexLine += 1
                #
                bFactor = float(listLog[indexLine].split()[-2])
                while not "Estimated limit of resolution" in listLog[indexLine]:
                    indexLine += 1
                rankingResolution = float(listLog[indexLine].split()[5])
                for collectionPlan in xsDataResultBest.collectionPlan:
                    xsDataCrystalScale = XSDataCrystalScale()
                    xsDataCrystalScale.scale = XSDataDouble(scale)
                    xsDataCrystalScale.bFactor = XSDataDouble(bFactor)
                    collectionPlan.crystalScale = xsDataCrystalScale
                    collectionPlan.strategySummary.rankingResolution = XSDataDouble(
                        rankingResolution)
            indexLine += 1
        return xsDataResultBest