Exemplo n.º 1
0
    def postProcess(self, _edObject=None):
        """
        """
        EDPluginControl.postProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlKappaStrategyv2_0.postProcess...")

        xsDataResultBest = self.edPluginBest.getDataOutput()
        xsDataResultStrategy = None

        if(xsDataResultBest is not None):
            xsDataResultStrategy = self.edHandlerXSDataBest.getXSDataResultStrategy(xsDataResultBest, self.getDataInput("mxv1InputStrategy")[0].getExperimentalCondition(), self.xsDataSampleCopy)

        self.setDataOutput(xsDataResultStrategy)

        #possibleAlignments
        try:
            self.setDataOutput(self.edPluginAlignment.getDataOutput(), "possibleOrientations")
        except:
            EDVerbose.WARNING("Could not get the list of Possible orientations.")
Exemplo n.º 2
0
    def generateAbsCalcScript(self):
        EDVerbose.DEBUG("*** EDPluginExecGnomv0_1.generateGnomScript")
        self.setScriptCommandline("")

        commandList = ['1', '1', str(self.__iNumCompounds), '1']
        map(commandList.extend,
            [[tmp['formula'],
              str(tmp['fraction']),
              str(tmp['density'])] for tmp in self.__lCompounds])
        commandList.extend(
            [self.__tBuffer['formula'],
             str(self.__tBuffer['density'])])
        commandList.extend([
            self.__strEdge,
            str(self.__fTransAfterEdge),
            str(self.__fDiameterDisk), '1'
        ])

        self.addListCommandExecution('\n'.join(commandList))
 def preProcess(self, _edPlugin=None):
     """
     Prepares the execution plugin
     """
     EDPluginControl.preProcess(self, _edPlugin)
     EDVerbose.DEBUG("EDPluginControlImageQualityIndicatorsv1_1.preProcess...")
     # List containing instances of all the exeuction plugins
     self.listPluginExecImageQualityIndicator = []
     # Loop through all the incoming reference images
     self.edPluginWaitMultiFile = self.loadPlugin(self.strPluginExecWaitMultiFileName)
     listXSDataImage = self.getDataInput().getImage()
     xsDataInputWaitMultiFile = XSDataInputWaitMultiFile()
     for xsDataImage in listXSDataImage:
         xsDataInputWaitMultiFile.addExpectedFile(XSDataFile(xsDataImage.getPath()))
     xsDataInputWaitMultiFile.setExpectedSize(XSDataInteger(100000))
     xsDataInputWaitMultiFile.setTimeOut(XSDataTime(self.fWaitFileTimeOut))
     self.DEBUG("Wait file timeOut set to %f" % self.fWaitFileTimeOut)
     self.edPluginWaitMultiFile.setDataInput(xsDataInputWaitMultiFile)
     self.xsDataResultControlImageQualityIndicators = XSDataResultControlImageQualityIndicators()
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

        ################################################################################
        # Compare XSDataResults
        ################################################################################

        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResult.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                "XSDataResult output are the same",
                                _strExcluded="bioSaxs")
Exemplo n.º 5
0
    def doSuccess_MTZDUMP(self, _edPlugin=None):
        """
        This method is called after the MTZDUMPUnitCellSpaceGroup execution plugin has successfully processed, 
        it retrieves the results out of the execution plugin MTZDUMPUnitCellSpaceGroupv10 
        and sets the input for the second execution plugin EDPluginExecPDBSETUnitCellv10
        before running it. The two methods doSuccess_PDBSET and doFailure_PDBSET are also connected here.
        """
        EDVerbose.DEBUG("*** doSuccess_MTZDUMP")
        self.xsDataInput_inputUnitCell = self.edPluginMTZDUMP.getDataOutput(
        ).getUnitCell()
        self.xsDataInput_PDBSET = XSDataInputPDBSETUnitCell()
        self.xsDataInput_PDBSET.setUnitCell(self.xsDataInput_inputUnitCell)
        self.xsDataInput_PDBSET.setInputPDBFile(self.xsDataInput_inputPDBFile)

        self.edPluginPDBSET = self.loadPlugin('EDPluginExecPDBSETUnitCellv10')
        self.edPluginPDBSET.setDataInput(self.xsDataInput_PDBSET)
        self.edPluginPDBSET.connectSUCCESS(self.doSuccess_PDBSET)
        self.edPluginPDBSET.connectFAILURE(self.doFailure_PDBSET)
        self.edPluginPDBSET.executeSynchronous()
