Example #1
0
    def postProcess(self):
        self.DEBUG('Pointless: postProcess')
        EDPluginExecProcessScript.postProcess(self)
        output_file = self.dataInput.output_file.value

        sgre = re.compile(""" \* Space group = '(?P<sgstr>.*)' \(number\s+(?P<sgnumber>\d+)\)""")

        sgnumber = sgstr = None
        # returns None if the file does not exist...
        log = self.readProcessLogFile()
        if log is not None:
            # we'll apply the regexp to the whole file contents which
            # hopefully won't be that long.
            m = sgre.search(log)
            if m is not None:
                d = m.groupdict()
                sgnumber = d['sgnumber']
                sgstr = d['sgstr']

        res = XSDataPointlessOut()
        if sgnumber is not None:
            res.sgnumber = XSDataInteger(sgnumber)
        if sgstr is not None:
            res.sgstr = XSDataString(sgstr)
        status = XSDataStatus()
        status.isSuccess = XSDataBoolean(os.path.exists(output_file))
        res.status = status

        self.dataOutput = res
Example #2
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecRsync.postProcess")
        # Create some output data
        xsDataResult = XSDataResultRsync(log=XSDataString(""))

        self.setDataOutput(xsDataResult)
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     EDVerbose.DEBUG("EDPluginExecSaxsMacv1_0.preProcess")
     xsdIn = self.getDataInput()
     if xsdIn.getInputImage() is not None:
         self.inputImage = xsdIn.getInputImage().getPath().getValue()
         if not os.path.isfile(self.inputImage) and "%" not in self.inputImage:
             EDVerbose.WARNING("Input file %s does not exist ... try to go on anyway" % self.inputImage)
             self.inputImage = None
     if xsdIn.getOutputImage() is not None:
         self.outputImage = xsdIn.getOutputImage().getPath().getValue()
     if xsdIn.getFirstImage() is not None:
         self.firstImage = xsdIn.getFirstImage().getValue()
     if xsdIn.getLastImage() is not None:
         self.lastImage = xsdIn.getLastImage().getValue()
     if xsdIn.getOptions() is not None:
         self.options = xsdIn.getOptions().getValue()
     if xsdIn.getDummy() is not None:
         self.dummy = xsdIn.getDummy().getValue()
     if xsdIn.getIncrement() is not None:
         self.increment = xsdIn.getIncrement().getValue()
     if xsdIn.getAddConst() is not None:
         self.addConst = xsdIn.getAddConst().getValue()
     if xsdIn.getMultConst() is not None:
         self.multConst = xsdIn.getMultConst().getValue()
     #Create the command line to run the program
     self.generateSaxsMacCommand()
Example #4
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 #5
0
    def __init__(self):
        EDPluginExecProcessScript.__init__(self)
        self.setXSDataInputClass(XSDataInputBest)

        # This version of the Best plugin requires the latest
        # version of Best. 
        self.addCompatibleVersion("Version 4.1.0 //  02.10.2012")

        self.strCONF_BEST_HOME_LABEL = "besthome"

        # Default value of strategy complexity
        self.strComplexity = "none"

        self.strBestHome = None
        self.strCommandBestHome = None
        self.strCommandBest = None

        self.strExposureTime = None
        self.strDoseRate = None
        self.strDetectorType = None

        self.strPathToBestDatFile = None
        self.strPathToBestParFile = None
        self.listFileBestHKL = []

        self.bVersionHigherThan4_0 = False
Example #6
0
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecDatGnomv1_1.postProcess")
     # Create some output data
     cwd = self.getWorkingDirectory()
     outfile = os.path.join(cwd, os.path.basename(self.outFile))
     if not os.path.isfile(outfile):
         self.error("EDPluginExecDatGnomv1_1 did not produce output file %s as expected !" % self.outFile)
         self.setFailure()
         self.dataOutput = XSDataResultDatGnom()
         return
     try:
         os.rename(outfile, self.outFile)
     except OSError:  # may fail if src and dst on different filesystem
         shutil.copy(outfile, self.outFile)
     gnom = XSDataGnom(gnomFile=XSDataFile(XSDataString(self.outFile)))
     logfile = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName())
     out = open(logfile, "r").read().split()
     for key, val, typ in (("dmax:", "dmax", XSDataLength),
                         ("Guinier:", "rgGuinier", XSDataLength),
                         ("Gnom:", "rgGnom", XSDataLength),
                         ("Total:", "total", XSDataDouble)):
         if key in out:
             idx = out.index(key)
             res = out[idx + 1]
             gnom.__setattr__(val, typ(float(res)))
         else:
             self.error("EDPluginExecDatGnomv1_1.postProcess No key %s in file %s" % (key, logfile))
             self.setFailure()
     self.dataOutput = XSDataResultDatGnom(gnom=gnom)
     self.dataOutput.status = XSDataStatus(message=self.getXSDataMessage())
 def preProcess(self, _edObject=None):
     """
     Sets up the phenix.xtriage command line, uncompress mtz file if necessary
     """
     EDPluginExecProcessScript.preProcess(self, _edObject)
     self.DEBUG("EDPluginPhenixXtriagev1_1.preProcess...")
     # Check if we have a compressed mtz file...
     strPathMtz = self.dataInput.mtzFile.path.value
     if strPathMtz.endswith(".gz"):
         fIn = gzip.open(strPathMtz, "rb")
         fileContent = fIn.read()
         fIn.close()
         strMtzFileName = os.path.basename(strPathMtz).split(".gz")[0]
         self.strPathToLocalMtz = os.path.join(self.getWorkingDirectory(), strMtzFileName)
         fOut = open(self.strPathToLocalMtz, "wb")
         fOut.write(fileContent)
         fOut.close()
         strPathMtz = self.strPathToLocalMtz
     if self.dataInput.obsLabels is not None:
         strObsLabels = self.dataInput.obsLabels.value
     else:
         strObsLabels = "I,SIGI,merged"
     strCommandPhenixXtriage = "{0} obs={1}".format(strPathMtz, strObsLabels)
     # Necessary for Python 3 environment:
     self.addListCommandPreExecution("unset PYTHONPATH")
     self.setScriptCommandline(strCommandPhenixXtriage)
 def __init__(self):
     """
     """
     EDPluginExecProcessScript.__init__(self)
     self.setXSDataInputClass(XSDataInputSaxsDelMetadatav1_0)
     self.strImage = None
     self.strKey = None
    def __init__(self):
        EDPluginExecProcessScript.__init__(self)

        self.addCompatibleVersion('Version 3.1.0.d //  26.04.2007')
        self.addCompatibleVersion('Version 3.1.0.d //  16.07.2007')
        self.addCompatibleVersion('Version 3.2.0 //  03.11.2008')

        self.strCONF_BEST_HOME_LABEL = "besthome"

        # Default value of strategy complexity
        self.strComplexity = "none"

        self.strBestHome = None
        self.strCommandBestHome = None
        self.strCommandBest = None

        self.strExposureTime = None
        self.strDoseRate = None
        self.strDetectorType = None

        self.strPathToBestDatFile = None
        self.strPathToBestParFile = None
        self.listFileBestHKL = []

        self.setXSDataInputClass(XSDataInputBest)
