def preProcess(self, _edPlugin=None):
        """
        This method prepares the input for the CCP4i plugin and loads it.
        """
        EDPluginControl.preProcess(self, _edPlugin)
        EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.preProcess...")

        EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1")
        from XSDataCCP4iv1_1 import XSDataInputCCP4i
        xsDataInputCCP4i = XSDataInputCCP4i()
        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputCCP4i.setDataSet(xsDataInputMXCuBE.getDataSet())
        #xsDataInputCCP4i.setDataFile( xsDataInputMXCuBE.getDataFile() )
        xsDataInputCCP4i.setExperimentalCondition(xsDataInputMXCuBE.getExperimentalCondition())
        xsDataInputCCP4i.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputCCP4i.setSample(xsDataInputMXCuBE.getSample())

        self.__edPluginControlCCP4i = self.loadPlugin(self.__strPluginControlCCP4i, "CCP4i")
        self.__edPluginControlCCP4i.setDataInput(xsDataInputCCP4i)

        self.__xsDataIntegerDataCollectionId = xsDataInputMXCuBE.getDataCollectionId()
        if (self.__xsDataIntegerDataCollectionId is not None):
            self.__edPluginControlISPyB = self.loadPlugin(self.__strPluginControlISPyB, "ISPyB")

        self.__edPluginExecOutputHTML = self.loadPlugin(self.__strPluginExecOutputHTMLName, "OutputHTML")
    def generateXSDataISPyBScreening(_xsDataInputControlISPyB,
                                     _strShortComments=None,
                                     _strComments=None):
        """
        """
        EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2")
        from XSDataISPyBv1_2 import XSDataString
        from XSDataISPyBv1_2 import XSDataISPyBScreening

        xsDataIntegerDataCollectionId = _xsDataInputControlISPyB.getDataCollectionId(
        )

        # General information
        xsDataISPyBScreening = XSDataISPyBScreening()
        xsDataISPyBScreening.setProgramVersion(XSDataString("EDNA MXv1"))
        pyStrTimeStamp = time.strftime("%Y-%m-%d %H:%M:%S")
        xsDataISPyBScreening.setTimeStamp(XSDataString(pyStrTimeStamp))
        if (not _strShortComments is None):
            xsDataISPyBScreening.setShortComments(
                XSDataString(_strShortComments))
        if (not _strComments is None):
            xsDataISPyBScreening.setComments(XSDataString(_strComments))

        # Use dataCollectionId if provided in the input
        if (xsDataIntegerDataCollectionId is not None):
            xsDataISPyBScreening.setDataCollectionId(
                xsDataIntegerDataCollectionId)

        return xsDataISPyBScreening
Esempio n. 3
0
 def testGenerateXSDataInputISPyB(self):
     """
     This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object.
     """
     strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(
         self.strDataPath, "XSDataInputControlISPyB_reference.xml")
     strPath = os.path.join(self.strDataPath,
                            strReferenceInputControlISPyBFile)
     strXMLIndexingInput = self.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataInputControlISPyB
     xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(
         strXMLIndexingInput)
     from EDHandlerXSDataISPyBv1_1 import EDHandlerXSDataISPyBv1_1
     xsDataInputISPyB = EDHandlerXSDataISPyBv1_1.generateXSDataInputISPyB(
         xsDataInputControlISPyB)
     strReferenceInputISPyBFile = EDUtilsPath.mergePath(
         self.strDataPath, "XSDataInputISPyB_reference.xml")
     strReferencePath = os.path.join(self.strDataPath,
                                     strReferenceInputISPyBFile)
     strXMLInputISPyBReference = self.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataISPyBv1_1")
     from XSDataISPyBv1_1 import XSDataInputISPyB
     xsDataInputISPyBReference = XSDataInputISPyB.parseString(
         strXMLInputISPyBReference)
     # Remove the time strings since they otherwise make the test fail
     xsDataInputISPyBReference.getScreening().setTimeStamp(None)
     xsDataInputISPyB.getScreening().setTimeStamp(None)
     EDAssert.equal(xsDataInputISPyBReference.marshal(),
                    xsDataInputISPyB.marshal())
