def parseOutput(self, _strFileName): """ This method parses the output of dozor """ xsDataResultDozor = XSDataResultDozor() strOutput = EDUtilsFile.readFile(_strFileName) # Skip the four first lines listOutput = strOutput.split("\n")[6:] for strLine in listOutput: # Remove "|" listLine = shlex.split(strLine.replace("|", " ")) # print listLine if listLine != [] and not strLine.startswith("-") and not strLine.startswith("h"): xsDataImageDozor = XSDataImageDozor() imageNumber = int(listLine[0]) angle = ( self.startingAngle + (imageNumber - self.firstImageNumber) * (self.oscillationRange - self.overlap) + self.oscillationRange / 2.0 ) xsDataImageDozor.number = XSDataInteger(imageNumber) xsDataImageDozor.angle = XSDataAngle(angle) if listLine[4].startswith("-"): xsDataImageDozor.spotsNumOf = XSDataInteger(listLine[1]) xsDataImageDozor.spotsIntAver = self.parseDouble(listLine[2]) xsDataImageDozor.spotsResolution = self.parseDouble(listLine[3]) xsDataImageDozor.mainScore = self.parseDouble(listLine[7]) xsDataImageDozor.spotScore = self.parseDouble(listLine[8]) xsDataImageDozor.visibleResolution = self.parseDouble(listLine[9]) else: xsDataImageDozor.spotsNumOf = XSDataInteger(listLine[1]) xsDataImageDozor.spotsIntAver = self.parseDouble(listLine[2]) xsDataImageDozor.spotsResolution = self.parseDouble(listLine[3]) xsDataImageDozor.powderWilsonScale = self.parseDouble(listLine[4]) xsDataImageDozor.powderWilsonBfactor = self.parseDouble(listLine[5]) xsDataImageDozor.powderWilsonResolution = self.parseDouble(listLine[6]) xsDataImageDozor.powderWilsonCorrelation = self.parseDouble(listLine[7]) xsDataImageDozor.powderWilsonRfactor = self.parseDouble(listLine[8]) xsDataImageDozor.mainScore = self.parseDouble(listLine[9]) xsDataImageDozor.spotScore = self.parseDouble(listLine[10]) xsDataImageDozor.visibleResolution = self.parseDouble(listLine[11]) # Dozor spot file strWorkingDir = self.getWorkingDirectory() if strWorkingDir is not None: strSpotFile = os.path.join(self.getWorkingDirectory(), "%05d.spot" % xsDataImageDozor.number.value) if os.path.exists(strSpotFile): xsDataImageDozor.spotFile = XSDataFile(XSDataString(strSpotFile)) # print xsDataImageDozor.marshal() xsDataResultDozor.addImageDozor(xsDataImageDozor) elif strLine.startswith("h"): xsDataResultDozor.halfDoseTime = XSDataDouble(strLine.split("=")[1].split()[0]) return xsDataResultDozor
def parseOutput(self, _strFileName): """ This method parses the output of dozor """ xsDataResultDozor = XSDataResultDozor() strOutput = EDUtilsFile.readFile(_strFileName) # Skip the four first lines listOutput = strOutput.split("\n")[6:] strWorkingDir = os.path.dirname(_strFileName) for strLine in listOutput: # Remove "|" listLine = shlex.split(strLine.replace("|", " ")) if len(listLine) > 0 and listLine[0].isdigit(): xsDataImageDozor = XSDataImageDozor() imageNumber = int(listLine[0]) angle = self.startingAngle + (imageNumber - self.firstImageNumber) * (self.oscillationRange - self.overlap) + self.oscillationRange / 2.0 xsDataImageDozor.number = XSDataInteger(imageNumber) xsDataImageDozor.angle = XSDataAngle(angle) xsDataImageDozor.spotsNumOf = XSDataInteger(0) xsDataImageDozor.spotsIntAver = XSDataDouble(0) xsDataImageDozor.spotsResolution = XSDataDouble(0) xsDataImageDozor.mainScore = XSDataDouble(0) xsDataImageDozor.spotScore = XSDataDouble(0) xsDataImageDozor.visibleResolution = XSDataDouble(40) try: if listLine[4].startswith("-") or len(listLine) < 11: xsDataImageDozor.spotsNumOf = XSDataInteger(listLine[1]) xsDataImageDozor.spotsIntAver = self.parseDouble(listLine[2]) xsDataImageDozor.spotsResolution = self.parseDouble(listLine[3]) xsDataImageDozor.mainScore = self.parseDouble(listLine[7]) xsDataImageDozor.spotScore = self.parseDouble(listLine[8]) xsDataImageDozor.visibleResolution = self.parseDouble(listLine[9]) else: xsDataImageDozor.spotsNumOf = XSDataInteger(listLine[1]) xsDataImageDozor.spotsIntAver = self.parseDouble(listLine[2]) xsDataImageDozor.spotsResolution = self.parseDouble(listLine[3]) xsDataImageDozor.powderWilsonScale = self.parseDouble(listLine[4]) xsDataImageDozor.powderWilsonBfactor = self.parseDouble(listLine[5]) xsDataImageDozor.powderWilsonResolution = self.parseDouble(listLine[6]) xsDataImageDozor.powderWilsonCorrelation = self.parseDouble(listLine[7]) xsDataImageDozor.powderWilsonRfactor = self.parseDouble(listLine[8]) xsDataImageDozor.mainScore = self.parseDouble(listLine[9]) xsDataImageDozor.spotScore = self.parseDouble(listLine[10]) xsDataImageDozor.visibleResolution = self.parseDouble(listLine[11]) except: pass # Dozor spot file if strWorkingDir is not None: strSpotFile = os.path.join(strWorkingDir, "%05d.spot" % xsDataImageDozor.number.value) if os.path.exists(strSpotFile): xsDataImageDozor.spotFile = XSDataFile(XSDataString(strSpotFile)) # #print xsDataImageDozor.marshal() xsDataResultDozor.addImageDozor(xsDataImageDozor) elif strLine.startswith("h"): xsDataResultDozor.halfDoseTime = XSDataDouble(strLine.split("=")[1].split()[0]) # Check if mtv plot file exists mtvFileName = "dozor_rd.mtv" mtvFilePath = os.path.join(strWorkingDir, mtvFileName) if os.path.exists(mtvFilePath): xsDataResultDozor.plotmtvFile = XSDataFile(XSDataString(mtvFilePath)) xsDataResultDozor.pngPlots = self.generatePngPlots(mtvFilePath, strWorkingDir) return xsDataResultDozor
def parseOutput(self, _strFileName): """ This method parses the output of dozor """ xsDataResultDozor = XSDataResultDozor() strOutput = EDUtilsFile.readFile(_strFileName) # Skip the four first lines listOutput = strOutput.split("\n")[6:] strWorkingDir = os.path.dirname(_strFileName) for strLine in listOutput: # Remove "|" listLine = shlex.split(strLine.replace("|", " ")) if len(listLine) > 0 and listLine[0].isdigit(): xsDataImageDozor = XSDataImageDozor() imageNumber = int(listLine[0]) angle = self.startingAngle + ( imageNumber - self.firstImageNumber) * ( self.oscillationRange - self.overlap) + self.oscillationRange / 2.0 xsDataImageDozor.number = XSDataInteger(imageNumber) xsDataImageDozor.angle = XSDataAngle(angle) xsDataImageDozor.spotsNumOf = XSDataInteger(0) xsDataImageDozor.spotsIntAver = XSDataDouble(0) xsDataImageDozor.spotsResolution = XSDataDouble(0) xsDataImageDozor.mainScore = XSDataDouble(0) xsDataImageDozor.spotScore = XSDataDouble(0) xsDataImageDozor.visibleResolution = XSDataDouble(40) try: if listLine[5].startswith("-") or len(listLine) < 11: xsDataImageDozor.spotsNumOf = XSDataInteger( listLine[1]) xsDataImageDozor.spotsIntAver = self.parseDouble( listLine[2]) xsDataImageDozor.spotsRfactor = self.parseDouble( listLine[3]) xsDataImageDozor.spotsResolution = self.parseDouble( listLine[4]) xsDataImageDozor.mainScore = self.parseDouble( listLine[8]) xsDataImageDozor.spotScore = self.parseDouble( listLine[9]) xsDataImageDozor.visibleResolution = self.parseDouble( listLine[10]) else: xsDataImageDozor.spotsNumOf = XSDataInteger( listLine[1]) xsDataImageDozor.spotsIntAver = self.parseDouble( listLine[2]) xsDataImageDozor.spotsRfactor = self.parseDouble( listLine[3]) xsDataImageDozor.spotsResolution = self.parseDouble( listLine[4]) xsDataImageDozor.powderWilsonScale = self.parseDouble( listLine[5]) xsDataImageDozor.powderWilsonBfactor = self.parseDouble( listLine[6]) xsDataImageDozor.powderWilsonResolution = self.parseDouble( listLine[7]) xsDataImageDozor.powderWilsonCorrelation = self.parseDouble( listLine[8]) xsDataImageDozor.powderWilsonRfactor = self.parseDouble( listLine[9]) xsDataImageDozor.mainScore = self.parseDouble( listLine[10]) xsDataImageDozor.spotScore = self.parseDouble( listLine[11]) xsDataImageDozor.visibleResolution = self.parseDouble( listLine[12]) except: pass # Dozor spot file if strWorkingDir is not None: strSpotFile = os.path.join( strWorkingDir, "%05d.spot" % xsDataImageDozor.number.value) if os.path.exists(strSpotFile): xsDataImageDozor.spotFile = XSDataFile( XSDataString(strSpotFile)) # #print xsDataImageDozor.marshal() xsDataResultDozor.addImageDozor(xsDataImageDozor) elif strLine.startswith("h"): xsDataResultDozor.halfDoseTime = XSDataDouble( strLine.split("=")[1].split()[0]) # Check if mtv plot file exists mtvFileName = "dozor_rd.mtv" mtvFilePath = os.path.join(strWorkingDir, mtvFileName) if os.path.exists(mtvFilePath): xsDataResultDozor.plotmtvFile = XSDataFile( XSDataString(mtvFilePath)) xsDataResultDozor.pngPlots = self.generatePngPlots( mtvFilePath, strWorkingDir) return xsDataResultDozor