Example #10
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG("EDPluginSPDCakev1_0.preProcess")
        # Check that the input data and correction images are present
        xsDataInputSPDCake = self.getDataInput()
        pathToInputFile = xsDataInputSPDCake.getInputFile().getPath().getValue()
        if (not os.path.exists(pathToInputFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToInputFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pathToDarkCurrentImageFile = xsDataInputSPDCake.getDarkCurrentImageFile().getPath().getValue()
        if (not os.path.exists(pathToDarkCurrentImageFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToDarkCurrentImageFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pathToFlatFieldImageFile = xsDataInputSPDCake.getFlatFieldImageFile().getPath().getValue()
        if (not os.path.exists(pathToFlatFieldImageFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToFlatFieldImageFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pathToSpatialDistortionFile = xsDataInputSPDCake.getSpatialDistortionFile().getPath().getValue()
        if (not os.path.exists(pathToSpatialDistortionFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToSpatialDistortionFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        if xsDataInputSPDCake.getOutputDir() is not None:
            self.outputDir = xsDataInputSPDCake.getOutputDir().getPath().getValue()
            if not os.path.isdir(self.outputDir):
                os.makedirs(self.outputDir)

        self.generateSPDCommand()
Example #11
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        self.DEBUG("EDPluginBestv1_2.preProcess")

        self.setScriptLogFileName("best.log")

        self.setFileBestDat(os.path.join(self.getWorkingDirectory(), "bestfile.dat"))
        self.setFileBestPar(os.path.join(self.getWorkingDirectory(), "bestfile.par"))

        EDUtilsFile.writeFile(self.getFileBestDat(), self.getDataInput().getBestFileContentDat().getValue())
        EDUtilsFile.writeFile(self.getFileBestPar(), self.getDataInput().getBestFileContentPar().getValue())

        listBestFileContentHKL = self.getDataInput().getBestFileContentHKL()

        iterator = 0
        for bestFileContentHKL in listBestFileContentHKL:
            iterator = iterator + 1
            bestFileHKL = os.path.join(self.getWorkingDirectory(), "bestfile" + str(iterator) + ".hkl")
            self.listFileBestHKL.append(bestFileHKL)
            EDUtilsFile.writeFile(bestFileHKL, bestFileContentHKL.getValue())


        if(self.getDataInput().getComplexity() is not None):
            self.setComplexity(self.getDataInput().getComplexity().getValue())

        self.initializeCommands()
    def __init__(self):
        """
        """
        EDPluginExecProcessScript.__init__(self)
        self.__strCommandBeamSize = None
        self.__strCommandBeamFlux = None
        self.__strCommandBeamWavelength = None

        self.__strCommandCrystalSize = None
        self.__strCommandCrystalCell = None
        self.__strCommandCrystalNRES = None
        self.__strCommandCrystalNMON = None
        self.__strCommandCrystalNDNA = None
        self.__strCommandCrystalNRNA = None
        self.__strCommandCrystalPATM = None
        self.__strCommandCrystalSATM = None

        self.__strCommandExposureTime = None
        self.__strCommandImages = None

        self.__listCommandsRaddose = []

        self.__dictResults = {}

        # ugly workaround while waiting for RADDOSE XML output file
        for strAbsorbedDoseKeyword in EDPluginRaddosev10.__listABSORBED_DOSE:
            self.__dictResults[ strAbsorbedDoseKeyword ] = None

        self.__dictResults[ EDPluginRaddosev10.__strSOLVENT ] = None

        self.__fSolvent = None
        self.__fTimeToReachHendersonLimit = None

        self.setXSDataInputClass(XSDataRaddoseInput)
Example #13
0
    def __init__(self):
        EDPluginExecProcessScript.__init__(self)
        self.setXSDataInputClass(XSDataInputBest)

        # Version 3.3.0 is deprecated, see bug #532
        self.addCompatibleVersion("Version 3.3.0 //  15.11.2009")
        self.addCompatibleVersion("Version 3.3.1 //  24.04.2010")
        self.addCompatibleVersion("Version 3.3.2 //  25.10.2010")
        self.addCompatibleVersion("Version 3.4.0 //  15.11.2010")
        self.addCompatibleVersion("Version 3.4.1 //  15.02.2011")
        self.addCompatibleVersion("Version 3.4.2 //  05.03.2011")
        self.addCompatibleVersion("Version 3.4.3 //  06.05.2011")
        self.addCompatibleVersion("Version 3.4.4 //  10.06.2011")
        self.addCompatibleVersion("Version 4.1.0 //  02.10.2012")

        self.strCONF_BEST_HOME_LABEL = "besthome"

        # Default value of strategy complexity
        self.strComplexity = "none"

        self.strBestHome = None
        self.strCommandBestHome = None
        self.strCommandBest = None

        self.strExposureTime = None
        self.strDoseRate = None
        self.strDetectorType = None

        self.strPathToBestDatFile = None
        self.strPathToBestParFile = None
        self.listFileBestHKL = []

        self.bVersionHigherThan4_0 = False
Example #14
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG("EDPluginExecDcrawv1_0.preProcess")
        self.__strRawFile = self.getDataInput().getRawImagePath().getPath().getValue()
        if self.getDataInput().getOutputPath() is not None:
            self.__strOutputFile = self.getDataInput().getOutputPath().getPath().getValue()
        if self.getDataInput().getExtractThumbnail() is not None:
            self.__bExtracThumbnail = (self.getDataInput().getExtractThumbnail().getValue() in [1, "true", "True", "TRUE", True])
########################################################################
# This option is incompatible with all others
########################################################################
        if self.__bExtracThumbnail is True:
            self.__bWBCamera = False
            self.__strOutputType = None #we cannot know what find of thumbnail is saved, can be jpeg, tiff or nothing !
        else:
            if  self.getDataInput().getExportTiff() is not None:
                self.__bExportTiff = (self.getDataInput().getExportTiff().getValue() in [1, "true", "True", "TRUE", True])
                if self.__bExportTiff:
                    self.__strOutputType = "tiff"
            if self.getDataInput().getWhiteBalanceAuto() is not None:
                self.__bWBAuto = (self.getDataInput().getWhiteBalanceAuto().getValue() in [1, "true", "True", "TRUE", True])
                if self.__bWBAuto is True: self.__bWBCamera = False
            if self.getDataInput().getWhiteBalanceFromCamera() is not None:
                self.__bWBCamera = (self.getDataInput().getWhiteBalanceFromCamera().getValue() in [1, "true", "True", "TRUE", True])
            if self.getDataInput().getLevelsFromCamera() is not None:
                self.__bLevelCamera = (self.getDataInput().getLevelsFromCamera().getValue()  in [1, "true", "True", "TRUE", True])
            if self.getDataInput().getInterpolationQuality() is not None:
                self.__iInterpolate = self.getDataInput().getInterpolationQuality().getValue()
        self.generateDcrawCommand()
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginH5ToCBFv1_0.postProcess")

        if self.dataInput.dataCollection is None:
            shutil.copy(self.tmpCBFFile, self.CBFFile)
        else:
            # Fill in metadata
            fileTmpCBF = open(self.tmpCBFFile)
            tmpCBF = fileTmpCBF.read()
            fileTmpCBF.close()

            # Replace opening line
            tmpCBF = tmpCBF.replace("CBF: VERSION 1.5, CBFlib v0.7.8 - SLS/DECTRIS PILATUS detectors",
                                    "CBF: VERSION 1.5, CBFlib v0.7.8")


            index1 = tmpCBF.find("# WARNING: FOR XDS PROCESSING ONLY.")
            string2 = "# SOFTWARE VERSION: 1.1.0-RELEASE"
            index2 = tmpCBF.find(string2) + len(string2)

            miniCBFHeader = self.generateMiniCBFHeader(self.dataInput)

            newCBF = tmpCBF[:index1] + miniCBFHeader + tmpCBF[index2:]
            newCBFFile = open(self.CBFFile, "w")
            newCBFFile.write(newCBF)
            newCBFFile.close()
    def postProcess(self, _edObject = None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG(
            '*** EDPluginExecDIMPLEREFMACRestrainedRefinementv10.postProcess')
        
        init_r, init_r_free, final_r, final_r_free = self.parse_refmac_log()

        xsDataResult = CCP4DataResultREFMACRestrainedRefinement(
            HKLOUT = HKL(self._hklout),
            XYZOUT = XYZ(self._xyzout),
            initialR = XSDataFloat(init_r),
            initialRFree = XSDataFloat(init_r_free),
            finalR = XSDataFloat(final_r),
            finalRFree = XSDataFloat(final_r_free),            
            returnStatus = CCP4ReturnStatus())

        self.setDataOutput(xsDataResult)    
        

        if not os.path.isfile(self.getDataOutput().getHKLOUT().getPath().getValue()):
            raise RuntimeError, 'File %s does not exist' % self.getDataOutput().getHKLOUT().getPath().getValue() 

        if not os.path.isfile(self.getDataOutput().getXYZOUT().getPath().getValue()):
            raise RuntimeError, 'File %s does not exist' % self.getDataOutput().getXYZOUT().getPath().getValue() 


        return
Example #17
0
 def __init__(self):
     EDPluginExecProcessScript.__init__(self)
     self.setXSDataInputClass(XSDataInputDozor)
     self.setDataOutput(XSDataResultDozor())
     self.strImageLinkSubDirectory = "img"
     self.defaultFractionPolarization = 0.99
     self.defaultImageStep = 1
     self.startingAngle = 0.0
     self.firstImageNumber = None
     self.oscillationRange = None
     self.overlap = 0.0
     self.ixMin = None
     self.iyMin = None
     self.ixMax = None
     self.iyMax = None
     # Default values for ESRF Pilatus6M id23eh1: 1,1230; 1228,1298
     self.ixMinPilatus6m = 1
     self.ixMaxPilatus6m = 1230
     self.iyMinPilatus6m = 1228
     self.iyMaxPilatus6m = 1298
     # Default values for ESRF Pilatus2M : ID30a1: 1,776; 826,894
     self.ixMinPilatus2m = 1
     self.ixMaxPilatus2m = 776
     self.iyMinPilatus2m = 826
     self.iyMaxPilatus2m = 894
     # Default values for ESRF Eiger4M : ID30a3: 1,1120; 1025,1140
     self.ixMinEiger4m = 1
     self.ixMaxEiger4m = 1120
     self.iyMinEiger4m = 1025
     self.iyMaxEiger4m = 1140
     # Bad zones
     self.strBad_zona = None
    def __init__(self):
        EDPluginExecProcessScript.__init__(self)
        self.setXSDataInputClass(XSDataInputCrystFEL)
        self.setDataOutput(XSDataResultCrystFEL())

        #TODO move to input file
        self.partialator_options = "--max-adu=65000 --iterations=1 --model=unity -j 60"
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     EDVerbose.DEBUG("EDPluginExecMTZDUMPUnitCellSpaceGroupv10.postProcess")
     # Create some output data
     pyStrLog = self.readProcessLogFile()
     xsDataResultMTZDUMPUnitCellSpaceGroup = self.parseMTZDUMPLog(pyStrLog)
     self.setDataOutput(xsDataResultMTZDUMPUnitCellSpaceGroup)
Example #20
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginExecDammifv0_1.postProcess")
        # Create some output data

        pathLogFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif.log"))
        pathFitFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif.fit"))
        pathMoleculeFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif-1.pdb"))
        pathSolventFile = XSDataString(os.path.join(self.getWorkingDirectory(), "dammif-0.pdb"))

        xsLogFile = XSDataFile(pathLogFile)
        xsFitFile = XSDataFile(pathFitFile)
        xsMoleculeFile = XSDataFile(pathMoleculeFile)
        xsSolventFile = XSDataFile(pathSolventFile)

        xsDataResult = XSDataResultDammif()
        if os.path.exists(pathLogFile.getValue()):
            xsDataResult.setLogFile(xsLogFile)
        if os.path.exists(pathFitFile.getValue()):
            xsDataResult.setFitFile(xsFitFile)
        if os.path.exists(pathMoleculeFile.getValue()):
            xsDataResult.setPdbMoleculeFile(xsMoleculeFile)
        if os.path.exists(pathSolventFile.getValue()):
            xsDataResult.setPdbSolventFile(xsSolventFile)

        xsDataResult.setChiSqrt(self.returnDammifChiSqrt())
        xsDataResult.setRfactor(self.returnDammifRFactor())

        self.setDataOutput(xsDataResult)
Example #21
0
    def __init__(self):
        EDPluginExecProcessScript.__init__(self)
        self.setRequiredToHaveConfiguration(True)
        self.setXSDataInputClass(XSDataAimless)

        self.output_file = None
        self.input_file = None
Example #22
0
 def __init__(self):
     EDPluginExecProcessScript.__init__(self)
     self.setXSDataInputClass(XSDataInputDozor)
     self.setDataOutput(XSDataResultDozor())
     self.strImageLinkSubDirectory = "img"
     self.defaultFractionPolarization = 0.99
     self.defaultImageStep = 1
     self.startingAngle = 0.0
     self.firstImageNumber = None
     self.oscillationRange = None
     self.overlap = 0.0
     self.ixMin = None
     self.iyMin = None
     self.ixMax = None
     self.iyMax = None
     # Default values for ESRF Pilatus6M
     self.ixMinPilatus6m = 1
     self.ixMaxPilatus6m = 1270
     self.iyMinPilatus6m = 1190
     self.iyMaxPilatus6m = 1310
     # Default values for ESRF Pilatus2M
     self.ixMinPilatus2m = 1
     self.ixMaxPilatus2m = 840
     self.iyMinPilatus2m = 776
     self.iyMaxPilatus2m = 852
     # Default values for ESRF Eiger4M
     self.ixMinEiger4m = 1
     self.ixMaxEiger4m = 840
     self.iyMinEiger4m = 776
     self.iyMaxEiger4m = 852
     # Bad zones
     self.strBad_zona = None
Example #23
0
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     self.DEBUG("EDPluginExecDataverv1_0.preProcess")
     self.lstInFiles = [i.path.value for i in  self.dataInput.inputCurve]
     if self.dataInput.outputCurve is not None:
         self.strOutFile = self.dataInput.outputCurve.path.value
     self.generateCommandLine()
Example #24
0
 def __init__(self):
     """
     """
     EDPluginExecProcessScript.__init__(self)
     self.setXSDataInputClass(XSDataInputDataver)
     self.strOutFile = None
     self.lstInFiles = []
Example #25
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecDatcmpv2_0.postProcess")

        strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()), self.getScriptLogFileName())
        if os.path.isfile(strResultFile):
            for line in open(strResultFile):
                words = line.split()
                if (self.atsasVersion == "2.5.2") and (len(words) == 5):
                    try:
                        self.fChi = float(words[-2])
                        self.fFidelity = float(words[-1])
                    except ValueError:
                        self.WARNING("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line))
                    else:
                        break
                if (self.atsasVersion == "2.6.1") and (len(words) == 6):
                    try:
                        self.fChi = float(words[-3]) ** 0.5
                        self.fFidelity = float(words[-1].strip('*'))
                    except ValueError:
                        self.DEBUG("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line))
                    else:
                        break

        # Create some output data
        xsDataResult = XSDataResultDatcmp()
        if self.fChi is not None:
            xsDataResult.chi = XSDataDouble(self.fChi)
        if self.fFidelity is not None:
            xsDataResult.fidelity = XSDataDouble(self.fFidelity)

        self.setDataOutput(xsDataResult)
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     EDVerbose.DEBUG("EDPluginExecSaxsDelMetadatav1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultSaxsDelMetadatav1_0()
     xsDataResult.setOutputImage(self.getDataInput().getInputImage())
     self.setDataOutput(xsDataResult)
 def __init__(self):
     """
     """
     EDPluginExecProcessScript.__init__(self)
     self.setXSDataInputClass(XSDataInputMeasureOffsetSift)
     self.inputFiles = []
     self.outFile = None
 def finallyProcess(self, _edObject=None):
     """
     Parses the labelit.screen log file and the generated MOSFLM script
     """
     EDPluginExecProcessScript.finallyProcess(self, _edObject)
     self.DEBUG("EDPluginDistlSignalStrengthThinClientv1_1.finallyProcess")
     strLabelitDistlLog = self.readProcessLogFile()
     if (strLabelitDistlLog is None):
         strErrorMessage = "EDPluginDistlSignalStrengthThinClientv1_1.finallyProcess : Could not read the Labelit log file"
         self.error(strErrorMessage)
         self.addErrorMessage(strErrorMessage)
         self.setFailure()
         xsDataImageQualityIndicators = XSDataImageQualityIndicators()
         xsDataImageQualityIndicators.setImage(self.xsDataImage)
     elif strLabelitDistlLog == "":
         strLabelitDislErr = self.readProcessErrorLogFile()
         if "httplib.BadStatusLine" in strLabelitDislErr:
             strErrorMessage = "Cannot read image due to problem with file permission!"
         else:
             strErrorMessage = "Labelit thin client error message: " + strLabelitDislErr
         self.error(strErrorMessage)
         self.addErrorMessage(strErrorMessage)
         self.setFailure()
         xsDataImageQualityIndicators = XSDataImageQualityIndicators()
         xsDataImageQualityIndicators.setImage(self.xsDataImage)
     else:
         xsDataImageQualityIndicators = self.parseLabelitDistlOutput(strLabelitDistlLog)
         xsDataImageQualityIndicators.setImage(self.xsDataImage)
     xsDataResultDistlSignalStrength = XSDataResultDistlSignalStrength()
     xsDataResultDistlSignalStrength.setImageQualityIndicators(xsDataImageQualityIndicators)
     self.setDataOutput(xsDataResultDistlSignalStrength)
Example #29
0
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecDataverv1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultDataver()
     xsDataResult.outputCurve = XSDataFile(XSDataString(self.strOutFile))
     self.setDataOutput(xsDataResult)
Example #30
0
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     self.DEBUG("EDPluginExecMtz2Variousv1_0.preProcess")
     xsDataInputRdfit = self.getDataInput()
     self.setScriptCommandline(self.generateCommands(xsDataInputRdfit))
     self.addListCommandPostExecution("gle -device png -resolution 100 %s" % self.strScaleIntensityGleFile)
     self.strScaleIntensityPlotPath = os.path.join(self.getWorkingDirectory(), self.strScaleIntensityPlot)
Example #31
0
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecEpydocv1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultEpydoc()
     if self.strProjectName is None:
         strName = "api." + self.strOutputType
     else:
         strName = self.strProjectName + "." + self.strOutputType
     dest = os.path.join(self.strDestpath, strName)
     if os.path.isfile(dest):
         xsDataResult.setDocPath(XSDataFile(XSDataString(dest)))
     else:
         xsDataResult.setDocPath(self.getDataInput().getDocPath())
     self.setDataOutput(xsDataResult)
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginExecDIMPLEPointlessOriginv10.postProcess")

        xsDataResult = CCP4DataResultPointlessOrigin(
            HKLOUT=HKL(self._hklout), returnStatus=CCP4ReturnStatus())

        self.setDataOutput(xsDataResult)

        if not os.path.isfile(
                self.getDataOutput().getHKLOUT().getPath().getValue()):
            raise RuntimeError, 'File %s does not exist' % self.getDataOutput(
            ).getHKLOUT().getPath().getValue()

        return
Example #33
0
    def preProcess(self, _edObject=None):
        """
        Sets up the Labelit command line
        """
        EDPluginExecProcessScript.preProcess(self, _edObject)
        self.DEBUG("EDPluginLabelitv10.preProcess...")

        self.setScriptExecutable("labelit.screen")

        self.initaliseLabelitCommandLine()

        self.addListCommandPreExecution("export PYTHONPATH=\"\" ")
        self.addListCommandPreExecution(". %s" % self.getPathToLabelitSetpathScript())

        self.addListCommandPostExecution("[ -f \"LABELIT_possible\" ] && labelit.mosflm_scripts")
Example #34
0
 def configure(self):
     EDPluginExecProcessScript.configure(self)
     self.DEBUG("EDPluginMOSFLMv10.configure")
     self.setRequireCCP4(True)
     self.setScriptCommandline(" DNA " + self.getScriptBaseName() +
                               "_dnaTables.xml")
     # Check for reversephi configuration option
     self.bReversephi = self.config.get("reversephi")
     self.fPolarization = self.config.get("polarization")
     if self.fPolarization is not None:
         self.fPolarization = float(self.fPolarization)
     self.iOmega = self.config.get("omega")
     if self.iOmega is not None:
         self.iOmega = int(self.iOmega)
     self.strRaster = self.config.get("raster")
Example #35
0
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecXia2DIALSv1_0.postProcess")
     # Run xia2.ispyb_xml
     currentDir = os.getcwd()
     os.chdir(self.getWorkingDirectory())
     if EDUtilsPath.isEMBL():
         subprocess.call("/mx-beta/dials-v1-5-1/build/bin/xia2.ispyb_xml")
     else:
         subprocess.call("/opt/pxsoft/bin/xia2.ispyb_xml")
     os.chdir(currentDir)
     # Populate the results
     xsDataResultXia2DIALS = self.parseOutputDirectory(
         self.getWorkingDirectory())
     self.dataOutput = xsDataResultXia2DIALS
Example #36
0
    def __init__(self):
        """
        """
        EDPluginExecProcessScript.__init__(self)
        self.setXSDataInputClass(XSDataInputExecDcrawv1)

        self.__strRawFile = None
        self.__strOutputType = "ppm"
        self.__strOutputFile = None
        self.__bExportTiff = False
        self.__bExtracThumbnail = False
        self.__bWBAuto = False
        self.__bWBCamera = True
        self.__bLevelCamera = False
        self.__iInterpolate = None
Example #37
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginExecSaxsAnglev1_0.postProcess")
        # Create some output data
        xsDataResult = XSDataResultSaxsAnglev1_0()
        if self.regroupedDataFile is None:
            self.regroupedDataFile = "output.edf"
        if os.path.isfile(self.regroupedDataFile):
            xsdFile = XSDataImage()
            xsdFile.setPath(
                XSDataString(os.path.abspath(self.regroupedDataFile)))
            #            EDVerbose.DEBUG("EDPluginExecSaxsAnglev1_0 xsDataFile: \n%s" % xsdFile.marshal())
            xsDataResult.setRegroupedDataFile(xsdFile)
#            EDVerbose.DEBUG("EDPluginExecSaxsAnglev1_0 xsDataResult: \n%s" % xsDataResult.marshal())
        self.setDataOutput(xsDataResult)
Example #38
0
 def preProcess(self, _edObject=None):
     """
     Sets up the Labelit command line
     """
     EDPluginExecProcessScript.preProcess(self, _edObject)
     self.DEBUG("EDPluginDistlSignalStrengthThinClientv1_1.preProcess...")
     self.xsDataImage = self.getDataInput().getReferenceImage()
     strCommandLine = self.xsDataImage.getPath().getValue()
     strCommandLine += " %s" % self.strHostName
     strCommandLine += " %d" % self.iPortNumber
     self.setScriptCommandline(strCommandLine)
     self.addListCommandPreExecution("export PYTHONPATH=\"\" ")
     self.setProcessInfo(
         "image %s" %
         os.path.basename(self.xsDataImage.getPath().getValue()))
Example #39
0
 def configure(self):
     EDPluginExecProcessScript.configure(self)
     self.DEBUG("EDPluginControlLabelitv10.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         self.warning("EDPluginControlLabelitv10.configure: No Labelit plugin item defined.")
         xsPluginItem = XSPluginItem()
     strPathToLabelitSetpathScript = EDConfiguration.getStringParamValue(xsPluginItem, self.strCONF_PATH_TO_LABELIT_SETPATH_SCRIPT)
     if(strPathToLabelitSetpathScript == None):
         errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlLabelitv10.configure', self.getClassName(), "Configuration parameter missing: " + self.strCONF_PATH_TO_LABELIT_SETPATH_SCRIPT)
         self.error(errorMessage)
         self.addErrorMessage(errorMessage)
         raise RuntimeError, errorMessage
     else:
         self.setPathToLabelitSetpathScript(strPathToLabelitSetpathScript)
Example #40
0
 def configure(self):
     EDPluginExecProcessScript.configure(self)
     self.DEBUG("EDPluginBestv1_3.configure")
     self.setRequireCCP4(True)
     strScriptExecutable = self.getScriptExecutable()
     self.DEBUG("EDPluginBestv1_3.configure: Script Executable: " +
                strScriptExecutable)
     strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable)
     strBestHome = self.config.get(self.strCONF_BEST_HOME_LABEL,
                                   strBestScriptHome)
     self.setBestHome(strBestHome)
     self.DEBUG("EDPluginBestv1_3.configure: Best Home: " + strBestHome)
     self.setCommandBestHome("export besthome=" + self.getBestHome())
     strVersion = self.config.get(
         self.CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING, "Unknown")
Example #41
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        self.DEBUG("EDPluginExecGnomv0_2.preProcess")
        if self.dataInput.angularScale is not None:
            self.fAngularScale = self.dataInput.angularScale.value
        dataInput = self.dataInput

        inputFile = None
        if len(dataInput.experimentalDataQ) > 0:
            self.npaExperimentalDataQ = numpy.array(
                [i.value for i in dataInput.experimentalDataQ])
        elif dataInput.experimentalDataQArray is not None:
            self.npaExperimentalDataQ = EDUtilsArray.xsDataToArray(
                dataInput.experimentalDataQArray)
        elif dataInput.experimentalDataFile is not None:
            inputFile = dataInput.experimentalDataFile.path.value
        else:
            strErrorMessage = "EDPluginExecGnomv0_2: input parameter is missing: experimentalDataQ or experimentalDataQArray or experimentalDataFile"
            self.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage

        if len(dataInput.experimentalDataValues) > 0:
            self.npaExperimentalDataI = numpy.array(
                [i.value for i in dataInput.experimentalDataValues])
        elif dataInput.experimentalDataIArray is not None:
            self.npaExperimentalDataI = EDUtilsArray.xsDataToArray(
                dataInput.experimentalDataIArray)
        elif dataInput.experimentalDataFile is not None:
            inputFile = dataInput.experimentalDataFile.path.value
        else:
            strErrorMessage = "EDPluginExecGnomv0_2: input parameter is missing: experimentalDataValues or experimentalDataIArray or experimentalDataFile"
            self.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage

        if len(dataInput.experimentalDataStdDev) > 0:
            self.npaExperimentalDataStdDev = numpy.array(
                [i.value for i in dataInput.experimentalDataStdDev])
        elif dataInput.experimentalDataStdArray is not None:
            self.npaExperimentalDataStdDev = EDUtilsArray.getArray(
                dataInput.experimentalDataStdArray)

        if inputFile:
            self.loadDataFile(inputFile)

        self.generateGnomConfigFile()
        self.generateGnomScript()
Example #42
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG("EDPluginSPDCakev1_1.preProcess")
        # Check that the input data and correction images are present
        xsDataInputSPDCake = self.getDataInput()
        pyStrPathToInputFile = xsDataInputSPDCake.getInputFile().getPath(
        ).getValue()
        if (not os.path.exists(pyStrPathToInputFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess", pyStrPathToInputFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pyStrPathToDarkCurrentImageFile = xsDataInputSPDCake.getDarkCurrentImageFile(
        ).getPath().getValue()
        if (not os.path.exists(pyStrPathToDarkCurrentImageFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess",
                pyStrPathToDarkCurrentImageFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pyStrPathToFlatFieldImageFile = xsDataInputSPDCake.getFlatFieldImageFile(
        ).getPath().getValue()
        if (not os.path.exists(pyStrPathToFlatFieldImageFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess",
                pyStrPathToFlatFieldImageFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pyStrPathToSpatialDistortionFile = xsDataInputSPDCake.getSpatialDistortionFile(
        ).getPath().getValue()
        if (not os.path.exists(pyStrPathToSpatialDistortionFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess",
                pyStrPathToSpatialDistortionFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage

        if xsDataInputSPDCake.getOutputDir() is not None:
            self.outputDir = xsDataInputSPDCake.getOutputDir().getPath(
            ).getValue()
            if not os.path.isdir(self.outputDir):
                os.makedirs(self.outputDir)

        self.generateSPDCommand()
Example #43
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecDatcmpv2_0.postProcess")

        strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()),
                                     self.getScriptLogFileName())
        if os.path.isfile(strResultFile):
            for line in open(strResultFile):
                words = line.split()
                if (self.atsasVersion == "2.5.2") and (len(words) == 5):
                    try:
                        self.fChi = float(words[-2])
                        self.fFidelity = float(words[-1])
                    except ValueError:
                        self.WARNING("Strange ouptut from %s:%s %s" %
                                     (strResultFile, os.linesep, line))
                    else:
                        break
                elif (self.atsasVersion
                      == "2.6.1") and (len(words) == 6) and ('vs.' in words):
                    if self.testType == 'CHI-SQUARE':
                        try:
                            self.fChi = float(words[-3].strip('*'))**0.5
                            self.fFidelity = float(words[-1].strip('*'))
                        except ValueError:
                            self.WARNING("Strange ouptut from %s:%s %s" %
                                         (strResultFile, os.linesep, line))
                        else:
                            break
                    else:
                        try:
                            self.fFidelity = float(words[-1].strip('*'))
                            self.naFidelity = float(words[-2].strip('*'))
                        except ValueError:
                            self.WARNING("Strange ouptut from %s:%s %s" %
                                         (strResultFile, os.linesep, line))
                        else:
                            break

        # Create some output data
        xsDataResult = XSDataResultDatcmp()
        if self.fChi is not None:
            xsDataResult.chi = XSDataDouble(self.fChi)
        if self.fFidelity is not None:
            xsDataResult.fidelity = XSDataDouble(self.fFidelity)
        if self.naFidelity is not None:
            xsDataResult.nonadjustedFidelity = XSDataDouble(self.naFidelity)
        self.setDataOutput(xsDataResult)
Example #44
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        self.DEBUG("EDPluginExecDatGnomv1_0.preProcess")
        self.datFile = self.dataInput.inputCurve.path.value
        if self.dataInput.output is not None:
            self.outFile = self.dataInput.output.path.value
        else:
            self.outFile = os.path.join(
                self.getWorkingDirectory(),
                os.path.splitext(os.path.basename(self.datFile)))
        if self.dataInput.rg is not None:
            self.rg = self.dataInput.rg.value
        if self.dataInput.skip is not None:
            self.skip = self.dataInput.skip.value

        self.generateCommandLineOptions()
Example #45
0
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecDatPorodv1_0.postProcess")
     # Create some output data
     logfile = os.path.join(self.getWorkingDirectory(),
                            self.getScriptLogFileName())
     out = open(logfile, "r").read().split()
     try:
         res = float(out[0])
     except (ValueError, IndexError):
         self.error("Unable to read porod log file: " + logfile)
         self.setFailure()
     else:
         xsDataResult = XSDataResultDatPorod(volume=XSDataDoubleWithUnit(
             value=res))
         self.setDataOutput(xsDataResult)
 def preProcess(self):
     EDPluginExecProcessScript.preProcess(self)
     self.DEBUG('Pointless: preprocess')
     if self.output_file is not None and self.input_file is not None:
         if EDUtilsPath.isEMBL() or EDUtilsPath.isALBA():
             options = '''-c xdsin {0} hklout {1}'''.format(
                 self.input_file, self.output_file)
         else:
             options = '''xdsin {0} hklout {1}'''.format(
                 self.input_file, self.output_file)
         self.setScriptCommandline(options)
         self.DEBUG('command line options set to {0}'.format(options))
     self.addListCommandExecution('setting symmetry-based')
     if self.dataInput.choose_spacegroup is not None:
         self.addListCommandExecution('choose spacegroup {0}'.format(
             self.dataInput.choose_spacegroup.value))
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG('*** EDPluginExecDIMPLEREFMACRigidBodyv10.preProcess')

        data = self.getDataInput()

        self._hklin = data.getHKLIN().getPath().getValue()
        self._xyzin = data.getXYZIN().getPath().getValue()
        self._xyzout = data.getXYZOUT().getPath().getValue()

        self._ColLabels_F = data.getColLabels().F.getValue()
        self._ColLabels_SIGF = data.getColLabels().SIGF.getValue()

        self.refmac_rigid_body_script()

        return
Example #48
0
 def __init__(self):
     """
     """
     EDPluginExecProcessScript.__init__(self)
     self.setXSDataInputClass(XSDataInputGnom)
     self.fAngularScale = 1
     self.npaExperimentalDataQ = None
     self.npaExperimentalDataI = None
     self.npaExperimentalDataStdDev = None
     self.npaFitDataQ = None
     self.npaFitDataI = None
     self.npaR = None
     self.npaPR = None
     self.npaPRerr = None
     self.fRadiusOfGir = None
     self.fFitQuality = None
Example #49
0
    def postProcess(self, _edObject = None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG('*** EDPluginExecDIMPLECADv10.postProcess')

        self.programTermination()

        xsDataResult = CCP4DataResultCAD(
            HKLOUT = HKL(self._hklout),
            returnStatus = CCP4ReturnStatus())
        self.setDataOutput(xsDataResult)

        if not os.path.isfile(self.getDataOutput().getHKLOUT().getPath().getValue()):
            raise RuntimeError, 'File %s does not exist' % self.getDataOutput().getHKLOUT().getPath().getValue() 
        
        
        return
Example #50
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        self.DEBUG("EDPluginXscale.preProcess")
        anomalous = self.dataInput.friedels_law.value
        merged = self.dataInput.merge.value
        self.hkl_file = 'merged' if merged else 'unmerged'
        if anomalous:
            self.hkl_file += '_anom_XSCALE.hkl'
        else:
            self.hkl_file += '_noanom_XSCALE.hkl'

        # create the input file for xscale
        with open(os.path.join(self.getWorkingDirectory(), 'XSCALE.INP'),
                  'w') as inputfile:
            inputfile.write("OUTPUT_FILE= {0}\n".format(self.hkl_file))
            inputfile.write(
                "MERGE= {0}\n".format("TRUE" if merged else "FALSE"))
            for xds_file in self.dataInput.xds_files:
                if self.dataInput.friedels_law.value and xds_file.path_noanom is not None:
                    path = os.path.abspath(xds_file.path_noanom.value)
                else:
                    path = os.path.abspath(xds_file.path_anom.value)
                # make a symlink so we do not hit the 50char limit
                sympath = os.path.abspath(
                    os.path.join(self.getWorkingDirectory(),
                                 os.path.basename(path)))
                os.symlink(path, sympath)

                res = xds_file.res.value
                # os.basename(sympath) is the filename relative to our dir
                inputfile.write("INPUT_FILE= {0} XDS_ASCII 100 {1}\n".format(
                    os.path.basename(sympath), res))

            ucellconstants = ' '.join(
                [str(x.value) for x in self.dataInput.unit_cell_constants])
            inputfile.write(
                "UNIT_CELL_CONSTANTS= {0}\n".format(ucellconstants))
            sg = self.dataInput.sg_number.value
            inputfile.write("SPACE_GROUP_NUMBER= {0}\n".format(sg))

            # include the RESOLUTION_SHELLS directive only if bins are
            # specified. Otherwise the whole data is used
            bins = self.dataInput.bins
            if bins is not None and len(bins) != 0:
                binstring = ' '.join(
                    [str(x.value) for x in self.dataInput.bins])
                inputfile.write("RESOLUTION_SHELLS= {0}\n".format(binstring))
Example #51
0
    def postProcess(self, _edObject=None):
        """
        """
        EDPluginExecProcessScript.postProcess(self)

        strError = self.readProcessErrorLogFile()
        if (strError is not None) and (strError != ""):
            errorMessage = EDMessage.ERROR_EXECUTION_03 % (
                'EDPluginBestv10.postProcess', 'EDPluginBestv10', strError)
            self.error(errorMessage)
            self.addErrorMessage(errorMessage)
            raise RuntimeError, errorMessage

        outputData = self.getOutputDataFromDNATableFile(
            os.path.join(self.getWorkingDirectory(),
                         self.getScriptBaseName() + "_dnaTables.xml"))
        self.setDataOutput(outputData)
Example #52
0
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     self.DEBUG("EDPluginSTACv2_0.preProcess")
     self.addListCommandPreExecution("export STACDIR=%s" %
                                     self.config.get("STACDIR"))
     if (self.__pyStrBCMDEF is None):
         self.__pyStrBCMDEF = self.config.get("BCMDEF")
     self.DEBUG("EDPluginSTACv2_0.preProcess: BCMDEF set to %s" %
                self.__pyStrBCMDEF)
     self.addListCommandPreExecution("export BCMDEF=%s" %
                                     self.__pyStrBCMDEF)
     self.addListCommandPreExecution("export RUNDIR=%s" %
                                     self.getWorkingDirectory())
     self.setScriptCommandline(
         "stac.core.STAC_DNA_listener %s -%s/ %s" %
         (self.getSTACcommand(), self.getWorkingDirectory(),
          self.getSTACparams()))
Example #53
0
    def __init__(self):
        """
        """
        EDPluginExecProcessScript.__init__(self)
        self.setXSDataInputClass(XSDataInputDammif)

        self.mode = 'fast'
        self.unit = 'ANGSTROM'
        self.symmetry = 'P1'
        self.particleShape = 'UNKNOWN'
        self.constant = ''
        self.chained = ''
        self.Rfactor = None
        self.sqrtChi = None
        self.volume = None
        self.Rg = None
        self.Dmax = None
Example #54
0
 def finallyProcess(self, _edObject=None):
     EDPluginExecProcessScript.finallyProcess(self)
     self.DEBUG("EDPluginExecMtz2Variousv1_0.finallyProcess")
     xsDataResult = self.getOutputDataFromDNATableFile("rdfit.xml")
     strScaleIntensityPlotPath = os.path.join(self.getWorkingDirectory(),
                                              self.strScaleIntensityPlot)
     if os.path.exists(strScaleIntensityPlotPath):
         xsDataResult.scaleIntensityPlot = XSDataFile(
             XSDataString(strScaleIntensityPlotPath))
     if os.path.exists(self.strBFactorPlot):
         xsDataResult.bFactorPlot = XSDataFile(
             XSDataString(self.strBFactorPlot))
     strHtmlPath = os.path.join(self.getWorkingDirectory(),
                                self.strHtmlPath)
     if os.path.exists(strHtmlPath):
         xsDataResult.htmlPage = XSDataFile(XSDataString(strHtmlPath))
     self.setDataOutput(xsDataResult)
Example #55
0
 def configure(self):
     EDPluginExecProcessScript.configure(self)
     self.DEBUG("EDPluginLabelitv1_1.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         self.warning("EDPluginLabelitv1_1.configure: No Labelit plugin item defined.")
         xsPluginItem = XSPluginItem()
     strPathToLabelitSetpathScript = EDConfiguration.getStringParamValue(xsPluginItem, \
                                                                         EDPluginLabelitv1_1.CONF_PATH_TO_LABELIT_SETPATH_SCRIPT)
     if(strPathToLabelitSetpathScript == None):
         strErrorMessage = "EDPluginLabelitv1_1.configure : Configuration parameter missing: " + \
                             EDPluginLabelitv1_1.CONF_PATH_TO_LABELIT_SETPATH_SCRIPT
         self.error(strErrorMessage)
         self.addErrorMessage(strErrorMessage)
         self.setFailure()
     else:
         self.setPathToLabelitSetpathScript(strPathToLabelitSetpathScript)
Example #56
0
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     self.DEBUG("EDPluginXOalignv1_0.preProcess")
     xsDataInputXOalign = self.dataInput
     if xsDataInputXOalign.omega is not None:
         self.fOmega = xsDataInputXOalign.omega.value
     if xsDataInputXOalign.kappa is not None:
         self.fKappa = xsDataInputXOalign.kappa.value
     if xsDataInputXOalign.phi is not None:
         self.fPhi = xsDataInputXOalign.phi.value
     # Create the MOSFLM mat file
     strMosflmMatFilePath = os.path.join(self.getWorkingDirectory(), "mosflm.mat")
     self.writeDataMOSFLMNewmat(self.dataInput.orientation, 
                                self.dataInput.cell, 
                                strMosflmMatFilePath)
     # Construct the command line
     self.setScriptCommandline(self.generateCommands(self.dataInput.symmetry.value, strMosflmMatFilePath))
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG("EDPluginExecDIMPLEPHASERv10.postProcess")

        data = self.getDataInput()

        self._hklin = data.getHKLIN().getPath().getValue()
        self._hklout = data.getHKLOUT().getPath().getValue()
        self._xyzin = data.getXYZIN().getPath().getValue()
        self._xyzout = data.getXYZOUT().getPath().getValue()

        self._ColLabels_F = data.getColLabels().F.getValue()
        self._ColLabels_SIGF = data.getColLabels().SIGF.getValue()

        self.phaser_script()

        return
Example #58
0
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecGnomv0_2.postProcess")
     # Create some output data
     self.parseGnomOutputFile()
     xsDataResult = XSDataResultGnom(
         radiusOfGyration=XSDataDouble(self.fRadiusOfGir),
         arrayErr=EDUtilsArray.arrayToXSData(self.npaPRerr),
         arrayPr=EDUtilsArray.arrayToXSData(self.npaPR),
         arrayR=EDUtilsArray.arrayToXSData(self.npaR),
         scatteringFitIArray=EDUtilsArray.arrayToXSData(self.npaFitDataI),
         scatteringFitQArray=EDUtilsArray.arrayToXSData(self.npaFitDataQ),
         output=XSDataFile(
             XSDataString(
                 os.path.join(self.getWorkingDirectory(), "gnom.out"))),
         fitQuality=XSDataDouble(self.fFitQuality))
     self.dataOutput = xsDataResult
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG("EDPluginExecSaxsAddMetadatav1_0.preProcess")
        self.strImage = self.getDataInput().getInputImage().getPath().getValue(
        )
        if not os.path.isfile(self.strImage):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess", self.strImage)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        if self.getDataInput().getKey() is not None:
            self.strKey = self.getDataInput().getKey().getValue()
        if self.getDataInput().getValue() is not None:
            self.strValue = self.getDataInput().getValue().getValue()

        self.generateEdfheaderaddkey2DCommands()
Example #60
0
    def preProcess(self):
        EDPluginExecProcessScript.preProcess(self)
        self.DEBUG('Aimless: preprocess')
        input_file = self.dataInput.input_file.value
        output_file = self.dataInput.output_file.value
        symdb = self.config.get('symdb_path')
        if symdb is None:
            self.ERROR('no symdb in configuration, aborting')
            self.setFailure()
            return

        # TODO: ask Max why he forces the version to 6.2.0
        options = 'HKLIN {0} HKLOUT {1} SYMINFO {2}'.format(
            input_file, output_file, symdb)
        self.setScriptCommandline(options)
        self.DEBUG('command line options set to {0}'.format(options))

        start_image = self.dataInput.start_image.value
        end_image = self.dataInput.end_image.value
        if self.dataInput.dataCollectionID is not None:
            projectName = self.dataInput.dataCollectionID.value
        else:
            projectName = "EDNA_proc"
        resolution = self.dataInput.res.value
        if resolution is None:
            resolution = 0
        anom = self.dataInput.anom.value

        self.addListCommandExecution('bins 15')
        self.addListCommandExecution('run 1 batch {0} to {1}'.format(
            start_image, end_image))
        self.addListCommandExecution(
            'name run 1 project {0} crystal DEFAULT dataset NATIVE'.format(
                projectName))
        self.addListCommandExecution('scales constant')
        self.addListCommandExecution('resolution 50 {0}'.format(resolution))
        self.addListCommandExecution('cycles 100')
        self.addListCommandExecution(
            'anomalous {0}'.format('ON' if anom else 'OFF'))
        self.addListCommandExecution('output MERGED UNMERGED')
        self.addListCommandExecution('END')

        self.DEBUG(self.getListCommandExecution())
        with open(self.dataInput.command_file.value, 'w') as command_file:
            command_file.write('\n'.join(self.getListCommandExecution()))