Esempio n. 4
0
    def writeKappaSettings(self):
        '''
        # future version for getting motor positions related to images under processing
        # checking in order:
        # - value got as input
        # - mosflm.descr file in process subdir (if BCM (like mxcube) registered it)
        # - {imageTemplate}_kappa_settings.xml file (if BCM (like DNA) registered it)
        # - read it now (and try to register as {imageTemplate}_kappa_settings.xml)
        # - just use the datum (0,0,0)
        '''

        #code for using a predefined datum (0;0;0)
        #EDUtilsFile.writeFile( EDDiskExplorer.mergePath( self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings" ), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>0.000000</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>")

        # gonio settings from DC descriptor object
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        #import XSDataMXv2
        #dc = XSDataMXv2.XSDataCollection()
        from XSDataMXv2 import XSDataCollection
        dc = XSDataCollection()
        dc = self.getDataInput("dataCollection")[0]
        omega = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting(
        ).getBaseaxissetting()
        [kappa, phi] = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting(
        ).getAxissetting()
        EDUtilsFile.writeFile(
            os.path.join(self.getWorkingDirectory(),
                         "DNA_STAC_Kappa_Settings"),
            "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>"
            % (omega.getValue(), kappa.getValue(), phi.getValue()))
        '''
Esempio n. 5
0
 def testGenerateXSDataInputBestv1_2(
         self, _strFileNameXSDataInputStrategy_reference,
         _strFileNameXSDataInputBest_reference):
     """
     This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object.
     """
     strReferenceInputFile = os.path.join(
         self.strDataPath, _strFileNameXSDataInputStrategy_reference)
     strPath = os.path.join(self.strDataPath, strReferenceInputFile)
     from XSDataMXv1 import XSDataInputStrategy
     xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath)
     from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2
     edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2()
     xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest(
         xsDataInputStrategy)
     strReferencePath = os.path.join(self.strDataPath,
                                     _strFileNameXSDataInputBest_reference)
     strXMLInputBestReference = EDUtilsTest.readAndParseFile(
         strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataBestv1_2")
     from XSDataBestv1_2 import XSDataInputBest
     xsDataInputBestReference = XSDataInputBest.parseString(
         strXMLInputBestReference)
     EDAssert.equal(xsDataInputBestReference.marshal(),
                    xsDataInputBestv1_2.marshal())
    def generateXSDataISPyBImage(_xsDataInputControlISPyB):
        """
        """
        EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2")
        from XSDataISPyBv1_2 import XSDataString
        from XSDataISPyBv1_2 import XSDataISPyBImage
        xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult(
        )

        xsDataISPyBImage = None
        # Find path to first image from data collection information
        strPathToFirstImage = None
        xsDataCollection = xsDataResultCharacterisation.getDataCollection()
        if (xsDataCollection is not None):
            lXSDataSubWedge = xsDataCollection.getSubWedge()
            if (lXSDataSubWedge is not None):
                xsDataSubWedgeFirst = lXSDataSubWedge[0]
                lXSDataImage = xsDataSubWedgeFirst.getImage()
                if (lXSDataImage is not None):
                    xsDataImageFirst = lXSDataImage[0]
                    strPathToFirstImage = xsDataImageFirst.getPath().getValue()

            # Add an image path if the dataCollectionId is not present...
            if (strPathToFirstImage is not None):
                xsDataISPyBImage = XSDataISPyBImage()
                strImageBaseName = EDUtilsFile.getBaseName(strPathToFirstImage)
                strDirectoryName = EDUtilsPath.getFolderName(
                    strPathToFirstImage)
                xsDataISPyBImage.setFileName(XSDataString(strImageBaseName))
                xsDataISPyBImage.setFileLocation(
                    XSDataString(strDirectoryName))
        return xsDataISPyBImage
    def generateXSDataISPyBScreeningInput(_xsDataInputControlISPyB):
        """
        """
        EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2")
        from XSDataISPyBv1_2 import XSDataISPyBScreeningInput
        from XSDataISPyBv1_2 import XSDataDouble

        xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult(
        )
        xsDataISPyBScreeningInput = XSDataISPyBScreeningInput()

        # Data collection information
        xsDataCollection = xsDataResultCharacterisation.getDataCollection()
        if (xsDataCollection is not None):
            xsDataSubWedgeList = xsDataCollection.getSubWedge()
            if (xsDataSubWedgeList is not None):
                xsDataSubWedgeFirst = xsDataSubWedgeList[0]
                xsDataExperimentalCondition = xsDataSubWedgeFirst.getExperimentalCondition(
                )
                if (xsDataExperimentalCondition is not None):
                    xsDataDetector = xsDataExperimentalCondition.getDetector()
                    if (xsDataDetector is not None):
                        fBeamPositionX = xsDataDetector.getBeamPositionX(
                        ).getValue()
                        fBeamPositionY = xsDataDetector.getBeamPositionY(
                        ).getValue()
                        xsDataISPyBScreeningInput.setBeamX(
                            XSDataDouble(fBeamPositionX))
                        xsDataISPyBScreeningInput.setBeamY(
                            XSDataDouble(fBeamPositionY))

        return xsDataISPyBScreeningInput
    def mergeAtomicComposition(self, _xsDataAtomicComposition1, _xsDataAtomicComposition2):

        EDFactoryPluginStatic.loadModule("XSDataRaddosev10")

        mergedAtomicComposition = XSDataAtomicComposition()
        dictionary = {}

        for atom in _xsDataAtomicComposition2.getAtom():
            dictionary[atom.getSymbol().getValue()] = atom.getNumberOf().getValue()

        for atom1 in _xsDataAtomicComposition1.getAtom():
            symbol = atom1.getSymbol().getValue()
            if (self.exists(symbol, _xsDataAtomicComposition2) == True):
                mergedAtom = XSDataAtom()
                mergedAtom.setNumberOf(XSDataDouble(atom1.getNumberOf().getValue() + dictionary[symbol]))
                mergedAtom.setSymbol(XSDataString(symbol))
                mergedAtomicComposition.addAtom(mergedAtom)
            else:
                mergedAtomicComposition.addAtom(atom1)

        for atom2 in _xsDataAtomicComposition2.getAtom():
            symbol = atom2.getSymbol().getValue()
            if (self.exists(symbol, _xsDataAtomicComposition1) == False):
                mergedAtomicComposition.addAtom(atom2)

        return mergedAtomicComposition
    def __init__ (self):
        """
        """
        EDPluginControl.__init__(self)
        #self.setXSDataInputClass( XSDataInputCharacterisation )
        #self.setXSDataInputClass(EDList)
        #self.strPluginIndexingName = "EDPluginControlIndexingv2_0"
        self.strPluginIndexingName = "EDPluginControlIndexingv10"
        self.edPluginIndexing = None
        self.strPluginIntegrationName = "EDPluginControlIntegrationv10"
        self.edPluginIntegration = None
        self.strPluginStrategyName = "EDPluginControlKappaStrategyv2_0"
        self.edPluginStrategy = None
        self.xsDataResultCharacterisationv2_0 = None
        self.xsDataResultCharacterisation = None
        self.xsDataInputStrategy = None

        self.setXSDataInputClass(XSDataInputCharacterisationv2_0)
        
        EDFactoryPluginStatic.loadModule("XSDataMXv1")
        import XSDataMXv1
        self.setXSDataInputClass(XSDataMXv1.XSDataInputCharacterisation, "mxv1InputCharacterisation")
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        import XSDataMXv2
        self.setXSDataInputClass(XSDataMXv2.XSDataCollection, "mxv2DataCollection")
Esempio n. 10
0
    def writeKappaSettings(self):
        '''
        # future version for getting motor positions related to images under processing
        # checking in order:
        # - value got as input
        # - mosflm.descr file in process subdir (if BCM (like mxcube) registered it)
        # - {imageTemplate}_kappa_settings.xml file (if BCM (like DNA) registered it)
        # - read it now (and try to register as {imageTemplate}_kappa_settings.xml)
        # - just use the datum (0,0,0)
        '''

        #code for using a predefined datum (0;0;0)
        #EDUtilsFile.writeFile( EDDiskExplorer.mergePath( self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings" ), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>0.000000</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>")

        # gonio settings from DC descriptor object
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        #import XSDataMXv2
        #dc = XSDataMXv2.XSDataCollection()
        from XSDataMXv2 import XSDataCollection
        dc = XSDataCollection()
        dc = self.getDataInput("dataCollection")[0]
        omega = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting().getBaseaxissetting()
        [kappa, phi] = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting().getAxissetting()
        EDUtilsFile.writeFile(os.path.join(self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings"), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>" % (omega.getValue(), kappa.getValue(), phi.getValue()))

        '''
    def generateXSDataISPyBImage(_xsDataInputControlISPyB):
        """
        """
        EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2")
        from XSDataISPyBv1_2 import XSDataString
        from XSDataISPyBv1_2 import XSDataISPyBImage
        xsDataResultCharacterisationv2_0 = _xsDataInputControlISPyB.getCharacterisationResult()
        xsDataResultCharacterisation = xsDataResultCharacterisationv2_0.getMxv1ResultCharacterisation()

        xsDataISPyBImage = None
        # Find path to first image from data collection information
        strPathToFirstImage = None
        xsDataCollection = xsDataResultCharacterisation.getDataCollection()
        if (xsDataCollection is not None):
            lXSDataSubWedge = xsDataCollection.getSubWedge()
            if (lXSDataSubWedge is not None):
                xsDataSubWedgeFirst = lXSDataSubWedge[0]
                lXSDataImage = xsDataSubWedgeFirst.getImage()
                if (lXSDataImage is not None):
                    xsDataImageFirst = lXSDataImage[ 0 ]
                    strPathToFirstImage = xsDataImageFirst.getPath().getValue()

            # Add an image path if the dataCollectionId is not present...
            if (strPathToFirstImage is not None):
                xsDataISPyBImage = XSDataISPyBImage()
                strImageBaseName = EDUtilsFile.getBaseName(strPathToFirstImage)
                strDirectoryName = EDUtilsPath.getFolderName(strPathToFirstImage)
                xsDataISPyBImage.setFileName(XSDataString(strImageBaseName))
                xsDataISPyBImage.setFileLocation(XSDataString(strDirectoryName))
        return xsDataISPyBImage
    def generateXSDataISPyBScreeningInput(_xsDataInputControlISPyB):
        """
        """
        EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2")
        from XSDataISPyBv1_2 import XSDataISPyBScreeningInput
        from XSDataISPyBv1_2 import XSDataDouble

        xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult()
        xsDataISPyBScreeningInput = XSDataISPyBScreeningInput()

        xsDataCollection = EDHandlerXSDataISPyBv2_0.getDataCollectionFromSuggestedStrategy(xsDataResultCharacterisation)

        # Data collection information
        if (xsDataCollection is not None):
            xsDataSubWedgeList = xsDataCollection.getSubWedge()
            if (xsDataSubWedgeList is not None):
                xsDataSubWedgeFirst = xsDataSubWedgeList[0]
                xsDataExperimentalCondition = xsDataSubWedgeFirst.getExperimentalCondition()
                if (xsDataExperimentalCondition is not None):
                    xsDataDetector = xsDataExperimentalCondition.getDetector()
                    if (xsDataDetector is not None):
                        fBeamPositionX = xsDataDetector.getBeamPositionX().getValue()
                        fBeamPositionY = xsDataDetector.getBeamPositionY().getValue()
                        xsDataISPyBScreeningInput.setBeamX(XSDataDouble(fBeamPositionX))
                        xsDataISPyBScreeningInput.setBeamY(XSDataDouble(fBeamPositionY))

        return xsDataISPyBScreeningInput
