def __init__(self, _edStringTestName=None):

        EDTestCasePluginExecute.__init__(
            self, 'EDPluginControlDIMPLEPrepareMTZFileForRefinementv10',
            'EDPluginControlDIMPLEPrepareMTZFileForRefinement-v1.0',
            _edStringTestName)

        self.setConfigurationFile(
            EDUtilsPath.mergePath(
                self.getPluginTestsDataHome(),
                'XSConfiguration_DIMPLEPrepareMTZFileForRefinement.xml'))

        self.setDataInputFile(
            EDUtilsPath.mergePath(
                self.getPluginTestsDataHome(),
                'XSDataInputDIMPLEPrepareMTZFileForRefinement_reference.xml'))

        self.setReferenceDataOutputFile(
            EDUtilsPath.mergePath(
                self.getPluginTestsDataHome(),
                'XSDataResultDIMPLEPrepareMTZFileForRefinement_reference.xml'))

        self.m_edObtainedOutputDataFile = self.getPluginName() + '_output.xml'

        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 0
    def preProcess(self, _edObject=None):
        """
        """
        EDPluginExecProcessScript.preProcess(self)

        self.setFileBestDat(EDUtilsPath.mergePath(self.getWorkingDirectory(), "bestfile.dat"))
        self.setFileBestPar(EDUtilsPath.mergePath(self.getWorkingDirectory(), "bestfile.par"))

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

        listBestFileContentHKL = self.getDataInput().getBestFileContentHKL()

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


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

        self.initializeCommands()
 def __init__(self, _pyStrTestName=None):
     EDTestCase.__init__(self, _pyStrTestName)
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     strDataDir = "EDHandlerRaddosev10"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strReferenceInputFile2 = EDUtilsPath.mergePath(self.strDataPath, "XSDataRaddosev10Input_reference_02.xml")
     self.strObtainedInputFile2 = "XSDataInputRaddosev10FromObject_02.xml"
