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)
    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)
 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
Example #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
    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 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)
    def getXSDataInputBest(self, _xsDataBeam, _xsDataSample, _xsDataDetector, _xsDataGoniostat, _xsDataDiffractionPlan,
                               _edStrBestFileContentDat, _edStrBestFileContentPar, _edListBestFileContentHKL):
        """
        """
        xsDataInputBest = XSDataInputBest()

        # Sample      
        xdDataAbsorbedDose = None
        xsDataSusceptibility = None

        # Could be None if sample has not been set
        # It could be not None in case Raddose has calculated an absorbed dose with default sample values
        if(_xsDataSample is not None):
            xdDataAbsorbedDose = _xsDataSample.getAbsorbedDoseRate()
            xsDataSusceptibility = _xsDataSample.getSusceptibility()

        # Could be None if Raddose failed to calculate the absorbed dose
        if(xdDataAbsorbedDose is not None):
            xsDataInputBest.setCrystalAbsorbedDoseRate(_xsDataSample.getAbsorbedDoseRate())

        xsDataInputBest.setCrystalSusceptibility(xsDataSusceptibility)

        # crystalShape
        # Default value is 1 (We assume that Xtal is smaller than beam)
        xsDataFloatCrystalShape = _xsDataSample.getShape()
        if(xsDataFloatCrystalShape is None):
            xsDataInputBest.setCrystalShape(XSDataFloat(1))
        else:
            xsDataInputBest.setCrystalShape(xsDataFloatCrystalShape)

        # Detector
        xsDataInputBest.setDetectorType(_xsDataDetector.getType())

        # Beam
        xsDataInputBest.setBeamExposureTime(_xsDataBeam.getExposureTime())
        xsDataInputBest.setBeamMinExposureTime(_xsDataBeam.getMinExposureTimePerImage())

        # Goniostat
        xsDataInputBest.setGoniostatMaxRotationSpeed(_xsDataGoniostat.getMaxOscillationSpeed())
        xsDataInputBest.setGoniostatMinRotationWidth(_xsDataGoniostat.getMinOscillationWidth())

        # Diffraction plan
        xsDataInputBest.setAimedResolution(_xsDataDiffractionPlan.getAimedResolution())
        xsDataInputBest.setAimedRedundancy(_xsDataDiffractionPlan.getAimedMultiplicity())
        xsDataInputBest.setAimedCompleteness(_xsDataDiffractionPlan.getAimedCompleteness())
        xsDataInputBest.setAimedIOverSigma(_xsDataDiffractionPlan.getAimedIOverSigmaAtHighestResolution())
        xsDataInputBest.setBeamMaxExposureTime(_xsDataDiffractionPlan.getMaxExposureTimePerDataCollection())
        xsDataInputBest.setComplexity(_xsDataDiffractionPlan.getComplexity())
        xsDataInputBest.setAnomalousData(_xsDataDiffractionPlan.getAnomalousData())

        # Best Files
        xsDataInputBest.setBestFileContentDat(_edStrBestFileContentDat)
        xsDataInputBest.setBestFileContentPar(_edStrBestFileContentPar)
        xsDataInputBest.setBestFileContentHKL(_edListBestFileContentHKL)

        return xsDataInputBest
Example #8
0
    def getXSDataInputBest(self, _xsDataBeam, _xsDataSample, _xsDataDetector,
                           _xsDataGoniostat, _xsDataDiffractionPlan,
                           _edStrBestFileContentDat, _edStrBestFileContentPar,
                           _edListBestFileContentHKL):
        """
        """
        xsDataInputBest = XSDataInputBest()

        # Sample
        xdDataAbsorbedDose = None
        xsDataSusceptibility = None

        # Could be None if sample has not been set
        # It could be not None in case Raddose has calculated an absorbed dose with default sample values
        if (_xsDataSample is not None):
            xdDataAbsorbedDose = _xsDataSample.getAbsorbedDoseRate()
            xsDataSusceptibility = _xsDataSample.getSusceptibility()

        # Could be None if Raddose failed to calculate the absorbed dose
        if (xdDataAbsorbedDose is not None):
            xsDataInputBest.setCrystalAbsorbedDoseRate(
                _xsDataSample.getAbsorbedDoseRate())

        xsDataInputBest.setCrystalSusceptibility(xsDataSusceptibility)

        # crystalShape
        # Default value is 1 (We assume that Xtal is smaller than beam)
        xsDataFloatCrystalShape = _xsDataSample.getShape()
        if (xsDataFloatCrystalShape is None):
            xsDataInputBest.setCrystalShape(XSDataFloat(1))
        else:
            xsDataInputBest.setCrystalShape(xsDataFloatCrystalShape)

        # Detector
        xsDataInputBest.setDetectorType(_xsDataDetector.getType())

        # Beam
        xsDataInputBest.setBeamExposureTime(_xsDataBeam.getExposureTime())
        xsDataInputBest.setBeamMinExposureTime(
            _xsDataBeam.getMinExposureTimePerImage())

        # Goniostat
        xsDataInputBest.setGoniostatMaxRotationSpeed(
            _xsDataGoniostat.getMaxOscillationSpeed())
        xsDataInputBest.setGoniostatMinRotationWidth(
            _xsDataGoniostat.getMinOscillationWidth())

        # Diffraction plan
        xsDataInputBest.setAimedResolution(
            _xsDataDiffractionPlan.getAimedResolution())
        xsDataInputBest.setAimedRedundancy(
            _xsDataDiffractionPlan.getAimedMultiplicity())
        xsDataInputBest.setAimedCompleteness(
            _xsDataDiffractionPlan.getAimedCompleteness())
        xsDataInputBest.setAimedIOverSigma(
            _xsDataDiffractionPlan.getAimedIOverSigmaAtHighestResolution())
        xsDataInputBest.setBeamMaxExposureTime(
            _xsDataDiffractionPlan.getMaxExposureTimePerDataCollection())
        xsDataInputBest.setComplexity(_xsDataDiffractionPlan.getComplexity())
        xsDataInputBest.setAnomalousData(
            _xsDataDiffractionPlan.getAnomalousData())

        # Best Files
        xsDataInputBest.setBestFileContentDat(_edStrBestFileContentDat)
        xsDataInputBest.setBestFileContentPar(_edStrBestFileContentPar)
        xsDataInputBest.setBestFileContentHKL(_edListBestFileContentHKL)

        return xsDataInputBest