Exemplo n.º 6
0
    def configure(self):
        EDPluginControl.configure(self)
        EDVerbose.DEBUG("EDPluginControlKappaStrategyv2_0.configure")
        strSymopHome = self.config.get(self.strCONF_SYMOP_HOME)
        if strSymopHome is None:
            strWarningMessage = EDMessage.WARNING_NO_PARAM_CONFIGURATION_ITEM_FOUND_03 % ('EDPluginControlKappaStrategyv2_0.configure', self.strCONF_SYMOP_HOME, self.getPluginName())
            EDVerbose.warning(strWarningMessage)
            self.addWarningMessage(strWarningMessage)
        else:
            strSymopHomeNorm = os.path.normpath(strSymopHome)
            self.setSymopHome(strSymopHomeNorm)

        bKappaOn = self.config.get("KAPPA")
        if bKappaOn:
            #self.strPluginStrategyName = "EDPluginControlStrategyv10"
            #self.strPluginStrategyName = "EDPluginControlStrategyv2_0"
            self.KappaStrategy = 1
        else:
            self.KappaStrategy = 0
Exemplo n.º 7
0
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()
        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())

        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultSaxsAddMetadatav1_0.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                "XSDataResult output are the same")

        outputData = str(open(self.testOutput, "rb").read()[:8196])
        referenceData = str(open(self.refOutput, "rb").read()[:8196])
        EDAssert.strAlmostEqual(outputData, referenceData, "Same headers")
    def testExecute(self):
        """
        """
        self.run()

        # Checks that there are no error messages

        plugin = self.getPlugin()

        # Checks the expected result
        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