Example #4
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())
    def __init__(self, _oalStringTestName=None):
        """
        """
        EDTestCasePluginExecuteBestv1_2.__init__(self, "EDPluginBestv1_2")

        self.setConfigurationFile(self.getRefConfigFile())
        self.setDataInputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataInputBest_withDamPar.xml"))
        self.setReferenceDataOutputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataResultBest_withDamPar.xml"))
    def testSetDataModelInput(self):
        edPluginBest = self.createPlugin()
        xsPluginItemGood01 = self.getPluginConfiguration(EDUtilsPath.mergePath(self.m_pyStrDataPath, "XSConfiguration.xml"))
        edPluginBest.setConfiguration(xsPluginItemGood01)
        edPluginBest.setScriptExecutable("cat")
        edPluginBest.configure()

        from XSDataBestv1_2 import XSDataInputBest
        xsDataInputBest = XSDataInputBest()

        from XSDataCommon import XSDataAbsorbedDoseRate
        from XSDataCommon import XSDataDouble
        from XSDataCommon import XSDataString
        from XSDataCommon import XSDataTime
        from XSDataCommon import XSDataFile
        from XSDataCommon import XSDataSpeed
        from XSDataCommon import XSDataString
        from XSDataCommon import XSDataAngle
        from XSDataCommon import XSDataBoolean

        xsDataInputBest.setCrystalAbsorbedDoseRate(XSDataAbsorbedDoseRate(0.22E+06))
        xsDataInputBest.setCrystalShape(XSDataDouble(1))
        xsDataInputBest.setCrystalSusceptibility(XSDataDouble(1.5))
        xsDataInputBest.setDetectorType(XSDataString("q210-2x"))
        xsDataInputBest.setBeamExposureTime(XSDataTime(1))
        xsDataInputBest.setBeamMaxExposureTime(XSDataTime(10000))
        xsDataInputBest.setBeamMinExposureTime(XSDataTime(0.1))
        xsDataInputBest.setGoniostatMinRotationWidth(XSDataAngle(0.1))
        xsDataInputBest.setGoniostatMaxRotationSpeed(XSDataSpeed(10))
        xsDataInputBest.setAimedResolution(XSDataDouble(2))
        xsDataInputBest.setAimedRedundancy(XSDataDouble(6.5))
        xsDataInputBest.setAimedCompleteness(XSDataDouble(0.9))
        xsDataInputBest.setAimedIOverSigma(XSDataDouble(3))
        xsDataInputBest.setComplexity(XSDataString("min"))
        xsDataInputBest.setAnomalousData(XSDataBoolean(False))
        fileDirectory = edPluginBest.getWorkingDirectory()

        bestFileContentDat = EDUtilsFile.readFile(EDUtilsPath.mergePath(self.m_pyStrDataPath, "bestfile.dat"))
        xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat))

        bestFileContentPar = EDUtilsFile.readFile(EDUtilsPath.mergePath(self.m_pyStrDataPath, "bestfile.par"))
        xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar))

        bestFileContentHKL = EDUtilsFile.readFile(EDUtilsPath.mergePath(self.m_pyStrDataPath, "bestfile1.hkl"))
        xsDataInputBest.addBestFileContentHKL(XSDataString(bestFileContentHKL))

        xsDataInputBest.outputFile(self.m_edObtainedInputFile)

        pyStrExpectedInput = self.readAndParseFile (self.m_edReferenceInputFile)
        pyStrObtainedInput = self.readAndParseFile (self.m_edObtainedInputFile)

        xsDataInputExpected = XSDataInputBest.parseString(pyStrExpectedInput)
        xsDataInputObtained = XSDataInputBest.parseString(pyStrObtainedInput)

        EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
        EDUtilsFile.deleteFile(self.m_edObtainedInputFile)

        self.cleanUp(edPluginBest)
    def __init__(self, _pyStrTestName=None):
        EDTestCasePluginUnit.__init__(self, "EDPluginBestv1_2")
        self.m_pyStrDataPath = self.getPluginTestsDataHome()

        self.m_edObtainedInputFile = "XSDataInputBest_test.xml"
        self.m_edReferenceInputFile = EDUtilsPath.mergePath(self.m_pyStrDataPath, "XSDataInputBest_reference.xml")
        self.m_edReferenceResultFile = EDUtilsPath.mergePath(self.m_pyStrDataPath, "XSDataResultBest_reference.xml")

        self.m_edReferenceScriptLogFileName = EDUtilsPath.mergePath(self.m_pyStrDataPath, "EDPluginBestv1_2.log")
    def __init__(self, _oalStringTestName=None):
        EDTestCasePluginExecuteBestv1_2.__init__(self, "EDPluginBestv1_2")

        self.setConfigurationFile(self.getRefConfigFile())
        self.setDataInputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataInputBest_withMinTransmissionInput.xml"))
        if (self.m_bRunOnIntel):
            self.setReferenceDataOutputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataResultBest_withTransmissionInputForIntel.xml"))
        else:
            self.setReferenceDataOutputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataResultBest_withTransmissionInput.xml"))
 def __init__(self, _pyStrTestName=None):
     EDTestCase.__init__(self, _pyStrTestName)
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDHandlerRaddosev10"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strReferenceInputFile2 = EDUtilsPath.mergePath(
         self.strDataPath, "XSDataRaddosev10Input_reference_02.xml")
     self.strObtainedInputFile2 = "XSDataInputRaddosev10FromObject_02.xml"
 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")
