def testSetDataModelInput(self):
        """
        """
        edPluginBest = self.createPlugin()
        xsPluginItemGood01 = self.getPluginConfiguration(os.path.join(self.strDataPath, "XSConfiguration.xml"))
        edPluginBest.setConfiguration(xsPluginItemGood01)
        edPluginBest.setScriptExecutable("cat")
        edPluginBest.configure()

        from XSDataBestv1_1 import XSDataInputBest

        xsDataInputBest = XSDataInputBest()

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

        xsDataInputBest.setCrystalAbsorbedDoseRate(XSDataAbsorbedDoseRate(0.22e06))
        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(True))

        bestFileContentDat = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.dat"))
        xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat))

        bestFileContentPar = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.par"))
        xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar))

        bestFileContentHKL = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile1.hkl"))
        listBestFileContentHKL = []
        listBestFileContentHKL.append(XSDataString(bestFileContentHKL))
        xsDataInputBest.setBestFileContentHKL(listBestFileContentHKL)

        xsDataInputBest.outputFile(self.strObtainedInputFile)

        strExpectedInput = self.readAndParseFile(self.strReferenceInputFile)
        strObtainedInput = self.readAndParseFile(self.strObtainedInputFile)

        xsDataInputExpected = XSDataInputBest.parseString(strExpectedInput)
        xsDataInputObtained = XSDataInputBest.parseString(strObtainedInput)

        EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
        os.remove(self.strObtainedInputFile)

        self.cleanUp(edPluginBest)
    def testGenerateExecutiveSummary(self):
        strInputBest = self.readAndParseFile(self.strReferenceInputFile)
        strResultBest = self.readAndParseFile(self.strReferenceResultFile)

        from XSDataBestv1_1 import XSDataInputBest
        from XSDataBestv1_1 import XSDataResultBest

        xsDataInputBest = XSDataInputBest.parseString(strInputBest)
        xsDataResultBest = XSDataResultBest.parseString(strResultBest)
        edPluginBest = self.createPlugin()
        edPluginBest.setDataInput(xsDataInputBest)
        edPluginBest.setDataOutput(xsDataResultBest)
        edPluginBest.generateExecutiveSummary(edPluginBest)
예제 #3
0
    def testGenerateExecutiveSummary(self):
        strInputBest = self.readAndParseFile(self.strReferenceInputFile)
        strResultBest = self.readAndParseFile(self.strReferenceResultFile)

        from XSDataBestv1_1 import XSDataInputBest
        from XSDataBestv1_1 import XSDataResultBest

        xsDataInputBest = XSDataInputBest.parseString(strInputBest)
        xsDataResultBest = XSDataResultBest.parseString(strResultBest)
        edPluginBest = self.createPlugin()
        edPluginBest.setDataInput(xsDataInputBest)
        edPluginBest.setDataOutput(xsDataResultBest)
        edPluginBest.generateExecutiveSummary(edPluginBest)
예제 #4
0
 def setDataInput( self, _dataInput ):
     """
     Sets the Plugin Input Data
     _dataInput could be either an String XML or an XSData
     The XML String should be parsed as an Output Object by the final Plugin
     """
     self.DEBUG( "EDPluginSTACv10Alignment.setDataInput" )
     # Check the type
     if( isinstance( _dataInput, EDString ) ):
         self.DEBUG( "EDPluginSTACv10.setDataInput: Input Data is of EDString " )
         self.m_xsDataInput = XSDataInputBest.parseString( _dataInput )
     elif ( isinstance( _dataInput, XSDataInputBest ) ):
         self.m_xsDataInput = _dataInput
     else:
         errorMessage = EDMessage.ERROR_WRONG_DATA_TYPE_02 % ('EDPluginSTACv10.setDataInput', "XMLString or XSDataBestv01Input expected" )
         self.error( errorMessage )
         self.addErrorMessage( errorMessage )  
         raise RuntimeError, errorMessage
예제 #5
0
 def setDataInput(self, _dataInput):
     """
     Sets the Plugin Input Data
     _dataInput could be either an String XML or an XSData
     The XML String should be parsed as an Output Object by the final Plugin
     """
     self.DEBUG("EDPluginSTACv10Alignment.setDataInput")
     # Check the type
     if (isinstance(_dataInput, EDString)):
         self.DEBUG(
             "EDPluginSTACv10.setDataInput: Input Data is of EDString ")
         self.m_xsDataInput = XSDataInputBest.parseString(_dataInput)
     elif (isinstance(_dataInput, XSDataInputBest)):
         self.m_xsDataInput = _dataInput
     else:
         errorMessage = EDMessage.ERROR_WRONG_DATA_TYPE_02 % (
             'EDPluginSTACv10.setDataInput',
             "XMLString or XSDataBestv01Input expected")
         self.error(errorMessage)
         self.addErrorMessage(errorMessage)
         raise RuntimeError, errorMessage
예제 #6
0
    def testSetDataModelInput(self):
        """
        """
        edPluginBest = self.createPlugin()
        xsPluginItemGood01 = self.getPluginConfiguration(
            os.path.join(self.strDataPath, "XSConfiguration.xml"))
        edPluginBest.setConfiguration(xsPluginItemGood01)
        edPluginBest.setScriptExecutable("cat")
        edPluginBest.configure()

        from XSDataBestv1_1 import XSDataInputBest
        xsDataInputBest = XSDataInputBest()

        from XSDataCommon import XSDataAbsorbedDoseRate
        from XSDataCommon import XSDataDouble
        from XSDataCommon import XSDataTime
        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(True))

        bestFileContentDat = EDUtilsFile.readFile(
            os.path.join(self.strDataPath, "bestfile.dat"))
        xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat))

        bestFileContentPar = EDUtilsFile.readFile(
            os.path.join(self.strDataPath, "bestfile.par"))
        xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar))

        bestFileContentHKL = EDUtilsFile.readFile(
            os.path.join(self.strDataPath, "bestfile1.hkl"))
        listBestFileContentHKL = []
        listBestFileContentHKL.append(XSDataString(bestFileContentHKL))
        xsDataInputBest.setBestFileContentHKL(listBestFileContentHKL)

        xsDataInputBest.outputFile(self.strObtainedInputFile)

        strExpectedInput = self.readAndParseFile(self.strReferenceInputFile)
        strObtainedInput = self.readAndParseFile(self.strObtainedInputFile)

        xsDataInputExpected = XSDataInputBest.parseString(strExpectedInput)
        xsDataInputObtained = XSDataInputBest.parseString(strObtainedInput)

        EDAssert.equal(xsDataInputExpected.marshal(),
                       xsDataInputObtained.marshal())
        os.remove(self.strObtainedInputFile)

        self.cleanUp(edPluginBest)