Esempio n. 13
0
 def testCreateOutputFileDictionary(self):
     strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(),
                                         "XSDataResultCCP4i_reference.xml")
     strXML = self.readAndParseFile(strPathToCCP4iResult)
     EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1")
     from XSDataCCP4iv1_1 import XSDataResultCCP4i
     xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML)
     xsDataStringListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles(
     )
     pluginMXCuBE = self.createPlugin()
     pluginMXCuBE.configure()
     strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml"
     strPathToReferenceFile = os.path.join(
         self.getPluginTestsDataHome(), strResultCharacterisationFileName)
     strXML = self.readAndParseFile(strPathToReferenceFile)
     xsDataResultCharacterisation = XSDataResultCharacterisation.parseString(
         strXML)
     strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath(
         xsDataResultCharacterisation)
     pluginMXCuBE.createDNAFileDirectory(strDNAFileDirectoryPath)
     xsDataDictionary = pluginMXCuBE.createOutputFileDictionary(
         xsDataStringListOfOutputFiles, xsDataResultCharacterisation,
         strDNAFileDirectoryPath)
     EDAssert.equal(False, xsDataDictionary is None)
     shutil.rmtree(strDNAFileDirectoryPath)
    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())

        ref = self.readAndParseFile(os.path.join(self.getTestsDataImagesHome(), "DCT2011March.chi"))
        obt = self.readAndParseFile(xsDataResultObtained.getIntegratedIntensities().getPath().getValue())
        EDAssert.strAlmostEqual(ref, obt, "Chi files are the same", 0.001)

# clean up SPD when finished
        EDFactoryPluginStatic.loadPlugin("EDPluginSPDCorrectv10").killAllWorkers()
Esempio n. 15
0
    def __init__(self):
        """
        """
        EDPluginControl.__init__(self)
        #self.setXSDataInputClass( XSDataInputCharacterisation )
        #self.setXSDataInputClass(EDList)
        #self.strPluginIndexingName = "EDPluginControlIndexingv2_0"
        self.strPluginIndexingName = "EDPluginControlIndexingv10"
        self.edPluginIndexing = None
        self.strPluginIntegrationName = "EDPluginControlIntegrationv10"
        self.edPluginIntegration = None
        self.xsDataResultCharacterisationv2_0 = None
        self.xsDataResultCharacterisation = None
        self.xsDataInputStrategy = None

        self.setXSDataInputClass(XSDataInputCharacterisationv2_0)

        EDFactoryPluginStatic.loadModule("XSDataMXv1")
        import XSDataMXv1
        self.setXSDataInputClass(XSDataMXv1.XSDataInputCharacterisation,
                                 "mxv1InputCharacterisation")
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        import XSDataMXv2
        self.setXSDataInputClass(XSDataMXv2.XSDataCollection,
                                 "mxv2DataCollection")
Esempio n. 16
0
    def mergeAtomicComposition(self, _xsDataAtomicComposition1,
                               _xsDataAtomicComposition2):

        EDFactoryPluginStatic.loadModule("XSDataRaddosev10")

        mergedAtomicComposition = XSDataAtomicComposition()
        dictionary = {}

        for atom in _xsDataAtomicComposition2.getAtom():
            dictionary[
                atom.getSymbol().getValue()] = atom.getNumberOf().getValue()

        for atom1 in _xsDataAtomicComposition1.getAtom():
            symbol = atom1.getSymbol().getValue()
            if (self.exists(symbol, _xsDataAtomicComposition2) == True):
                mergedAtom = XSDataAtom()
                mergedAtom.setNumberOf(
                    XSDataDouble(atom1.getNumberOf().getValue() +
                                 dictionary[symbol]))
                mergedAtom.setSymbol(XSDataString(symbol))
                mergedAtomicComposition.addAtom(mergedAtom)
            else:
                mergedAtomicComposition.addAtom(atom1)

        for atom2 in _xsDataAtomicComposition2.getAtom():
            symbol = atom2.getSymbol().getValue()
            if (self.exists(symbol, _xsDataAtomicComposition1) == False):
                mergedAtomicComposition.addAtom(atom2)

        return mergedAtomicComposition
    def preProcess(self, _edPlugin=None):
        """
        This method prepares the input for the CCP4i plugin and loads it.
        """
        EDPluginControl.preProcess(self, _edPlugin)
        EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.preProcess...")

        EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1")
        from XSDataCCP4iv1_1 import XSDataInputCCP4i
        xsDataInputCCP4i = XSDataInputCCP4i()
        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputCCP4i.setDataSet(xsDataInputMXCuBE.getDataSet())
        #xsDataInputCCP4i.setDataFile( xsDataInputMXCuBE.getDataFile() )
        xsDataInputCCP4i.setExperimentalCondition(xsDataInputMXCuBE.getExperimentalCondition())
        xsDataInputCCP4i.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputCCP4i.setSample(xsDataInputMXCuBE.getSample())

        self.__edPluginControlCCP4i = self.loadPlugin(self.__strPluginControlCCP4i, "CCP4i")
        self.__edPluginControlCCP4i.setDataInput(xsDataInputCCP4i)

        self.__xsDataIntegerDataCollectionId = xsDataInputMXCuBE.getDataCollectionId()
        if (self.__xsDataIntegerDataCollectionId is not None):
            self.__edPluginControlISPyB = self.loadPlugin(self.__strPluginControlISPyB, "ISPyB")

        self.__edPluginExecOutputHTML = self.loadPlugin(self.__strPluginExecOutputHTMLName, "OutputHTML")
Esempio n. 18
0
 def __init__(self):
     """
     """
     EDPluginExecProcessScript.__init__(self)
     EDFactoryPluginStatic.loadModule("XSDataMXv1")
     EDFactoryPluginStatic.loadModule("XSDataMXv2")
     from XSDataMXv2 import XSDataCollection
     self.setXSDataInputClass(XSDataCollection, "dataCollection")
     self.__pyStrBCMDEF = None
Esempio n. 19
0
 def __init__(self):
     """
     """
     EDPluginExecProcessScript.__init__(self)
     EDFactoryPluginStatic.loadModule("XSDataMXv1")
     EDFactoryPluginStatic.loadModule("XSDataMXv2")
     from XSDataMXv2 import XSDataCollection
     self.setXSDataInputClass(XSDataCollection, "dataCollection")
     self.__pyStrBCMDEF = None
def runMXv1Pipeline():
    strLogFileName = os.path.join(returnWorkingDirectory(), "wsgi-server.log")
    EDVerbose.setLogFileName(strLogFileName)
    strInput = str(request['wsgi.input'].read(int(request['CONTENT_LENGTH'])))
    if strInput:
        # Take the parameters string, split off the title and run the bash script to generate the input char. XML  
        listParams = shlex.split(strInput)
        strComments = listParams[0]          # the 1st item
        strShortComments = listParams[1]     # the 2nd item
        strWorkingDir = listParams[2]        # the 3rd item
        strHTMLResultDir = listParams[3]     # the 4th item 
        
        os.chdir(strWorkingDir)
        
        strParamString = " ".join(listParams[4:])     # all but the first four items 
        edPluginMxv1ParamsToXML = EDFactoryPluginStatic.loadPlugin('EDPluginMxv1ParamsToXMLv1_0')
        edPluginMxv1ParamsToXML.setDataInput(XSDataString(strParamString), "paramString")
        edPluginMxv1ParamsToXML.executeSynchronous()
        xsDataFile = edPluginMxv1ParamsToXML.getDataOutput()

        # Read the XML and parse it into an object hierarchy        
        strXMLFile = xsDataFile.getPath().getValue()
        f = open(strXMLFile, 'r')
        xml = f.read()
        f.close()
        xsDataInputCharacterisation = XSDataInputCharacterisation.parseString(xml)

        # Run the MXv1 application pipeline
        edApplicationMXv1Characterisation = EDApplicationMXv1Characterisation(_strPluginName="EDPluginControlInterfacev1_2", \
                               _strConfigurationFileName=strConfigurationFilePath, \
                               _xsDataInputCharacterisation=xsDataInputCharacterisation, \
                               _strComments=strComments, \
                               _strShortComments=strShortComments)
        edApplicationMXv1Characterisation.execute()

        # Run the EDNA2HTML generator on the output from the MXv1 application 
        edPluginExecOutputHTML = EDFactoryPluginStatic.loadPlugin('EDPluginExecOutputHTMLv1_0')
        edPluginExecOutputHTML.setDataInput(XSDataString(strComments), "title")
        strWorkingDir = os.path.join(strWorkingDir, edApplicationMXv1Characterisation.getWorkingDir())
        edPluginExecOutputHTML.setDataInput(XSDataString(strWorkingDir), "workingDir")
        #strBaseDir = os.path.join(strHTMLResultDir, "edna")
        #edPluginExecOutputHTML.setDataInput(XSDataString(strBaseDir), "basename")
        edPluginExecOutputHTML.setDataInput(XSDataString(strHTMLResultDir), "basename")

        edPluginExecOutputHTML.executeSynchronous()
        
        strPathToHTMLFile = ""
        if (edPluginExecOutputHTML.hasDataOutput("htmlFile")):
            strPathToHTMLFile = edPluginExecOutputHTML.getDataOutput("htmlFile")[0].getPath().getValue()
        else:
            EDVerbose.ERROR("edna-mxv1-wsgi-server: edPluginExecOutputHTML has no dataOutput htmlFile!")
            
        if strPathToHTMLFile =="":
            EDVerbose.ERROR("edna-mxv1-wsgi-server: Returning empty string")
        return strPathToHTMLFile
    else:
        return strInput