#        strObtainedOutput = plugin.getDataOutput().marshal() # EDUtilsTest.readAndParseFile ( self.m_edObtainedOutputDataFile )    
        EDVerbose.DEBUG("Checking obtained result...")


        xsDataResultReference = XSDataResultDiffractionCT.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()# XSDataResultDiffractionCT.parseString(strObtainedOutput)

        EDAssert.equal(xsDataResultReference.marshal(), xsDataResultObtained.marshal())
 def preProcess(self):
     """
     PreProcess of the execution test: download an EDF file from http://www.edna-site.org
     and remove any existing output file, i.e. /tmp/edna-$USER/stack.h5 
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage(["test_region1_dark_1_0040.edf"])
     strExpectedOutput = self.readAndParseFile(self.getDataInputFile())
     xsDataResultReference = XSDataInputHDF5StackImages.parseString(
         strExpectedOutput)
     self.outputFileName = xsDataResultReference.getHDF5File().getPath(
     ).getValue()
     EDVerbose.DEBUG(" Output file is %s" % self.outputFileName)
     if not os.path.isdir(os.path.dirname(self.outputFileName)):
         os.makedirs(os.path.dirname(self.outputFileName))
     if self.getClassName() in [
             "EDTestCasePluginExecuteHDF5StackImagesv10"
     ]:  #, "EDTestCasePluginExecuteHDF5StackImagesv10_array"]:
         self.removeDestination()
Exemplo n.º 10
0
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     EDVerbose.DEBUG("EDPluginExecSaxsAnglev1_0.preProcess")
     xsdIn = self.getDataInput()
     if xsdIn.getInputDataFile() is not None:
         self.inputDataFile = xsdIn.getInputDataFile().getPath().getValue()
         if not os.path.isfile(self.inputDataFile):
             EDVerbose.WARNING(
                 "Input file %s does not exist ... try to go on anyway" %
                 self.inputDataFile)
             self.inputDataFile = None
     if xsdIn.getRegroupedDataFile() is not None:
         self.regroupedDataFile = xsdIn.getRegroupedDataFile().getPath(
         ).getValue()
     if xsdIn.getBeamCenterX() is not None:
         self.beamCenterX = xsdIn.getBeamCenterX().getValue()
     if xsdIn.getBeamCenterY() is not None:
         self.beamCenterY = xsdIn.getBeamCenterY().getValue()
     if xsdIn.getInnerRadius() is not None:
         self.innerRadius = xsdIn.getInnerRadius().getValue()
     if xsdIn.getStepRadius() is not None:
         self.stepRadius = xsdIn.getStepRadius().getValue()
     if xsdIn.getSizeRadial() is not None:
         self.sizeRadial = xsdIn.getSizeRadial().getValue()
     if xsdIn.getStartAzimuth() is not None:
         self.startAzimuth = xsdIn.getStartAzimuth().getValue()
     if xsdIn.getStepAzimuth() is not None:
         self.stepAzimuth = xsdIn.getStepAzimuth().getValue()
     if xsdIn.getSizeAzimuth() is not None:
         self.sizeAzimuth = xsdIn.getSizeAzimuth().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()
     #Create the command line to run the program
     self.generateSaxsAngleCommand()
Exemplo n.º 11
0
 def doSuccessIntegration(self, _edPlugin=None):
     EDVerbose.DEBUG(
         "EDPluginControlCharacterisationv1_2.doSuccessIntegration")
     self.retrieveSuccessMessages(
         _edPlugin,
         "EDPluginControlCharacterisationv1_2.doSuccessIntegration")
     self.addStatusMessage("Integration successful.")
     xsDataIntegrationOutput = self.__edPluginControlIntegration.getDataOutput(
     )
     self.__xsDataResultCharacterisation.setIntegrationResult(
         xsDataIntegrationOutput)
     # Integration short summary
     if self.__edPluginControlIntegration.hasDataOutput(
             "integrationShortSummary"):
         self.__strCharacterisationShortSummary += self.__edPluginControlIntegration.getDataOutput(
             "integrationShortSummary")[0].getValue()
     #EDVerbose.DEBUG( self.__xsDataExperimentCharacterisation.marshal() )
     if self.__bDoStrategyCalculation:
         xsDataInputStrategy = XSDataInputStrategy()
         xsDataSolutionSelected = self.__xsDataResultCharacterisation.getIndexingResult(
         ).getSelectedSolution()
         xsDataInputStrategy.setCrystalRefined(
             xsDataSolutionSelected.getCrystal())
         xsDataInputStrategy.setSample(self.__xsDataResultCharacterisation.
                                       getDataCollection().getSample())
         xsDataIntegrationSubWedgeResultList = xsDataIntegrationOutput.getIntegrationSubWedgeResult(
         )
         xsDataInputStrategy.setBestFileContentDat(
             xsDataIntegrationSubWedgeResultList[0].getBestfileDat())
         xsDataInputStrategy.setBestFileContentPar(
             xsDataIntegrationSubWedgeResultList[0].getBestfilePar())
         xsDataInputStrategy.setExperimentalCondition(
             xsDataIntegrationSubWedgeResultList[0].
             getExperimentalConditionRefined())
         for xsDataIntegrationSubWedgeResult in xsDataIntegrationSubWedgeResultList:
             xsDataInputStrategy.addBestFileContentHKL(
                 xsDataIntegrationSubWedgeResult.getBestfileHKL())
         xsDataInputStrategy.setDiffractionPlan(
             self.__xsDataResultCharacterisation.getDataCollection(
             ).getDiffractionPlan())
         self.__edPluginControlStrategy.setDataInput(xsDataInputStrategy)
         self.__edPluginControlStrategy.executeSynchronous()
Exemplo n.º 12
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 _check_xyzin_monomers(self):
        '''Check that all of the monomers listed in the input PDB file
        occur in the CCP4 monomer dictionary.'''

        # first build up the database

        known_monomers = []

        monomer = os.path.join(os.environ['CCP4'], 'lib', 'data', 'monomers')

        for dirpath, dirnames, filenames in os.walk(monomer):
            for filename in filenames:
                known_monomers.append(filename.replace('.cif', ''))

        assert (known_monomers)

        # then check the pdb file

        unknown = []
        known = []

        for record in open(self._xyzin):

            if 'ATOM  ' in record[:6] or 'HETATM' in record[:6]:
                residue = record[17:20]

                if not residue in known_monomers:
                    if not residue in unknown:
                        unknown.append(residue)

                else:
                    if not residue in known:
                        known.append(residue)
                        EDVerbose.DEBUG("Known residue: %s" % residue)

        if unknown:
            unknown_residues = unknown[0]
            for m in unknown_residues[1:]:
                unknown_residues += ' %s' % m
            raise RuntimeError, 'Unknown residues: %s' % unknown_residues

        return
Exemplo n.º 14
0
    def preProcess(self, _edObject=None):
        EDPluginControl.preProcess(self)
        EDVerbose.DEBUG("EDPluginControlDevelopRawv1_0.preProcess")
        self.strRawFile = self.getDataInput().getInputRaw().getPath().getValue(
        )
        if self.getDataInput().getOutputJpeg() is None:
            self.strJpegFile = os.path.splitext(
                self.strRawFile)[0] + "-raw.jpg"
        else:
            self.strJpegFile = self.getDataInput().getOutputJpeg().getPath(
            ).getValue()

        if self.getDataInput().getCopyExifTag() is None:
            self.bCopyExif = True
        else:
            self.bCopyExif = (self.getDataInput().getCopyExifTag().getValue()
                              in [1, "true", "True", True])

        if self.getDataInput().getCompressRaw() is None:
            self.bCompressRaw = True
        else:
            self.bCompressRaw = (
                self.getDataInput().getCompressRaw().getValue()
                in [1, "true", "True", True])

        if self.getDataInput().getCleanUp() is None:
            self.bCleanUp = True
        else:
            self.bCleanUp = (self.getDataInput().getCleanUp().getValue()
                             in [1, "true", "True", True])

        # Load the execution plugin
        self.__edPluginExecDcraw = self.loadPlugin(
            self.__strControlledPluginDcraw)
        self.__edPluginExecThumbnail = self.loadPlugin(
            self.__strControlledPluginThumbnail)
        if self.bCompressRaw is True:
            self.__edPluginExecBzip2 = self.loadPlugin(
                self.__strControlledPluginBzip2)
        if self.bCopyExif is True:
            self.__edPluginExecMetadata = self.loadPlugin(
                self.__strControlledPluginMetadata)
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()
 ################################################################################
# Compare XSDataResults
################################################################################

        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
#        strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile)
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultBioSaxsMetadatav1_0.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same", _strExcluded="bioSaxs")

################################################################################
# Compare dictionary
################################################################################
        edfRef = fabio.open(xsDataResultObtained.getOutputImage().getPath().value)
        edfObt = fabio.open(os.path.join(self.getTestsDataImagesHome(), "bioSaxsMetadata.edf"))
        keysRef = edfRef.header_keys
        keysObt = edfObt.header_keys
        keysRef.sort()
        keysObt.sort()

        for key in ["HeaderID", "Image", 'EDF_BinarySize', "EDF_DataBlockID", "EDF_HeaderSize", "filename", "RasterOrientation" ]:
            if key in keysObt: keysObt.remove(key)
            if key in keysRef: keysRef.remove(key)
#        print edfObt.header
        EDAssert.equal(keysRef, keysObt, _strComment="Same keys in the header dictionary")
        for key in keysRef:
            EDAssert.strAlmostEqual(edfRef.header[key], edfObt.header[key], _strComment="header value %s are the same" % key, _strExcluded="bioSaxs")


################################################################################
# Compare images 
################################################################################

        outputData = edfObt.data
        referenceData = edfRef.data
        EDAssert.arraySimilar(outputData, referenceData , _fAbsMaxDelta=0.1, _fScaledMaxDelta=0.05, _strComment="Images-data are the same")
 def preProcess(self):
     """
     PreProcess of the execution test: download an EDF file from http://www.edna-site.org
     and remove any existing output file, i.e. /tmp/edna-$USER/stack.h5 
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage([
         "projections5077.edf", "projections5078.edf",
         "projections5204.edf", "projections5203.edf"
     ])
     strExpectedOutput = self.readAndParseFile(self.getDataInputFile())
     xsDataResultReference = XSDataInputHDF5MapSpectra.parseString(
         strExpectedOutput)
     self.outputFileName = xsDataResultReference.getHDF5File().getPath(
     ).getValue()
     EDVerbose.DEBUG(" Output file is %s" % self.outputFileName)
     if not os.path.isdir(os.path.dirname(self.outputFileName)):
         os.makedirs(os.path.dirname(self.outputFileName))
     if self.getClassName() == "EDTestCasePluginExecuteHDF5MapSpectrav10":
         self.removeDestination()