Example #11
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")
Example #12
0
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, "EDTestCaseEDConfiguration")
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDConfiguration"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strEdnaSiteOrig = EDUtilsPath.getEdnaSite()
    def __init__(self, _edStringTestName=None):
        EDTestCasePluginExecute.__init__(self, "EDPluginSTACAlignmentv2_0")

        edStringPluginTestDataHome = self.getPluginTestsDataHome()
        self.m_edStringExecutionTestDataInputHome = EDUtilsPath.mergePath(edStringPluginTestDataHome, "executionTestInput")
        self.m_edStringExecutionTestDataResultHome = EDUtilsPath.mergePath(edStringPluginTestDataHome, "executionTestResult")

        self.setConfigurationFile(self.getRefConfigFile())
        self.setDataInputFile(os.path.join(self.m_edStringExecutionTestDataInputHome, "EDPluginSTACAlignmentv2_0_dataInputBest_reference.xml"), "inputBest")
        self.setDataInputFile(os.path.join(self.m_edStringExecutionTestDataInputHome, "EDPluginSTACAlignmentv2_0_dataInputDataCollection_reference.xml"), "dataCollection")
        self.setDataInputFile(os.path.join(self.m_edStringExecutionTestDataInputHome, "EDPluginSTACAlignmentv2_0_dataInputIndexingResult_reference.xml"), "indexingResult")
        self.__pyStrBCMDEFReference = os.path.join(self.m_edStringExecutionTestDataInputHome, "BCM.dat")

        self.setReferenceDataOutputFile(os.path.join(self.m_edStringExecutionTestDataResultHome, "EDPluginSTACAlignmentv2_0_dataOutput_reference.xml"))
        #self.m_edObtainedOutputDataFile = self.getPluginName() + "_dataOutput.xml"
        self.m_edObtainedOutputDataFile = self.getPluginName() + "_output.xml"
        self.setNoExpectedWarningMessages(1)
 def testGetBestWilsonPlotPath(self):
     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)
     xsDataCharacterisationResult = xsDataInputControlISPyB.characterisationResult
     strPath = EDHandlerXSDataISPyBv1_4.getBestWilsonPlotPath(xsDataCharacterisationResult)
     EDAssert.equal(True, strPath.endswith("B.jpg"), "Wilson plot path extracted from characterisation results")
    def __init__( self, _edStringTestName = None):
        """
        """
        EDTestCasePluginExecute.__init__( self, "EDPluginExecDIMPLEMTZDUMPv10" )

        self.setConfigurationFile( self.getRefConfigFile() )
        
        self.setDataInputFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(), \
                                                      "XSDataInputDIMPLEMTZDUMP_reference.xml" ) )
        
        self.setReferenceDataOutputFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(), \
                                                                "XSDataResultDIMPLEMTZDUMP_reference.xml"))

        self.m_edObtainedOutputDataFile = self.getPluginName() + "_output.xml"
        
        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 0        
    def __init__(self, _edStringTestName = None):
        EDTestCasePluginExecute.__init__(self, 'EDPluginExecDIMPLEREINDEXv10')

        self.setConfigurationFile( self.getRefConfigFile() )
        
        self.setDataInputFile(EDUtilsPath.mergePath(
            self.getPluginTestsDataHome(), 
            'XSDataInputDIMPLEREINDEX_reference.xml'))
        
        self.setReferenceDataOutputFile(EDUtilsPath.mergePath(
            self.getPluginTestsDataHome(), 
            'XSDataResultDIMPLEREINDEX_reference.xml'))

        self.m_edObtainedOutputDataFile = '%s_output.xml' % \
                                          self.getPluginName()
        
        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 0        
    def __init__( self, _edStringTestName = None):
        """
        """
        EDTestCasePluginExecute.__init__( self, "EDPluginControlTomographyv10", "EDPluginControlTomography-v1.0", _edStringTestName )

        self.setConfigurationFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(),
                                                          "XSConfiguration_Tomography.xml" ) )
        
        self.setDataInputFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(), \
                                                      "XSDataInputTomography_reference.xml" ) )
        
        self.setReferenceDataOutputFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(), \
                                                                "XSDataResultTomography_reference.xml"))

        self.m_edObtainedOutputDataFile = self.getPluginName() + "_output.xml"
        
        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 0        
    def __init__(self, _edStringTestName=None):
        EDTestCasePluginExecute.__init__(self,
                                         'EDPluginExecDIMPLETRUNCATETESTv10')

        self.setConfigurationFile(self.getRefConfigFile())

        self.setDataInputFile(
            EDUtilsPath.mergePath(self.getPluginTestsDataHome(),
                                  'XSDataInputDIMPLETRUNCATE_reference.xml'))

        self.setReferenceDataOutputFile(
            EDUtilsPath.mergePath(self.getPluginTestsDataHome(),
                                  'XSDataResultDIMPLETRUNCATE_reference.xml'))

        self.m_edObtainedOutputDataFile = '%s_output.xml' % \
                                          self.getPluginName()

        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 0
    def __init__(self, _edStringTestName=None):
        EDTestCasePluginUnit.__init__(self, "EDPluginMOSFLMIndexingv10")

        strDataImageDir = "images"
        self.strDataImagePath = os.path.join(self.getTestsDataHome(), strDataImageDir)

        strPluginTestDataHome = self.getPluginTestsDataHome()
        self.strUnitTestDataHome = EDUtilsPath.mergePath(strPluginTestDataHome, "unitTest")

        self.strReferenceDataInputFile = os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMInputIndexing_reference.xml")
        self.strReferenceDataOutputFile = os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMOutputIndexing_reference.xml")
    def __init__(self, _edStringTestName = None):
        EDTestCasePluginExecute.__init__(
            self, 'EDPluginControlDIMPLEPipelineCalcDiffMapv10',
            'EDPluginControlDIMPLEPipelineCalcDiffMap-v1.0', _edStringTestName)

        self.setConfigurationFile(EDUtilsPath.mergePath(
            self.getPluginTestsDataHome(),
            'XSConfiguration_DIMPLEPipelineCalcDiffMap.xml'))
        
        self.setDataInputFile(EDUtilsPath.mergePath(
            self.getPluginTestsDataHome(), 
            'XSDataInputDIMPLEPipelineCalcDiffMap_reference.xml'))
        
        self.setReferenceDataOutputFile(EDUtilsPath.mergePath(
            self.getPluginTestsDataHome(), 
            'XSDataResultDIMPLEPipelineCalcDiffMap_reference.xml'))

        self.m_edObtainedOutputDataFile = self.getPluginName() + '_output.xml'
        
        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 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())