Esempio n. 21
0
 def __init__(self, _strNameOfPlugin):
     EDPlugin.__init__(self)
     self.__strNameOfPlugin = _strNameOfPlugin
     EDFactoryPluginStatic.loadModule(_strNameOfPlugin)
     self.__dictXMLDataInput = {}
     self.__dictXMLDataOutput = {}
     self.__strPythonWrapperScriptName = "pluginWrapperForJobScheduler.py"
     self.__strPathToPythonWrapper = None
     self.__edServerXMLRCP = EDServerXMLRCP.getInstance()
     self.__edServerXMLRCP.registerPlugin(self)
     self.__bFinished = False
 def __init__(self):
     """
     """
     EDPluginSTACv2_0.__init__(self)
     EDFactoryPluginStatic.loadModule("XSDataMXv1")
     EDFactoryPluginStatic.loadModule("XSDataBestv1_2")
     from XSDataMXv1 import XSDataIndexingResult
     from XSDataBestv1_2 import XSDataInputBest
     self.setXSDataInputClass(XSDataInputBest, "inputBest")
     self.setXSDataInputClass(XSDataIndexingResult, "indexingResult")
     from XSDataMXv1 import XSDataString
     self.setXSDataInputClass(XSDataString, "KappaStrategyOption")
Esempio n. 23
0
 def __init__(self):
     """
     """
     EDPluginSTACv2_0.__init__(self)
     EDFactoryPluginStatic.loadModule("XSDataMXv1")
     EDFactoryPluginStatic.loadModule("XSDataBestv1_2")
     from XSDataMXv1 import XSDataIndexingResult
     from XSDataBestv1_2 import XSDataInputBest
     self.setXSDataInputClass(XSDataInputBest, "inputBest")
     self.setXSDataInputClass(XSDataIndexingResult, "indexingResult")
     from XSDataMXv1 import XSDataString
     self.setXSDataInputClass(XSDataString, "KappaStrategyOption")
 def testGenerateXSDataInputISPyB(self):
     """
     This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object.
     """
     strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputControlISPyB_reference.xml")
     strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile)
     strXMLIndexingInput = EDUtilsFile.readFileAndParseVariables(strPath, self.dictReplace)
     xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(strXMLIndexingInput)
     xsDataInputISPyB = EDHandlerXSDataISPyBv1_4.generateXSDataInputISPyBStoreScreening(xsDataInputControlISPyB)
     strReferenceInputISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputISPyB_reference.xml")
     strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile)
     strXMLInputISPyBReference = EDUtilsFile.readFileAndParseVariables(strReferencePath, self.dictReplace)
     EDFactoryPluginStatic.loadModule("XSDataISPyBv1_4")
Esempio n. 25
0
 def testGenerateXSDataInputISPyB(self):
     """
     This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object.
     """
     strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputControlISPyB_reference.xml")
     strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile)
     strXMLIndexingInput = EDUtilsFile.readFileAndParseVariables(strPath, self.dictReplace)
     xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(strXMLIndexingInput)
     xsDataInputISPyB = EDHandlerXSDataISPyBv1_3.generateXSDataInputISPyBStoreScreening(xsDataInputControlISPyB)
     print xsDataInputISPyB.marshal()
     strReferenceInputISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputISPyB_reference.xml")
     strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile)
     strXMLInputISPyBReference = EDUtilsFile.readFileAndParseVariables(strReferencePath, self.dictReplace)
     EDFactoryPluginStatic.loadModule("XSDataISPyBv1_3")
 def testGetXSDataResultCharacterisation(self):
     strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(),
                                                     "XSDataResultCCP4i_reference.xml")
     strXML = self.readAndParseFile(strPathToCCP4iResult)
     EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1")
     from XSDataCCP4iv1_1 import XSDataResultCCP4i
     xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML)
     strListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles().getValue()
     pluginMXCuBE = self.createPlugin()
     xsDataResultCharacterisation = pluginMXCuBE.getXSDataResultCharacterisation(strListOfOutputFiles)
     strPathToResultCharacterisationReference = os.path.join(self.getPluginTestsDataHome(),
                                                     "EDPluginControlCharacterisationv1_1_dataOutput.xml")
     xsDataResultCharacterisationReference = XSDataResultCharacterisation.parseFile(strPathToResultCharacterisationReference)
     EDAssert.equal(xsDataResultCharacterisationReference.marshal(), xsDataResultCharacterisation.marshal())
 def testGenerateXSDataMOSFLMInputIntegration(self):
     strFilename = "XSDataIntegrationInput_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLIntegrationInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIntegrationInput
     xsDataIntegrationInput = XSDataIntegrationInput.parseString(strXMLIntegrationInput)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(xsDataIntegrationInput)
     strReferenceFilename = "XSDataMOSFLMInputIntegration_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename)
     strXMLIntegrationInputReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
     xsDataMOSFLMInputIntegrationReference = XSDataMOSFLMInputIntegration.parseString(strXMLIntegrationInputReference)
     EDAssert.equal(xsDataMOSFLMInputIntegrationReference.marshal(), xsDataMOSFLMInputIntegration.marshal())
Esempio n. 28
0
    def getPathToProjectConfigurationFile(self, _strPluginName):
        """
        This method returns the path to the Project configuration file.

        @param _strPluginName: Name of the module
        @type _strPluginName: python string

        @return: The path to the project configuration file
        @type: python string
        """
        strPathToProjectConfigurationFile = None
        strCurrentDirectory = EDFactoryPluginStatic.getModuleLocation(_strPluginName)
        if strCurrentDirectory is None:
            self.WARNING("Cannot find path to configuration for plugin %s" % _strPluginName)
        else:
            with self.locked():
                bConfFileFound = False
                strPathToProjectConfigurationFile = None
                strConfigurationFileBaseName = "XSConfiguration_%s" % EDUtilsPath.EDNA_SITE
                while not bConfFileFound:
                    strPreviousDirectory = strCurrentDirectory
                    strCurrentDirectory = os.path.dirname(strCurrentDirectory)
                    if strCurrentDirectory in (EDUtilsPath.EDNA_HOME, strPreviousDirectory):
                        strPathToProjectConfigurationFile = None
                        break
                    strPathToConfigurationDirectory = os.path.abspath(os.path.join(strCurrentDirectory, "conf"))
                    for ext in [".json", ".xml"]:
                        strPathToProjectConfigurationFile = os.path.abspath(os.path.join(strPathToConfigurationDirectory, \
                                                                                    strConfigurationFileBaseName + ext))
                        self.DEBUG("Looking for configuration file for %s in %s" %
                                    (_strPluginName, strPathToProjectConfigurationFile))
                        bConfFileFound = os.path.isfile(strPathToProjectConfigurationFile)
                        if bConfFileFound:
                            break
        return strPathToProjectConfigurationFile
Esempio n. 29
0
 def getConfigurationHome(_strPluginName):
     """
     Returns the configuration directory path for a given test module
     """
     strModuleLocation = EDFactoryPluginStatic.getFactoryPlugin().getModuleLocation(_strPluginName)
     strConfigurationHome = EDUtilsPath.appendListOfPaths(strModuleLocation, [ "..", "..", "..", "conf" ])
     return strConfigurationHome