Exemplo n.º 17
0
    def preProcess(self):
        """
        PreProcess of the execution test: download a set of images  from http://www.edna-site.org
        and delete any output file
        """
        EDTestCasePluginExecute.preProcess(self)

        xsDataInput = XSDataInputMatrixInvertFile.parseString(self.readAndParseFile(self.getDataInputFile()))
        self.inputFile = xsDataInput.getInputMatrixFile().getPath().getValue()

        self.xsDataResultReference = XSDataResultMatrixInvertFile.parseString(self.readAndParseFile(self.getReferenceDataOutputFile()))
        self.outputFile = self.xsDataResultReference.getOutputMatrixFile().getPath().getValue()

        self.loadTestImage([os.path.basename(self.inputFile), os.path.basename(self.outputFile) ])

        if not os.path.isdir(os.path.dirname(self.outputFile)):
            os.makedirs(os.path.dirname(self.outputFile))
        if os.path.isfile(self.outputFile):
            EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.outputFile)
            os.remove(self.outputFile)
Exemplo n.º 18
0
    def executeOrientation(self, _edPlugin):
        """
        """
        EDVerbose.DEBUG(
            "EDPluginControlKappaReorientationStrategyv2_0.executeOrientation")

        xsDataBestInput = self.edHandlerXSDataBest.getXSDataInputBest(
            self.getDataInput("mxv1InputStrategy")[0])
        self.edPluginOrientation.setDataInput(xsDataBestInput, "inputBest")
        self.edPluginOrientation.setDataInput(
            self.getDataInput("mxv2DataCollection")[0], "dataCollection")
        self.edPluginOrientation.setDataInput(
            self.getDataInput("mxv1IndexingResult")[0], "indexingResult")
        listOpt = self.getDataInput("mxv1InputStrategy")[0].getDiffractionPlan(
        ).getKappaStrategyOption()
        for strOpt in listOpt:
            self.edPluginOrientation.setDataInput(strOpt,
                                                  "KappaStrategyOption")

        self.edPluginOrientation.executeSynchronous()