Example #22
0
    def __init__(self, _edStringTestName=None):
        """
        """
        EDTestCasePluginExecute.__init__(self, "EDPluginControlTomographyv10",
                                         "EDPluginControlTomography-v1.0",
                                         _edStringTestName)

        self.setConfigurationFile(
            EDUtilsPath.mergePath(self.getPluginTestsDataHome(),
                                  "XSConfiguration_Tomography.xml"))

        self.setDataInputFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(), \
                                                      "XSDataInputTomography_reference.xml" ) )

        self.setReferenceDataOutputFile( EDUtilsPath.mergePath( self.getPluginTestsDataHome(), \
                                                                "XSDataResultTomography_reference.xml"))

        self.m_edObtainedOutputDataFile = self.getPluginName() + "_output.xml"

        self.m_iNoErrorMessages = 0
        self.m_iNoWarningMessages = 0
 def __init__(self, _oalStringTestName=None):
     EDTestCasePluginExecute.__init__(self, "EDPluginBestv1_2")
     self.setConfigurationFile(self.getRefConfigFile())
     self.setDataInputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataInputBest_reference.xml"))
     #
     # If on Linux, check if run on Intel processor
     #
     self.m_bRunOnIntel = False
     pyStrSystem = os.uname()[0]
     if (pyStrSystem == "Linux"):
         pyFile = open("/proc/cpuinfo", "r")
         pyListCpuInfo = pyFile.readlines()
         pyFile.close()
         for pyStrLine in pyListCpuInfo:
             if (pyStrLine.find("vendor_id") != -1):
                 if (pyStrLine.find("GenuineIntel") != -1):
                      self.m_bRunOnIntel = True
     if (self.m_bRunOnIntel):
         self.setReferenceDataOutputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataResultBest_referenceForIntel.xml"))
     else:
         self.setReferenceDataOutputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataResultBest_reference.xml"))
    def __init__(self, _strTestName=None):
        """
        """
        EDTestCasePluginUnit.__init__(self, "EDPluginMOSFLMIntegrationv10", "EDPluginGroupMOSFLM-v1.0", _strTestName)

        strPluginTestDataHome = self.getPluginTestsDataHome()
        self.strUnitTestDataHome = EDUtilsPath.mergePath(strPluginTestDataHome, "unitTest")

        self.strReferenceDataInputFile = os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMInputIntegration_reference.xml")
        self.strReferenceDataOutputFile = os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMOutputIntegration_reference.xml")

        strDataImageDir = "images"
        self.strDataImagePath = os.path.join(self.getTestsDataHome(), strDataImageDir)
 def testConfigureOK(self):
     edPluginBest = self.createPlugin()
     strConfigPath = EDUtilsPath.mergePath(self.strDataPath, "XSConfiguration.xml")
     xsPluginItemGood01 = self.getPluginConfiguration(strConfigPath)
     edPluginBest.setConfiguration(xsPluginItemGood01)
     edPluginBest.setScriptExecutable("cat")
     edPluginBest.configure()
     EDAssert.equal("/bin/bash", edPluginBest.getScriptShell())
     EDAssert.equal("cat", edPluginBest.getScriptExecutable())
     EDAssert.equal("/opt/pxsoft/ccp4-6.0.2/include/ccp4.setup-bash.orig", edPluginBest.getSetupCCP4())
     EDAssert.equal("Version of Best to be tested", edPluginBest.getStringVersion())
     # EDAssert.equal(600, edPluginMessage.getTimeOut())
     EDAssert.equal("/home/sweet/home", edPluginBest.getBestHome())
     EDAssert.equal("export besthome=/home/sweet/home", edPluginBest.getCommandBestHome())
     self.cleanUp(edPluginBest)
 def testGetBestWilsonPlotPath(self):
     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)
     xsDataCharacterisationResult = xsDataInputControlISPyB.characterisationResult
     strPath = EDHandlerXSDataISPyBv1_4.getBestWilsonPlotPath(
         xsDataCharacterisationResult)
     EDAssert.equal(
         True, strPath.endswith("B.jpg"),
         "Wilson plot path extracted from characterisation results")
 def finallyProcess(self, _edObject=None):
     EDPluginExecProcessScript.finallyProcess(self)
     EDVerbose.DEBUG("EDPluginBestv1_2.finallyProcess")
     strError = self.readProcessErrorLogFile()
     if((strError is not None) and (strError != "")):
         strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginBestv1_2.postProcess', 'EDPluginBestv1_2', strError)
         EDVerbose.error(strErrorMessage)
         self.addErrorMessage(strErrorMessage)
         self.setDataOutput(XSDataResultBest())
         self.setFailure()
     else:
         xsDataResultBest = self.getOutputDataFromDNATableFile(EDUtilsPath.mergePath(self.getWorkingDirectory(), self.getScriptBaseName() + "_dnaTables.xml"))
         xsDataFilePathToLog = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName())))
         xsDataResultBest.setPathToLogFile(xsDataFilePathToLog)
         self.setDataOutput(xsDataResultBest)
    def testSetDataInput(self):
        """
        """
        edPluginXDSIndexingv1_0 = self.createPlugin()
        xsPluginItemGood01 = self.getPluginConfiguration(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "EDPluginXDSIndexingv1_0_configuration_OK_01.xml"))
        edPluginXDSIndexingv1_0.setConfiguration(xsPluginItemGood01)
        edPluginXDSIndexingv1_0.setScriptExecutable("cat")
        edPluginXDSIndexingv1_0.configure()

        from XSDataXDSv1_0 import XSDataInputXDSIndexing
        xmlInput = self.readAndParseFile(self.strReferenceInputFile)
        xsDataXDSIndexingInputReference = XSDataInputXDSIndexing.parseString(xmlInput)
        xsDataXDSIndexingInputReference.outputFile("XSDataInputXDSIndexing_reference.xml")
        edPluginXDSIndexingv1_0.setDataInput(xmlInput)

        xsDataXDSIndexingInput = edPluginXDSIndexingv1_0.getDataInput()
        xsDataXDSIndexingInput.outputFile("XSDataInputXDSIndexing.xml")
        EDAssert.equal(xsDataXDSIndexingInputReference.marshal(), xsDataXDSIndexingInput.marshal())

        self.cleanUp(edPluginXDSIndexingv1_0)
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, "EDTestCaseEDConfiguration")
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     strDataDir = "EDConfiguration"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strEdnaSiteOrig = EDUtilsPath.getEdnaSite()
 def __init__(self, _strTestName=None):
     EDTestCasePluginUnit.__init__(self, "EDPluginSTACv2_0")
     strPluginTestDataHome = self.getPluginTestsDataHome()
     self.strUnitTestDataHome = EDUtilsPath.mergePath(strPluginTestDataHome, "unitTest")
    def __init__(self, _pyStrTestName="EDPluginXDSGenerateBackgroundImagev1_0"):
        EDTestCasePluginExecute.__init__(self, _pyStrTestName)

        self.setConfigurationFile(self.getRefConfigFile())
        self.setDataInputFile(EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataInputXDSIndexing_reference.xml"))
 def __init__(self, _pyStrTestName="EDPluginXDSSpotSearchv1_1"):
     """
     Set up paths, reference files etc.
     """
     EDTestCasePluginUnit.__init__(self, _pyStrTestName)
     self.m_pyStrReferenceInputFile = EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataInputXDSSpotSearch_reference.xml")
    def initializeCommands(self):
        self.addListCommandPreExecution(self.__strCommandBestHome)

        listFileBestHKL = self.getListFileBestHKL()
        listFileBestHKLCommand = ""

        for fileBestHKL in listFileBestHKL:
            listFileBestHKLCommand = listFileBestHKLCommand + fileBestHKL + " "

        strDetectorName = self.getDataInput().getDetectorType().getValue()
        fExposureTime = self.getDataInput().getBeamExposureTime().getValue()
        fMaxExposureTime = self.getDataInput().getBeamMaxExposureTime().getValue()

        self.__strCommandBest = "-f " + strDetectorName + " " + "-t " + str(fExposureTime) + " "

        if(self.getDataInput().getBeamMinExposureTime() is not None):
            strBeamMinExposureTime = str(self.getDataInput().getBeamMinExposureTime().getValue())
            self.__strCommandBest = self.__strCommandBest + "-M " + strBeamMinExposureTime + " "

        if(self.getDataInput().getGoniostatMaxRotationSpeed() is not None):
            strGoniostatMaxRotationSpeed = str(self.getDataInput().getGoniostatMaxRotationSpeed().getValue())
            self.__strCommandBest = self.__strCommandBest + "-S " + strGoniostatMaxRotationSpeed + " "

        if(self.getDataInput().getGoniostatMinRotationWidth() is not None):
            strGoniostatMinRotationWidth = str(self.getDataInput().getGoniostatMinRotationWidth().getValue())
            self.__strCommandBest = self.__strCommandBest + "-w " + strGoniostatMinRotationWidth + " "

        if(self.getDataInput().getAimedResolution() is not None):
            strAimedResolution = str(self.getDataInput().getAimedResolution().getValue())
            self.__strCommandBest = self.__strCommandBest + "-r " + strAimedResolution + " "

        if(self.getDataInput().getAimedRedundancy() is not None):
            strAimedRedundancy = str(self.getDataInput().getAimedRedundancy().getValue())
            self.__strCommandBest = self.__strCommandBest + "-R " + strAimedRedundancy + " "

        if(self.getDataInput().getAimedCompleteness() is not None):
            strAimedCompleteness = str(self.getDataInput().getAimedCompleteness().getValue())
            self.__strCommandBest = self.__strCommandBest + "-C " + strAimedCompleteness + " "

        if(self.getDataInput().getAimedIOverSigma() is not None):
            strAimedIOverSigma = str(self.getDataInput().getAimedIOverSigma().getValue())
            self.__strCommandBest = self.__strCommandBest + "-i2s " + strAimedIOverSigma + " "

        if(self.getDataInput().getCrystalAbsorbedDoseRate() is not None):
            strCrystalAbsorbedDoseRate = str(self.getDataInput().getCrystalAbsorbedDoseRate().getValue())
            self.__strCommandBest = self.__strCommandBest + "-GpS " + strCrystalAbsorbedDoseRate + " "

        if(self.getDataInput().getCrystalShape() is not None):
            strCrystalShape = str(self.getDataInput().getCrystalShape().getValue())
            self.__strCommandBest = self.__strCommandBest + "-sh " + strCrystalShape + " "

        if(self.getDataInput().getCrystalSusceptibility() is not None):
            strCrystalSusceptibility = str(self.getDataInput().getCrystalSusceptibility().getValue())
            self.__strCommandBest = self.__strCommandBest + "-su " + strCrystalSusceptibility + " "

        if(self.getDataInput().getTransmission() is not None):
            strTransmission = str(self.getDataInput().getTransmission().getValue())
            self.__strCommandBest = self.__strCommandBest + "-Trans " + strTransmission + " "

        if(self.getDataInput().getMinTransmission() is not None):
            strMinTransmission = str(self.getDataInput().getMinTransmission().getValue())
            self.__strCommandBest = self.__strCommandBest + "-TRmin " + strMinTransmission + " "

        if(self.getDataInput().getNumberOfCrystalPositions() is not None):
            iNumberOfCrystalPositions = str(self.getDataInput().getNumberOfCrystalPositions().getValue())
            self.__strCommandBest = self.__strCommandBest + "-Npos " + iNumberOfCrystalPositions + " "

        
        if(self.getDataInput().getDetectorDistanceMin() is not None):
            fDetectorDistanceMin = str(self.getDataInput().getDetectorDistanceMin().getValue())
            self.__strCommandBest = self.__strCommandBest + "-DIS_MIN " + fDetectorDistanceMin + " "

        
        if(self.getDataInput().getDetectorDistanceMax() is not None):
            fDetectorDistanceMax = str(self.getDataInput().getDetectorDistanceMax().getValue())
            self.__strCommandBest = self.__strCommandBest + "-DIS_MAX " + fDetectorDistanceMax + " "

        
        if(self.getDataInput().getAnomalousData() is not None):
            bAnomalousData = self.getDataInput().getAnomalousData().getValue()
            if (bAnomalousData):
                if(self.getDataInput().getCrystalAbsorbedDoseRate() is not None):
                    self.__strCommandBest = self.__strCommandBest + "-asad "
                else:
                    self.__strCommandBest = self.__strCommandBest + "-a "

        strStrategyOption = self.getDataInput().getStrategyOption()
        if(strStrategyOption is not None):
            self.__strCommandBest = self.__strCommandBest + "%s " % strStrategyOption.getValue()

        self.__strCommandBest = self.__strCommandBest + "-T " + str(fMaxExposureTime) + " " + \
                                     "-dna " + self.getScriptBaseName() + "_dnaTables.xml" + " " + \
                                     "-o " + EDUtilsPath.mergePath(self.getWorkingDirectory(), self.getScriptBaseName() + "_plots.mtv ") + \
                                     "-e " + self.getComplexity() + " "
                                     
        if self.getDataInput().getXdsBackgroundImage():
            strPathToXdsBackgroundImage = self.getDataInput().getXdsBackgroundImage().getPath().getValue()
            self.__strCommandBest = self.__strCommandBest + "-MXDS " + self.getFileBestPar() + " " + strPathToXdsBackgroundImage + " " + listFileBestHKLCommand            
        else:
            self.__strCommandBest = self.__strCommandBest + "-mos " + self.getFileBestDat() + " " + self.getFileBestPar() + " " + listFileBestHKLCommand

        self.setScriptCommandline(self.__strCommandBest)
 def __init__(self, _strTestName="EDPluginXDSv1_0"):
     EDTestCasePluginUnit.__init__(self, _strTestName)
     self.m_strReferenceDataInputFile = EDUtilsPath.mergePath(self.getPluginTestsDataHome(), "XSDataInputXDSIndexing_reference.xml")