Esempio n. 30
0
 def preProcess(self):
     """
     Initialize the plugin to be launched
     """
     EDTestCasePlugin.preProcess(self)
     if(EDUtilsPath.EDNA_SITE == None):
         raise RuntimeError, "EDNA_SITE must be set"
     # Load the plugin that should be executed
     self._edPlugin = EDFactoryPluginStatic.loadPlugin(self.getPluginName())
     if(self._edPlugin is not None):
         for strInputDataKey in self._dictStrDataInputFiles.keys():
             if (type(self._dictStrDataInputFiles[ strInputDataKey ]) == types.ListType):
                 for strDataInputFile in self._dictStrDataInputFiles[ strInputDataKey ]:
                     strXMLData = self.readAndParseFile(strDataInputFile)
                     if (strInputDataKey == self._strDefaultInputDataKey):
                         self._edPlugin.setDataInput(strXMLData)
                     else:
                         self._edPlugin.setDataInput(strXMLData, strInputDataKey)
             else:
                 strXMLData = self.readAndParseFile(self._dictStrDataInputFiles[ strInputDataKey ])
                 if (strInputDataKey == self._strDefaultInputDataKey):
                     self._edPlugin.setDataInput(strXMLData)
                 else:
                     self._edPlugin.setDataInput(strXMLData, strInputDataKey)
         #self._edPlugin.setDataInput( self._strXMLData, "inputMXCuBE" )
     else:
         EDVerbose.ERROR("Cannot load plugin: %s" % self.getPluginName())
         raise RuntimeError
     self._edPlugin.setConfiguration(self.getPluginConfiguration())
 def testGenerateXSDataIndexingResult(self):
     """
     This method tests the generation of an XSDataIndexingResult object given an XSDataResultLabelit object.
     """
     strPath = os.path.join(self.strDataPath, self.strReferenceOutputFile)
     strXMLResultLabelit = EDUtilsTest.readAndParseFile(strPath)
     EDFactoryPluginStatic.loadModule("XSDataLabelitv10")
     from XSDataLabelitv10 import XSDataResultLabelit
     xsDataResultLabelit = XSDataResultLabelit.parseString(strXMLResultLabelit)
     from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10
     xsDataIndexingResult = EDHandlerXSDataLabelitv10.generateXSDataIndexingResult(xsDataResultLabelit)
     strReferencePath = os.path.join(self.strDataPath, "XSDataIndexingResult_reference.xml")
     strIndexingResultReferenceXML = EDUtilsTest.readAndParseFile(strReferencePath)
     from XSDataMXv1 import XSDataIndexingResult
     xsDataIndexingResultReference = XSDataIndexingResult.parseString(strIndexingResultReferenceXML)
     EDAssert.equal(xsDataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
Esempio n. 32
0
    def process(self):
        """
        Calls the Plugin to be executed
        """
        EDVerbose.DEBUG("EDApplicationDimplev0.process")
        if (not self.isFailure()):
            edPlugin = EDFactoryPluginStatic.loadPlugin(self.getPluginName())
            if (edPlugin is not None):
                edPlugin.setBaseDirectory(
                    self.getFullApplicationWorkingDirectory())
                edPlugin.setBaseName(self.getPluginName())

                if self.ccp4DataInputControlPipelineCalcDiffMap is None:
                    self.ccp4DataInputControlPipelineCalcDiffMap = self.createInput(
                    )
                edPlugin.setDataInput(
                    self.ccp4DataInputControlPipelineCalcDiffMap)
                edPlugin.connectSUCCESS(self.doSuccessActionPlugin)
                edPlugin.connectFAILURE(self.doFailureActionPlugin)
                EDVerbose.DEBUG("EDApplicationDimplev0.process: Executing " +
                                self.getPluginName())
                edPlugin.execute()
                edPlugin.synchronize()
            else:
                EDVerbose.error(
                    "EDApplicationDimplev0.process : plugin not loaded : %s" %
                    self.getPluginName())
                self.setFailure(True)
Esempio n. 33
0
    def process(self):
        """
        Calls the Plugin to be executed
        """
        EDVerbose.DEBUG("EDApplicationXAFSDataProcessing.process")
        if (not self.isFailure()) and (self.__bProcess):
            edPlugin = EDFactoryPluginStatic.loadPlugin(self.getPluginName())
            if (edPlugin is not None):
                edPlugin.setBaseDirectory(
                    self.getFullApplicationWorkingDirectory())
                edPlugin.setBaseName(self.getPluginName())

                self.setPluginInput(edPlugin)

                edPlugin.connectSUCCESS(self.doSuccessActionPlugin)
                edPlugin.connectFAILURE(self.doFailureActionPlugin)
                EDVerbose.DEBUG(
                    "EDApplicationXAFSDataProcessing.process: Executing " +
                    self.getPluginName())
                edPlugin.execute()
                edPlugin.synchronize()
            else:
                EDVerbose.error(
                    "EDApplicationXAFSDataProcessing .process : plugin not loaded : %s"
                    % self.getPluginName())
                self.setFailure(True)
Esempio n. 34
0
 def loadCalibratedData(self, _strElementName):
     """
     This method reads a file containing the calibrated energy spectra
     """
     calibratedData = None
     strModuleLocation = EDFactoryPluginStatic.getModuleLocation(
         self.getPluginName())
     strEnergyDataFile = os.path.join(os.path.dirname(strModuleLocation),
                                      "calibrationData",
                                      _strElementName + ".dat")
     if os.path.exists(strEnergyDataFile):
         listLines = []
         with open(strEnergyDataFile, 'r') as f:
             listLines = f.readlines()
         iSkipHeader = 0
         iSkipFooter = 0
         bIsHeader = True
         for strLine in listLines:
             if strLine.startswith('#'):
                 if bIsHeader:
                     iSkipHeader += 1
                 else:
                     iSkipFooter += 1
             else:
                 bIsHeader = False
         calibratedData = numpy.genfromtxt(strEnergyDataFile,
                                           skip_header=iSkipHeader,
                                           skip_footer=iSkipFooter)
     return calibratedData
 def testGenerateXSDataInputLabelit(self, _strFileNameXSDataIndexingInput_reference,
                                           _strFileNameXSDataLabelitInput_reference):
     """
     This method is testing the generation of the XSDataInputLabelit object given a XSDataIndexingInput object.
     """
     strPath = os.path.join(self.strDataPath, _strFileNameXSDataIndexingInput_reference)
     strXMLIndexingInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIndexingInput
     xsDataIndexingInput = XSDataIndexingInput.parseString(strXMLIndexingInput)
     from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10
     xsDataInputLabelit = EDHandlerXSDataLabelitv10.generateXSDataInputLabelit(xsDataIndexingInput)
     strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataLabelitInput_reference)
     strXMLInputLabelitReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataLabelitv10")
     from XSDataLabelitv10 import XSDataInputLabelit
     xsDataInputLabelitReference = XSDataInputLabelit.parseString(strXMLInputLabelitReference)
     EDAssert.equal(xsDataInputLabelitReference.marshal(), xsDataInputLabelit.marshal())