Exemplo n.º 19
0
    def process(self, _edObject=None):
        """
        """
        EDPluginControl.process(self, _edObject)
        EDVerbose.DEBUG(
            "EDPluginControlKappaReorientationStrategyv2_0.process...")

        #call KAPPA orientation
        if self.edPluginOrientation is not None:
            self.connectProcess(self.executeOrientation)
            self.edPluginOrientation.connectFAILURE(
                self.doFailureActionOrientation)

        if self.edPluginAlignment is not None:
            self.connectProcess(self.doOrientationToAlignmentTransition)
            self.edPluginAlignment.connectFAILURE(
                self.doFailureActionAlignment)

        if self.edPluginSimpleStrategy is not None:
            self.connectProcess(self.doAlignmentToStrategyTransition)
Exemplo n.º 20
0
    def configure(self):
        EDPluginControl.configure(self)
        EDVerbose.DEBUG("EDPluginControlCharacterisationv2_0.configure")
        pluginConfiguration = self.getConfiguration()

        self.strPluginStrategyName = "EDPluginControlKappaStrategyv2_0"
        if(pluginConfiguration != None):
            strSymopHome = EDConfiguration.getStringParamValue(pluginConfiguration, "KAPPA")
#            if(strSymopHome == None or strSymopHome != "ON"):
#                #self.strPluginStrategyName = "EDPluginControlStrategyv10"
#                #self.strPluginStrategyName = "EDPluginControlStrategyv2_0"
#                self.strPluginStrategyName = "EDPluginControlKappaStrategyv2_0"
#            else:
#                self.strPluginStrategyName = "EDPluginControlKappaStrategyv2_0"

            strSymopHome = EDConfiguration.getStringParamValue(pluginConfiguration, "POINTLESS")
            if(strSymopHome == None or strSymopHome != "ON"):
                self.strPluginIntegrationName = "EDPluginControlIntegrationv10"
            else:
                self.strPluginIntegrationName = "EDPluginControlIntegrationPointlessv10"