Esempio n. 36
0
    def __init__(self):
        EDPluginControl.__init__(self)
        #self.setXSDataInputClass(EDList)

        self.setRequiredToHaveConfiguration(True)

        self.strPluginRaddoseName = "EDPluginRaddosev10"
        self.edPluginRaddose = None
        self.edHandlerXSDataRaddose = None

        self.strPluginBestName = "EDPluginBestv1_2"
        self.edPluginBest = None
        from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2
        self.edHandlerXSDataBest = EDHandlerXSDataBestv1_2()

        self.strPluginAlignmentName = "EDPluginSTACAlignmentv2_0"
        self.edPluginAlignment = None
        self.edHandlerXSDataAlignment = None

        self.strPluginKappaStrategyName = "EDPluginSTACStrategyv2_0"
        self.edPluginKappaStrategy = None
        self.edHandlerXSDataKappaStrategy = None

        self.setXSDataInputClass(XSDataInputStrategy, "mxv1InputStrategy")
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        import XSDataMXv2
        self.setXSDataInputClass(XSDataMXv2.XSDataCollection,
                                 "mxv2DataCollection")
        import XSDataMXv1
        self.setXSDataInputClass(XSDataMXv1.XSDataIndexingResult,
                                 "mxv1IndexingResult")

        #disable kappa by default
        self.KappaStrategy = 0

        self.strCONF_SYMOP_HOME = "symopHome"
        # Default value for the location of the symop table
        self.strSymopHome = os.path.normpath("/opt/pxsoft/ccp4-6.0.2/lib/data")

        self.xsDataSampleCopy = None

        # For default chemical composition
        self.fAverageAminoAcidVolume = 135.49
        self.fAverageCrystalSolventContent = 0.47
        self.fAverageSulfurContentPerAminoacid = 0.05
        self.fAverageSulfurConcentration = 314
 def testGenerateXSDataInputBestv1_2(self, _strFileNameXSDataInputStrategy_reference, _strFileNameXSDataInputBest_reference):
     """
     This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object.
     """
     strReferenceInputFile = os.path.join(self.strDataPath, _strFileNameXSDataInputStrategy_reference)
     strPath = os.path.join(self.strDataPath, strReferenceInputFile)
     from XSDataMXv1 import XSDataInputStrategy
     xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath)
     from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2
     edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2()
     xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest(xsDataInputStrategy)
     strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataInputBest_reference)
     strXMLInputBestReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataBestv1_2")
     from XSDataBestv1_2 import XSDataInputBest
     xsDataInputBestReference = XSDataInputBest.parseString(strXMLInputBestReference)
     EDAssert.equal(xsDataInputBestReference.marshal(), xsDataInputBestv1_2.marshal())
    def __init__(self):
        EDPluginControl.__init__(self)

        self.setRequiredToHaveConfiguration(True)

        self.strPluginRaddoseName = "EDPluginRaddosev10"
        self.edPluginRaddose = None
        self.edHandlerXSDataRaddose = None

        self.strPluginBestName = "EDPluginBestv1_2"
        self.edPluginBest = None
        from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2

        self.edHandlerXSDataBest = EDHandlerXSDataBestv1_2()

        self.strPluginAlignmentName = "EDPluginSTACAlignmentv2_0"
        self.edPluginAlignment = None
        self.edHandlerXSDataAlignment = None

        self.strPluginKappaStrategyName = "EDPluginSTACStrategyv2_0"
        self.edPluginKappaStrategy = None
        self.edHandlerXSDataKappaStrategy = None

        self.setXSDataInputClass(XSDataInputStrategy, "mxv1InputStrategy")
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        import XSDataMXv2

        self.setXSDataInputClass(XSDataMXv2.XSDataCollection, "mxv2DataCollection")
        import XSDataMXv1

        self.setXSDataInputClass(XSDataMXv1.XSDataIndexingResult, "mxv1IndexingResult")

        # disable kappa by default
        self.KappaStrategy = 0

        self.strCONF_SYMOP_HOME = "symopHome"
        # Default value for the location of the symop table
        self.strSymopHome = os.path.normpath("/opt/pxsoft/ccp4-6.0.2/lib/data")

        self.xsDataSampleCopy = None

        # For default chemical composition
        self.fAverageAminoAcidVolume = 135.49
        self.fAverageCrystalSolventContent = 0.47
        self.fAverageSulfurContentPerAminoacid = 0.05
        self.fAverageSulfurConcentration = 314
Esempio n. 39
0
 def configure(self):
     EDPluginExec.configure(self)
     EDVerbose.DEBUG("EDPluginExecOutputHTMLv1_0.configure")
     self.strEDNA2html = self.config.get(self.CONF_EDNA2html)
     if self.strEDNA2html is None and os.environ.has_key("EDNA2html"):
         self.strEDNA2html = os.environ["EDNA2html"]
     else:
         self.strEDNA2html = EDFactoryPluginStatic.getModuleLocation("EDNA2html")
     pass
Esempio n. 40
0
    def generateXSDataInputLabelitIndexing(_xsDataIndexingInput):
        EDFactoryPluginStatic.loadModule("XSDataPhenixv1_1")
        from XSDataPhenixv1_1 import XSDataInputLabelitIndexing
        inputLabelitIndexing = XSDataInputLabelitIndexing()
        listXSDataImageReference = []
        dataCollection = _xsDataIndexingInput.dataCollection
        for subWedge in dataCollection.subWedge:
            for image in subWedge.image:
                inputLabelitIndexing.image.append(image.copy())

        xsDataCrystal = _xsDataIndexingInput.getCrystal()
        if xsDataCrystal is not None:
            xsDataSpaceGroup = xsDataCrystal.getSpaceGroup()
            if xsDataSpaceGroup is not None:
                xsDataStringName = xsDataSpaceGroup.getName()
                if xsDataStringName is not None:
                    inputLabelitIndexing.forcedSpaceGroup = xsDataStringName

        return inputLabelitIndexing
    def generateXSDataInputLabelitIndexing(_xsDataIndexingInput):
        EDFactoryPluginStatic.loadModule("XSDataPhenixv1_1")
        from XSDataPhenixv1_1 import XSDataInputLabelitIndexing
        inputLabelitIndexing = XSDataInputLabelitIndexing()
        listXSDataImageReference = []
        dataCollection = _xsDataIndexingInput.dataCollection
        for subWedge in dataCollection.subWedge:
            for image in subWedge.image:
                inputLabelitIndexing.image.append(image.copy())

        xsDataCrystal = _xsDataIndexingInput.getCrystal()
        if xsDataCrystal is not None:
            xsDataSpaceGroup = xsDataCrystal.getSpaceGroup()
            if xsDataSpaceGroup is not None:
                xsDataStringName = xsDataSpaceGroup.getName()
                if xsDataStringName is not None:
                    inputLabelitIndexing.forcedSpaceGroup = xsDataStringName

        return inputLabelitIndexing
Esempio n. 42
0
    def mergeStrategyToNewOrientation(_xsDataResultStrategy, _xsDataCollection, _fOmega, _fKappa, _fPhi):
        '''
        _xsDataResultStrategy: reference strategy results as the template for the new strategy
        _xsDataCollection: The data collection that will be merged in
        
        result:
        suggestedStrategy(XSDataResultStrategy): the strategy resulted from the merge
        '''
#        suggestedStrategy = None
#        try:
#            newpossibleOrientations=XSDataSTACv01.kappa_alignment_response.parseString(_possible_orientation.marshal())
#        except:
#            newpossibleOrientations=None
        #so we will copy the strategy of collecting the reference images inputed to here but at the new orientation
        #get the full strategy from the Reference
        EDFactoryPluginStatic.loadModule("XSDataMXv1")
        from XSDataMXv1 import XSDataResultStrategy
        suggestedStrategy = XSDataResultStrategy.parseString(_xsDataResultStrategy.marshal())
        #take only the first CollectionPlan
        if len(suggestedStrategy.getCollectionPlan()) > 0:
            suggestedStrategy.setCollectionPlan([suggestedStrategy.getCollectionPlan()[0]])
            #modify the DC part taking it from the input 
            suggestedStrategy.getCollectionPlan()[0].setCollectionStrategy(_xsDataCollection)
            #and modify the Orientation
          #  dc = XSDataMXv2.XSDataCollection()
          #  dc = self.getDataInput("mxv2DataCollection_Reference")[0]
    #        Orients = _possible_orientation.getPossible_orientation()
    #        omega = Orients[0].getOmega()
    #        kappa = Orients[0].getKappa()
    #        phi = Orients[0].getPhi()
            suggestedStrategy = EDHandlerXSDataMXv1v1_0.copyStrategyToNewOrientation(suggestedStrategy, _fOmega, _fKappa, _fPhi, "MERGED")
    #        for dcplan in suggestedStrategy.getCollectionPlan():
    #            dcplan.setComment(EDHandlerXSDataMXv1v1_0().replaceElements(dcplan.getComment(), "OMEGA=", omega))
    #            dcplan.setComment(EDHandlerXSDataMXv1v1_0().replaceElements(dcplan.getComment(), "KAPPA=", kappa))
    #            dcplan.setComment(EDHandlerXSDataMXv1v1_0().replaceElements(dcplan.getComment(), "PHI=", phi))
            #finally take the suggested new orientation out of the list of further possible ones
    #        if newpossibleOrientations is not None:
    #            newpossibleOrientations.setPossible_orientation([])
    #            for i in range(1, Orients.__len__()):
    #                if (math.fabs(float(Orients[i].getKappa())-float(kappa))<tol and math.fabs(float(Orients[i].getPhi())-float(phi))<tol):
    #                    newpossibleOrientations.addPossible_orientation(Orients[i])
    #        return [suggestedStrategy,newpossibleOrientations]
        return suggestedStrategy