Exemplo n.º 21
0
    def postProcess(self, _edObject=None):
        EDPluginControl.postProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlStrategyv1_2.postProcess...")

        #
        # Create the BEST graphs from the plot mtv file
        #
        # Check if we have GLE files from BEST:
        xsDataResultBest = self._edPluginBest.getDataOutput()
        xsDataInputPlotGle = XSDataInputPlotGle()
        if xsDataResultBest.glePlot != []:
            for xsDataBestGlePlot in xsDataResultBest.glePlot:
                xsDataGlePlot = XSDataGlePlot()
                xsDataGlePlot.script = xsDataBestGlePlot.script
                xsDataGlePlot.data = xsDataBestGlePlot.data
                xsDataInputPlotGle.addGlePlot(xsDataGlePlot)
        else:
            xsDataInputPlotGle.filePlotMtv = xsDataResultBest.pathToPlotMtvFile
        self._edPluginPlotGle.dataInput = xsDataInputPlotGle
        self._edPluginPlotGle.executeSynchronous()
Exemplo n.º 22
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("*** EDPluginFIT2DCakev1_1.postProcess")
        #Remove the temporary data file
        os.remove(os.path.join(self.getWorkingDirectory(), "CleanedImage.edf"))
        os.remove(os.path.join(self.getWorkingDirectory(), "spline"))
        # Create the output data
        xsDataResultFIT2DCake = XSDataResultFIT2DCake()
        if (self.m_strOutputFilePath is not None):
            if os.path.splitext(self.m_strOutputFilePath)[1].lower() == ".cif" :
############read CHI plot file and convert it in cif cile if needed
                cif = CIFfile.CIF()
                cif.loadCHIPLOT(os.path.splitext(self.m_strOutputFilePath)[0] + ".chi")
                cif["_diffrn_radiation_wavelength"] = str(self.getDataInput().getWavelength().getValue())
                cif["_pd_instr_dist_spec/detc"] = str(self.getDataInput().getSampleToDetectorDistance().getValue())
                cif.saveCIF(self.m_strOutputFilePath)
            xsDataFile = XSDataFile()
            xsDataFile.setPath(XSDataString(self.m_strOutputFilePath))
            xsDataResultFIT2DCake.setResultFile(xsDataFile)
        self.setDataOutput(xsDataResultFIT2DCake)
Exemplo n.º 23
0
 def doSuccessIndexingLabelit(self, _edPlugin=None):
     EDVerbose.DEBUG(
         "EDPluginControlCharacterisationv1_2.doSuccessIndexingLabelit")
     self.retrieveSuccessMessages(
         _edPlugin,
         "EDPluginControlCharacterisationv1_2.doSuccessIndexingLabelit")
     if self.__edPluginControlIndexingLabelit.hasDataOutput(
             "indexingShortSummary"):
         self.__strCharacterisationShortSummary += self.__edPluginControlIndexingLabelit.getDataOutput(
             "indexingShortSummary")[0].getValue()
     # Check the indexing results
     xsDataIndexingResult = self.__edPluginControlIndexingLabelit.getDataOutput(
     )
     self.__edPluginExecEvaluationIndexingLABELIT.setDataInput(
         xsDataIndexingResult, "indexingResult")
     xsDataImageQualityIndicators = self.__xsDataResultCharacterisation.getImageQualityIndicators(
     )[0]
     self.__edPluginExecEvaluationIndexingLABELIT.setDataInput(
         xsDataImageQualityIndicators, "imageQualityIndicators")
     self.__edPluginExecEvaluationIndexingLABELIT.executeSynchronous()
Exemplo n.º 24
0
    def doRaddoseToBestTransition(self, _edPlugin):
        """
        """
        EDVerbose.DEBUG("EDPluginControlKappaStrategyv2_0.doRaddoseToBestTransition")
        self.retrieveSuccessMessages(_edPlugin, "EDPluginControlKappaStrategyv2_0.doRaddoseToBestTransition")

        xsDataRaddoseOutput = self.edPluginRaddose.getDataOutput()

        # update the strategy data with the data coming from Raddose
        self.xsDataSampleCopy.setAbsorbedDoseRate(xsDataRaddoseOutput.getAbsorbedDoseRate())

        # Call the Best Translator layer

        xsDataInputStrategyCopy = XSDataInputStrategy.parseString(self.getDataInput("mxv1InputStrategy")[0].marshal())
        xsDataInputStrategyCopy.setSample(self.xsDataSampleCopy)

        xsDataInputBest = self.edHandlerXSDataBest.getXSDataInputBest(xsDataInputStrategyCopy)

        self.edPluginBest.setDataInput(xsDataInputBest)
        self.edPluginBest.executeSynchronous()