Esempio n. 43
0
 def configure(self):
     EDPluginExec.configure(self)
     EDVerbose.DEBUG("EDPluginExecOutputHTMLv1_0.configure")
     self.strEDNA2html = self.config.get(self.CONF_EDNA2html)
     if self.strEDNA2html is None and os.environ.has_key("EDNA2html"):
         self.strEDNA2html = os.environ["EDNA2html"]
     else:
         self.strEDNA2html = EDFactoryPluginStatic.getModuleLocation(
             "EDNA2html")
     pass
Esempio n. 44
0
 def testGetXSDataResultCharacterisation(self):
     strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(),
                                         "XSDataResultCCP4i_reference.xml")
     strXML = self.readAndParseFile(strPathToCCP4iResult)
     EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1")
     from XSDataCCP4iv1_1 import XSDataResultCCP4i
     xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML)
     strListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles(
     ).getValue()
     pluginMXCuBE = self.createPlugin()
     xsDataResultCharacterisation = pluginMXCuBE.getXSDataResultCharacterisation(
         strListOfOutputFiles)
     strPathToResultCharacterisationReference = os.path.join(
         self.getPluginTestsDataHome(),
         "EDPluginControlCharacterisationv1_1_dataOutput.xml")
     xsDataResultCharacterisationReference = XSDataResultCharacterisation.parseFile(
         strPathToResultCharacterisationReference)
     EDAssert.equal(xsDataResultCharacterisationReference.marshal(),
                    xsDataResultCharacterisation.marshal())
 def getXSDataMOSFLMDetector(_xsDataDetector):
     """
     Translates an XSDataDetector object to XSDataMOSFLMv10.
     """
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMDetector
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     strDetectorType = _xsDataDetector.getType().getValue()
     if (strDetectorType == "q4") or \
          (strDetectorType == "q4-2x") or \
          (strDetectorType == "q210") or \
          (strDetectorType == "q210-2x") or \
          (strDetectorType == "q315") or \
          (strDetectorType == "q315-2x"):
         xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     elif (strDetectorType == "mar165") or \
            (strDetectorType == "mar225"):
         xsDataMOSFLMDetector.setType(XSDataString("MARCCD"))
     elif (strDetectorType == "pilatus6m"
           or strDetectorType == "pilatus2m"):
         xsDataMOSFLMDetector.setType(XSDataString("PILATUS"))
     elif strDetectorType.startswith("eiger2"):
         xsDataMOSFLMDetector.setType(XSDataString("EIGER2"))
     elif strDetectorType.startswith("eiger"):
         xsDataMOSFLMDetector.setType(XSDataString("EIGER"))
     elif (strDetectorType == "raxis4"):
         xsDataMOSFLMDetector.setType(XSDataString("RAXISIV"))
     else:
         # This is a temporary solution for the exception problem pointed out in bug #43.
         # Instead of raising an exception with a known type we send the error message as a string.
         strErrorMessage = "EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector: Unknown detector type : " + strDetectorType
         raise BaseException(strErrorMessage)
     if (_xsDataDetector.getNumberPixelX() is not None):
         xsDataMOSFLMDetector.setNumberPixelX(
             _xsDataDetector.getNumberPixelX())
     if (_xsDataDetector.getNumberPixelY() is not None):
         xsDataMOSFLMDetector.setNumberPixelY(
             _xsDataDetector.getNumberPixelY())
     if (_xsDataDetector.getPixelSizeX() is not None):
         xsDataMOSFLMDetector.setPixelSizeX(_xsDataDetector.getPixelSizeX())
     if (_xsDataDetector.getPixelSizeY() is not None):
         xsDataMOSFLMDetector.setPixelSizeY(_xsDataDetector.getPixelSizeY())
     return xsDataMOSFLMDetector
Esempio n. 46
0
def runXAFSPipeline():
    xmlXSDataInput = str(request['wsgi.input'].read(int(request['CONTENT_LENGTH'])))
    if xmlXSDataInput:
        edPluginControlXAFSDataProcessing = EDFactoryPluginStatic.loadPlugin('EDPluginControlXAFSDataBatchProcessingv0_1')
        edPluginControlXAFSDataProcessing.setDataInput(xmlXSDataInput)
        edPluginControlXAFSDataProcessing.executeSynchronous()
        
        return os.path.join(edPluginControlXAFSDataProcessing.getWorkingDirectory(), \
                            edPluginControlXAFSDataProcessing.returnResultsFilename())
    else:
        return xmlXSDataInput
 def preProcess(self):
     """
     PreProcess of the execution test: download an EDF file from http://www.edna-site.org
     """
     EDTestCasePluginExecuteControlMedianFilterImagev1_0.preProcess(self)
     self.loadTestImage([ "noise2.edf", "noise3.edf", "noise4.edf", "noise5.edf", "noise6.edf"])
     acc = EDFactoryPluginStatic.loadPlugin("EDPluginAccumulatorv1_0")
     xsdIn = XSDataInputAccumulator()
     xsdIn.setItem([XSDataString(os.path.join(self.getTestsDataImagesHome(), "noise%i.edf" % i)) for i in [2, 3, 5, 6]])
     acc.setDataInput(xsdIn)
     acc.executeSynchronous()
 def testCreateOutputFileDictionary(self):
     strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(),
                                                     "XSDataResultCCP4i_reference.xml")
     strXML = self.readAndParseFile(strPathToCCP4iResult)
     EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1")
     from XSDataCCP4iv1_1 import XSDataResultCCP4i
     xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML)
     xsDataStringListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles()
     pluginMXCuBE = self.createPlugin()
     pluginMXCuBE.configure()
     strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml"
     strPathToReferenceFile = os.path.join(self.getPluginTestsDataHome(),
                                                       strResultCharacterisationFileName)
     strXML = self.readAndParseFile(strPathToReferenceFile)
     xsDataResultCharacterisation = XSDataResultCharacterisation.parseString(strXML)
     strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath(xsDataResultCharacterisation)
     pluginMXCuBE.createDNAFileDirectory(strDNAFileDirectoryPath)
     xsDataDictionary = pluginMXCuBE.createOutputFileDictionary(xsDataResultCharacterisation, strDNAFileDirectoryPath)
     EDAssert.equal(False, xsDataDictionary is None)
     shutil.rmtree(strDNAFileDirectoryPath)
Esempio n. 49
0
    def preProcess(self):
        """
        Creates the application working directory (log dir)
        Initializes the configuration
        retrieves the plugin xml data to be passed to the plugin
        """
        EDVerbose.DEBUG("EDApplication.preProcess")
        self.processCommandline()
        if (not self.__bIsFailure):
            # Check that the plugin can be located
            strPluginLocation = EDFactoryPluginStatic.getFactoryPlugin().getModuleLocation(self.__strPluginName)
            if (strPluginLocation is None):
                EDVerbose.error("Plugin  %s cannot be loaded!" % self.__strPluginName)
                self.__bIsFailure = True
            # Check that the input file can be read
            if (self.getDataInputFilePath() is not None) and (not os.path.exists(self.__strDataInputFilePath)):
                EDVerbose.error("Input XML file not found : %s" % self.__strDataInputFilePath)
                self.__bIsFailure = True
            # Check that the output file can be created
            if (self.__strDataOutputFilePath is not None):
                strOutputDirectory = os.path.dirname(self.__strDataOutputFilePath)
                if (strOutputDirectory is None or strOutputDirectory == ""):
                    strOutputDirectory = os.getcwd()
                    self.__strDataOutputFilePath = os.path.join(strOutputDirectory, self.__strDataOutputFilePath)
                if (not os.access(strOutputDirectory, os.W_OK)):
                    EDVerbose.error("Output directory not writable: %s" % strOutputDirectory)
                    self.__bIsFailure = True
                elif (os.path.exists(self.__strDataOutputFilePath)):
                    if (not os.access(self.__strDataOutputFilePath, os.W_OK)):
                        EDVerbose.error("Output file not writable: %s" % self.__strDataOutputFilePath)
                        self.__bIsFailure = True
        if (not self.__bIsFailure):
            EDVerbose.DEBUG("EDApplication.PLUGIN_PARAM_LABEL: " + EDApplication.PLUGIN_PARAM_LABEL)

            # Load the configuration file
            if(self.__strConfigurationFileName is None):
                self.__strConfigurationHome = EDApplication.getConfigurationHome(self.__strPluginName)
                self.__strConfigurationFileName = os.path.abspath(os.path.join(self.__strConfigurationHome, "XSConfiguration_%s.xml" % EDUtilsPath.getEdnaSite()))
            if (os.path.exists(self.__strConfigurationFileName)):
                EDVerbose.screen("Loading Configuration file: %s" % self.__strConfigurationFileName)
                edConfiguration = EDConfiguration(self.__strConfigurationFileName)
                self.setConfiguration(edConfiguration)
                self.loadConfiguration()
                EDVerbose.DEBUG("EDApplication.preProcess: Checking... Number of plugins...: %d" % EDApplication.__edConfiguration.getPluginListSize())
                pyDictionary = {}
                pyDictionary[ "${EDNA_HOME}" ] = EDUtilsPath.getEdnaHome()
                if self.getDataInputFilePath() is not None:
                    self.__strXMLData = EDUtilsFile.readFileAndParseVariables(self.getDataInputFilePath(), pyDictionary)
            else:
                EDVerbose.warning("Cannot find configuration file: %s" % self.__strConfigurationFileName)
            # Create the application working directory    
            if(self.__strWorkingDir is None):
                self.__strWorkingDir = self.__strApplicationInstanceName
            self.createApplicationWorkingDirectory()
    def __init__(self):
        EDPluginControl.__init__(self)

        self.setRequiredToHaveConfiguration(True)

        self.strPluginRaddoseName = "EDPluginRaddosev10"
        self.edPluginRaddose = None
        self.edHandlerXSDataRaddose = None

        self.strPluginBestName = "EDPluginBestv1_2"
        self.edPluginBest = None
        from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2
        self.edHandlerXSDataBest = EDHandlerXSDataBestv1_2()

        self.strPluginAlignmentName = "EDPluginSTACAlignmentv2_0"
        self.edPluginAlignment = None
        self.edHandlerXSDataAlignment = None

        self.strPluginKappaStrategyName = "EDPluginSTACStrategyv2_0"
        self.edPluginKappaStrategy = None
        self.edHandlerXSDataKappaStrategy = None

        self.setXSDataInputClass(XSDataInputStrategy, "mxv1InputStrategy")
        EDFactoryPluginStatic.loadModule("XSDataMXv2")
        import XSDataMXv2
        self.setXSDataInputClass(XSDataMXv2.XSDataCollection,
                                 "mxv2DataCollection")
        import XSDataMXv1
        self.setXSDataInputClass(XSDataMXv1.XSDataIndexingResult,
                                 "mxv1IndexingResult")

        # disable kappa by default
        self.KappaStrategy = 0

        self.xsDataSampleCopy = None

        # For default chemical composition
        self.fAverageAminoAcidVolume = 135.49
        self.fAverageCrystalSolventContent = 0.47
        self.fAverageSulfurContentPerAminoacid = 0.05
        self.fAverageSulfurConcentration = 314
 def testGenerateXSDataInputISPyB(self):
     """
     This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object.
     """
     strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputControlISPyB_reference.xml")
     strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile)
     strXMLIndexingInput = self.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataInputControlISPyB
     xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(strXMLIndexingInput)
     from EDHandlerXSDataISPyBv1_1 import EDHandlerXSDataISPyBv1_1
     xsDataInputISPyB = EDHandlerXSDataISPyBv1_1.generateXSDataInputISPyB(xsDataInputControlISPyB)
     strReferenceInputISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputISPyB_reference.xml")
     strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile)
     strXMLInputISPyBReference = self.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataISPyBv1_1")
     from XSDataISPyBv1_1 import XSDataInputISPyB
     xsDataInputISPyBReference = XSDataInputISPyB.parseString(strXMLInputISPyBReference)
     # Remove the time strings since they otherwise make the test fail
     xsDataInputISPyBReference.getScreening().setTimeStamp(None)
     xsDataInputISPyB.getScreening().setTimeStamp(None)
     EDAssert.equal(xsDataInputISPyBReference.marshal(), xsDataInputISPyB.marshal())
Esempio n. 52
0
 def copyStrategyToNewOrientation(_xsDataResultStrategy, _fOmega, _fKappa, _fPhi, _strategy = "COPIED"):
     '''
     _xsDataResultStrategy: the strategy results in which the orientation should be changed
     omega,kappa,phi: the new orientation
     
     result:
     suggestedStrategy(XSDataResultStrategy): the strategy in which the orientation is changed
     '''
     #we suggest the currently calculated strategy
     EDFactoryPluginStatic.loadModule("XSDataMXv1")
     from XSDataMXv1 import XSDataResultStrategy
     suggestedStrategy = XSDataResultStrategy.parseString(_xsDataResultStrategy.marshal())
     #and we have to add the actual orientation
     EDFactoryPluginStatic.loadModule("EDHandlerXSDataCommon")
     from EDHandlerXSDataCommon import EDHandlerXSDataCommon
     for dcplan in suggestedStrategy.getCollectionPlan():
         dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "OMEGA=", str(_fOmega)))
         dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "KAPPA=", str(_fKappa)))
         dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "PHI=", str(_fPhi)))
         dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "STRATEGY=", str(_strategy)))
     return suggestedStrategy
Esempio n. 53
0
 def testGenerateXSDataMOSFLMInputIntegration(self):
     strFilename = "XSDataIntegrationInput_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLIntegrationInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIntegrationInput
     xsDataIntegrationInput = XSDataIntegrationInput.parseString(
         strXMLIntegrationInput)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(
         xsDataIntegrationInput)
     strReferenceFilename = "XSDataMOSFLMInputIntegration_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath,
                                     strReferenceFilename)
     strXMLIntegrationInputReference = EDUtilsTest.readAndParseFile(
         strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
     xsDataMOSFLMInputIntegrationReference = XSDataMOSFLMInputIntegration.parseString(
         strXMLIntegrationInputReference)
     EDAssert.equal(xsDataMOSFLMInputIntegrationReference.marshal(),
                    xsDataMOSFLMInputIntegration.marshal())
Esempio n. 54
0
def runXAFSPipeline():
    xmlXSDataInput = str(request['wsgi.input'].read(
        int(request['CONTENT_LENGTH'])))
    if xmlXSDataInput:
        edPluginControlXAFSDataProcessing = EDFactoryPluginStatic.loadPlugin(
            'EDPluginControlXAFSDataBatchProcessingv0_1')
        edPluginControlXAFSDataProcessing.setDataInput(xmlXSDataInput)
        edPluginControlXAFSDataProcessing.executeSynchronous()

        return os.path.join(edPluginControlXAFSDataProcessing.getWorkingDirectory(), \
                            edPluginControlXAFSDataProcessing.returnResultsFilename())
    else:
        return xmlXSDataInput
Esempio n. 55
0
 def __init__( self ):
     """
     """
     EDPluginSTACv2_0.__init__( self )
     EDFactoryPluginStatic.loadModule( "XSDataMXv1" )
     EDFactoryPluginStatic.loadModule( "XSDataMXv2" )
     EDFactoryPluginStatic.loadModule( "XSDataSTACv2_0" )
     EDFactoryPluginStatic.loadModule( "XSDataBestv1_2" )
     from XSDataMXv1 import XSDataIndexingResult
     from XSDataMXv1 import XSDataInputStrategy
     from XSDataBestv1_2 import XSDataInputBest
     self.setXSDataInputClass( kappa_strategy_request, "kappa_strategy_request" )
     import XSDataMXv2
     self.setXSDataInputClass( XSDataMXv2.XSDataCollection, "mxv2DataCollection" )
     # not used: self.setXSDataInputClass( XSDataIndexingResult, "indexingResult" )
     self.setXSDataInputClass( XSDataInputStrategy, "inputBest" )