Exemplo n.º 25
0
    def preProcess(self):
        """
        Processes the command line, creates the plugins
        """
        EDApplication.preProcess(self)
        EDVerbose.DEBUG("EDApplicationMXv1Characterisation.preProcess")

        if self.__xsDataInputCharacterisation == None:
            # Read command line parameters and check if they are ok
            self.__bProcess = self.readAndProcessCommandLine()

            if (self.__bProcess) and not (self.__strDatasetFileName is None):
                # Check if XML data is given as input :
                if (self.__strDatasetFileName is not None):
                    try:
                        self.__xsDataInputCharacterisation = XSDataInputCharacterisation.parseFile(self.__strDatasetFileName)
                    except:
                        errorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % ("EDApplicationMXv1Characterisation.process", self.__strDatasetFileName)
                        EDVerbose.error(errorMessage)
                        raise RuntimeError, errorMessage
    def testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()

        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultSiftDescriptor.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(
            xsDataResultReference.marshal(),
            xsDataResultObtained.marshal(),
            _strExcluded="EDTestCasePluginExecuteExecSiftDescriptorv1_0",
            _fRelError=0.0,
            _fAbsError=0.3,
            _strComment="XML out are the same")
Exemplo n.º 27
0
 def loadPlugin(self, _strPluginToBeControlledName=None, _strBaseName=None):
     """
     This method loads and returns a reference to the plugin to be controlled.
     
     The name of the plugin to be controlled can either be passed as an
     argument, or bet set before calling this method using the 
     "setPluginToBeControlledName". 
     
     The base name of the plugin to be controlled is used as the working
     directory name of the plugin in question. If no argument is supplied
     the name of the plugin is used as base name. In the case of creation of
     several plugins to be launched simultaneously, the base name should be
     different for each plugin and hence must be provided explicitly.
     """
     EDVerbose.DEBUG("EDPluginControl.loadPlugin")
     if (_strPluginToBeControlledName is None):
         strPluginName = self.__strPluginToBeControlledName
     else:
         strPluginName = _strPluginToBeControlledName
     edPlugin = EDFactoryPluginStatic.loadPlugin(strPluginName)
     if (edPlugin is None):
         strErrorMessage = "EDPluginControl.loadPlugin : Cannot load plugin %s" % strPluginName
         EDVerbose.error(strErrorMessage)
         self.addErrorMessage(strErrorMessage)
         raise RuntimeError, strErrorMessage
     else:
         self.__listOfLoadedPlugins.append(edPlugin)
     edPlugin.setBaseDirectory(self.getWorkingDirectory())
     if (_strBaseName is None):
         # Check if base name exists. OBS! Not thread safe so please set explicitly
         # _strBaseName for multi-threaded code
         strRenamedPlugin = self.compactPluginName(strPluginName)
         strNewWorkingDirectory = os.path.join(self.getWorkingDirectory(),
                                               strRenamedPlugin)
         if (os.path.exists(strNewWorkingDirectory)):
             edPlugin.setBaseName(edPlugin.createBaseName())
         else:
             edPlugin.setBaseName(strRenamedPlugin)
     else:
         edPlugin.setBaseName(_strBaseName)
     return edPlugin
Exemplo n.º 28
0
    def doAlignmentToStrategyTransition(self, _edPlugin):
        """
        """
        EDVerbose.DEBUG(
            "EDPluginControlKappaStrategyv2_0.doAlignmentToStrategy")
        #self.retrieveSuccessMessages( _edPlugin, "EDPluginControlStrategyv01.doRaddoseToBestTransition" )

        # Call the Best Translator layer
        #from XSDataSTACv01 import kappa_alignment_response
        #from XSDataSTACv01 import kappa_strategy_request
        #from XSDataSTACv01 import strategy_request

        self.xsKappaStrategyRequest = kappa_strategy_request()
        #self.xsKappaStrategyRequest.build(???)

        KappaAlignmentResponse = self.edPluginAlignment.getDataOutput()
        xsDataKappaAlignmentList = KappaAlignmentResponse.getPossible_orientation(
        )
        self.xsKappaStrategyRequest.setDesired_datum(xsDataKappaAlignmentList)

        self.xsksreq = strategy_request()
        self.xsKappaStrategyRequest.setStandard_request(self.xsksreq)

        #xsDataKappaStrategyInput=EDList()
        #xsDataKappaStrategyInput.add(self.xsKappaStrategyRequest)
        ##data collection descriptor
        #xsDataKappaStrategyInput.add(self.getDataInput("mxv2DataCollection")[0])
        ##indexing result
        #xsDataKappaStrategyInput.add(self.getDataInput("mxv1IndexingResult")[0])
        ##bestfile
        #xsDataKappaStrategyInput.add(self.getDataInput("mxv1InputStrategy")[0])
        #self.edPluginKappaStrategy.setDataInput( xsDataKappaStrategyInput )
        self.edPluginKappaStrategy.setDataInput(self.xsKappaStrategyRequest,
                                                "kappa_strategy_request")
        self.edPluginKappaStrategy.setDataInput(
            self.getDataInput("mxv2DataCollection")[0], "dataCollection")
        self.edPluginKappaStrategy.setDataInput(
            self.getDataInput("mxv1InputStrategy")[0], "inputBest")

        #self.edPluginKappaStrategy.m_xsDataBestFileContentPar=self.getDataInput()[0].getBestFileContentPar()
        self.edPluginKappaStrategy.executeSynchronous()
Exemplo n.º 29
0
    def preProcess(self, _edObject=None):
        """
        Loads the ISPyB execution plugin and prepares the input data
        """
        EDPluginControl.preProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlISPyBv1_1.preProcess...")

        if (self.hasDataInput("shortComments")):
            self.__strShortComments = self.getDataInput(
                "shortComments")[0].getValue()
        if (self.hasDataInput("comments")):
            self.__strComments = self.getDataInput("comments")[0].getValue()
        if (self.hasDataInput("statusMessage")):
            self.__strStatusMessage = self.getDataInput(
                "statusMessage")[0].getValue()

        self.m_edPluginExecISPyB = self.loadPlugin(
            self.m_edStringPluginExecISPyBName)
        from EDHandlerXSDataISPyBv1_2 import EDHandlerXSDataISPyBv1_2
        xsDataInputISPyB = None
        xsDataISPyBImage = None
        try:
            xsDataISPyBScreening = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBScreening(
                self.getDataInput(), self.__strShortComments,
                self.__strComments)
            xsDataISPyBScreeningInput = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBScreeningInput(
                self.getDataInput())
            xsDataISPyBScreeningOutputContainer = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBScreeningOutputContainer(
                self.getDataInput(), self.__strStatusMessage)
            if (xsDataISPyBScreening.getDataCollectionId() is None):
                xsDataISPyBImage = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBImage(
                    self.getDataInput())

        except Exception, error:
            # This exception handling needs to be rethought, see bug #43.
            errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % (
                "EDPluginControlISPyBv1_1.preProcess: Unexpected error in ISPyB handler: ",
                error)
            EDVerbose.error(errorMessage)
            self.addErrorMessage(errorMessage)
            raise RuntimeError, errorMessage
 def preProcess(self):
     """
     PreProcess of the execution test: download a set of images  from http://www.edna-site.org
     and remove any existing output file 
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage(
         ["bioSaxsMask.edf"] +
         ["bioSaxs_bsa_013_%02i.edf" % i for i in range(1, 11)])
     strExpectedOutput = self.readAndParseFile(
         self.getReferenceDataOutputFile())
     EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput)
     workdir = os.path.join(tempfile.gettempdir(),
                            "edna-%s" % os.environ["USER"], "serie1")
     if os.path.exists(workdir):
         for dirpath, dirnames, filenames in os.walk(workdir,
                                                     topdown=False):
             for oneFile in filenames:
                 os.remove(os.path.join(workdir, dirpath, oneFile))
             for oneDir in dirnames:
                 os.rmdir(os.path.join(workdir, dirpath, oneDir))