def testGenerateXSDataIntegrationSubWedgeResult(self):
     strFilename = "XSDataMOSFLMOutputIntegration_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLMOSFLMOutputIntegration = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMOSFLMv10 import XSDataMOSFLMOutputIntegration
     xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(strXMLMOSFLMOutputIntegration)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult(xsDataMOSFLMOutputIntegration)
     strReferenceFilename = "XSDataIntegrationSubWedgeResult_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename)
     strXMLIntegrationSubWedgeReference = EDUtilsTest.readAndParseFile(strReferencePath)
     from XSDataMXv1 import XSDataIntegrationSubWedgeResult
     xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult.parseString(strXMLIntegrationSubWedgeReference)
     EDAssert.equal(xsDataIntegrationSubWedgeResult.marshal(), xsDataIntegrationSubWedgeResult.marshal())
Exemple #2
0
 def testGenerateXSDataIntegrationSubWedgeResult(self):
     strFilename = "XSDataMOSFLMOutputIntegration_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLMOSFLMOutputIntegration = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMOSFLMv10 import XSDataMOSFLMOutputIntegration
     xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(
         strXMLMOSFLMOutputIntegration)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult(
         xsDataMOSFLMOutputIntegration)
     strReferenceFilename = "XSDataIntegrationSubWedgeResult_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath,
                                     strReferenceFilename)
     strXMLIntegrationSubWedgeReference = EDUtilsTest.readAndParseFile(
         strReferencePath)
     from XSDataMXv1 import XSDataIntegrationSubWedgeResult
     xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult.parseString(
         strXMLIntegrationSubWedgeReference)
     EDAssert.equal(xsDataIntegrationSubWedgeResult.marshal(),
                    xsDataIntegrationSubWedgeResult.marshal())
    def generateXSDataIntegrationSubWedgeResult(
            _xsDataMOSFLMOutputIntegration, _xsDataExperimentalCondition=None):
        """
        Translation from XSDataMOSFLMOutputIntegration to XSDataIntegrationSubWedgeResult.
        """
        EDVerbose.DEBUG(
            "EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationInput")
        EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
        xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult()
        xsDataExperimentalConditionRefined = None
        if (_xsDataExperimentalCondition is None):
            xsDataExperimentalConditionRefined = XSDataExperimentalCondition()
        else:
            # Copy the incoming experimental condition
            xmlExperimentalCondition = _xsDataExperimentalCondition.marshal()
            xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(
                xmlExperimentalCondition)

        xsDataDetector = xsDataExperimentalConditionRefined.getDetector()
        if (xsDataDetector is None):
            xsDataDetector = XSDataDetector()

        if _xsDataMOSFLMOutputIntegration.getBestfilePar() is not None:
            xsDataIntegrationSubWedgeResult.setBestfilePar(
                XSDataString(_xsDataMOSFLMOutputIntegration.getBestfilePar().
                             getValue()))
            xsDataIntegrationSubWedgeResult.setBestfileDat(
                XSDataString(_xsDataMOSFLMOutputIntegration.getBestfileDat().
                             getValue()))
            xsDataIntegrationSubWedgeResult.setBestfileHKL(
                XSDataString(_xsDataMOSFLMOutputIntegration.getBestfileHKL().
                             getValue()))

        xsDataLengthRefinedDistance = _xsDataMOSFLMOutputIntegration.getRefinedDistance(
        )
        if (xsDataLengthRefinedDistance is not None):
            xsDataDetector.setDistance(xsDataLengthRefinedDistance)

        xsDataMOSFLMBeamPositionRefined = _xsDataMOSFLMOutputIntegration.getRefinedBeam(
        )
        if (xsDataMOSFLMBeamPositionRefined is not None):
            xsDataDetector.setBeamPositionX(
                XSDataLength(
                    xsDataMOSFLMBeamPositionRefined.getX().getValue()))
            xsDataDetector.setBeamPositionY(
                XSDataLength(
                    xsDataMOSFLMBeamPositionRefined.getY().getValue()))

        xsDataExperimentalConditionRefined.setDetector(xsDataDetector)
        xsDataIntegrationSubWedgeResult.setExperimentalConditionRefined(
            xsDataExperimentalConditionRefined)

        if (_xsDataMOSFLMOutputIntegration.getGeneratedMTZFile() is not None):
            xsDataIntegrationSubWedgeResult.setGeneratedMTZFile(
                _xsDataMOSFLMOutputIntegration.getGeneratedMTZFile())

        xsDataStatisticsIntegration = XSDataStatisticsIntegration()
        if (_xsDataMOSFLMOutputIntegration.getOverallIOverSigma() is not None):
            xsDataStatisticsIntegration.setIOverSigmaOverall(
                XSDataDouble(_xsDataMOSFLMOutputIntegration.
                             getOverallIOverSigma().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getHighestResolutionIOverSigma()
                is not None):
            xsDataStatisticsIntegration.setIOverSigmaAtHighestResolution(
                XSDataDouble(_xsDataMOSFLMOutputIntegration.
                             getHighestResolutionIOverSigma().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getRMSSpotDeviation() is not None):
            xsDataStatisticsIntegration.setRMSSpotDeviation(
                XSDataLength(_xsDataMOSFLMOutputIntegration.
                             getRMSSpotDeviation().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfBadReflections()
                is not None):
            xsDataStatisticsIntegration.setNumberOfBadReflections(
                XSDataInteger(_xsDataMOSFLMOutputIntegration.
                              getNumberOfBadReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfFullyRecordedReflections(
        ) is not None):
            xsDataStatisticsIntegration.setNumberOfFullyRecordedReflections(
                XSDataInteger(
                    _xsDataMOSFLMOutputIntegration.
                    getNumberOfFullyRecordedReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfNegativeReflections()
                is not None):
            xsDataStatisticsIntegration.setNumberOfNegativeReflections(
                XSDataInteger(_xsDataMOSFLMOutputIntegration.
                              getNumberOfNegativeReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfOverlappedReflections()
                is not None):
            xsDataStatisticsIntegration.setNumberOfOverlappedReflections(
                XSDataInteger(_xsDataMOSFLMOutputIntegration.
                              getNumberOfOverlappedReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfPartialReflections()
                is not None):
            xsDataStatisticsIntegration.setNumberOfPartialReflections(
                XSDataInteger(_xsDataMOSFLMOutputIntegration.
                              getNumberOfPartialReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfReflectionsGenerated()
                is not None):
            xsDataStatisticsIntegration.setNumberOfReflectionsGenerated(
                XSDataInteger(_xsDataMOSFLMOutputIntegration.
                              getNumberOfReflectionsGenerated().getValue()))

        xsDataIntegrationSubWedgeResult.setStatistics(
            xsDataStatisticsIntegration)
        xsDataIntegrationSubWedgeResult.setExperimentalConditionRefined(
            xsDataExperimentalConditionRefined)

        for xsDataMOSFLMIntegrationStatisticsPerResolutionBin in _xsDataMOSFLMOutputIntegration.getStatisticsPerResolutionBin(
        ):
            xsDataStatisticsIntegrationPerResolutionBin = XSDataStatisticsIntegrationPerResolutionBin(
            )
            if (xsDataMOSFLMIntegrationStatisticsPerResolutionBin.
                    getMaxResolution() is not None):
                xsDataStatisticsIntegrationPerResolutionBin.setMaxResolution(
                    XSDataDouble(
                        xsDataMOSFLMIntegrationStatisticsPerResolutionBin.
                        getMaxResolution().getValue()))
            if (xsDataMOSFLMIntegrationStatisticsPerResolutionBin.
                    getMinResolution() is not None):
                xsDataStatisticsIntegrationPerResolutionBin.setMinResolution(
                    XSDataDouble(
                        xsDataMOSFLMIntegrationStatisticsPerResolutionBin.
                        getMinResolution().getValue()))

            xsDataStatisticsIntegrationPerResolutionBin.setProfileFitted(
                EDHandlerXSDataMOSFLMv10.
                generateXSDataIntegrationStatisticsPerReflectionType(
                    xsDataMOSFLMIntegrationStatisticsPerResolutionBin.
                    getProfileFitted()))
            xsDataStatisticsIntegrationPerResolutionBin.setSummation(
                EDHandlerXSDataMOSFLMv10.
                generateXSDataIntegrationStatisticsPerReflectionType(
                    xsDataMOSFLMIntegrationStatisticsPerResolutionBin.
                    getSummation()))

            xsDataIntegrationSubWedgeResult.addStatisticsPerResolutionBin(
                xsDataStatisticsIntegrationPerResolutionBin)

        xsDataIntegrationSubWedgeResult.setIntegrationLogFile(
            _xsDataMOSFLMOutputIntegration.getPathToLogFile())

        return xsDataIntegrationSubWedgeResult
    def generateXSDataIntegrationSubWedgeResult(_xsDataMOSFLMOutputIntegration, _xsDataExperimentalCondition=None):
        """
        Translation from XSDataMOSFLMOutputIntegration to XSDataIntegrationSubWedgeResult.
        """
        EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationInput")
        EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
        xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult()
        xsDataExperimentalConditionRefined = None
        if (_xsDataExperimentalCondition is None):
            xsDataExperimentalConditionRefined = XSDataExperimentalCondition()
        else:
            # Copy the incoming experimental condition
            xmlExperimentalCondition = _xsDataExperimentalCondition.marshal()
            xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition)

        xsDataDetector = xsDataExperimentalConditionRefined.getDetector()
        if (xsDataDetector is None):
            xsDataDetector = XSDataDetector()

        xsDataIntegrationSubWedgeResult.setBestfilePar(XSDataString(_xsDataMOSFLMOutputIntegration.getBestfilePar().getValue()))
        xsDataIntegrationSubWedgeResult.setBestfileDat(XSDataString(_xsDataMOSFLMOutputIntegration.getBestfileDat().getValue()))
        xsDataIntegrationSubWedgeResult.setBestfileHKL(XSDataString(_xsDataMOSFLMOutputIntegration.getBestfileHKL().getValue()))

        xsDataLengthRefinedDistance = _xsDataMOSFLMOutputIntegration.getRefinedDistance()
        if (xsDataLengthRefinedDistance is not None):
            xsDataDetector.setDistance(xsDataLengthRefinedDistance)

        xsDataMOSFLMBeamPositionRefined = _xsDataMOSFLMOutputIntegration.getRefinedBeam()
        if (xsDataMOSFLMBeamPositionRefined is not None):
            xsDataDetector.setBeamPositionX(XSDataLength(xsDataMOSFLMBeamPositionRefined.getX().getValue()))
            xsDataDetector.setBeamPositionY(XSDataLength(xsDataMOSFLMBeamPositionRefined.getY().getValue()))

        xsDataExperimentalConditionRefined.setDetector(xsDataDetector)
        xsDataIntegrationSubWedgeResult.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)

        if (_xsDataMOSFLMOutputIntegration.getGeneratedMTZFile() is not None):
            xsDataIntegrationSubWedgeResult.setGeneratedMTZFile(_xsDataMOSFLMOutputIntegration.getGeneratedMTZFile())

        xsDataStatisticsIntegration = XSDataStatisticsIntegration()
        if (_xsDataMOSFLMOutputIntegration.getOverallIOverSigma() is not None):
            xsDataStatisticsIntegration.setIOverSigmaOverall(XSDataDouble(_xsDataMOSFLMOutputIntegration.getOverallIOverSigma().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getHighestResolutionIOverSigma() is not None):
            xsDataStatisticsIntegration.setIOverSigmaAtHighestResolution(XSDataDouble(_xsDataMOSFLMOutputIntegration.getHighestResolutionIOverSigma().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getRMSSpotDeviation() is not None):
            xsDataStatisticsIntegration.setRMSSpotDeviation(XSDataLength(_xsDataMOSFLMOutputIntegration.getRMSSpotDeviation().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfBadReflections() is not None):
            xsDataStatisticsIntegration.setNumberOfBadReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfBadReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfFullyRecordedReflections() is not None):
            xsDataStatisticsIntegration.setNumberOfFullyRecordedReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfFullyRecordedReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfNegativeReflections() is not None):
            xsDataStatisticsIntegration.setNumberOfNegativeReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfNegativeReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfOverlappedReflections() is not None):
            xsDataStatisticsIntegration.setNumberOfOverlappedReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfOverlappedReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfPartialReflections() is not None):
            xsDataStatisticsIntegration.setNumberOfPartialReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfPartialReflections().getValue()))
        if (_xsDataMOSFLMOutputIntegration.getNumberOfReflectionsGenerated() is not None):
            xsDataStatisticsIntegration.setNumberOfReflectionsGenerated(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfReflectionsGenerated().getValue()))

        xsDataIntegrationSubWedgeResult.setStatistics(xsDataStatisticsIntegration)
        xsDataIntegrationSubWedgeResult.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)

        for xsDataMOSFLMIntegrationStatisticsPerResolutionBin in _xsDataMOSFLMOutputIntegration.getStatisticsPerResolutionBin():
            xsDataStatisticsIntegrationPerResolutionBin = XSDataStatisticsIntegrationPerResolutionBin()
            if (xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMaxResolution() is not None):
                xsDataStatisticsIntegrationPerResolutionBin.setMaxResolution(XSDataDouble(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMaxResolution().getValue()))
            if (xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMinResolution() is not None):
                xsDataStatisticsIntegrationPerResolutionBin.setMinResolution(XSDataDouble(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMinResolution().getValue()))

            xsDataStatisticsIntegrationPerResolutionBin.setProfileFitted(EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationStatisticsPerReflectionType(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getProfileFitted()))
            xsDataStatisticsIntegrationPerResolutionBin.setSummation(EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationStatisticsPerReflectionType(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getSummation()))

            xsDataIntegrationSubWedgeResult.addStatisticsPerResolutionBin(xsDataStatisticsIntegrationPerResolutionBin)

        return xsDataIntegrationSubWedgeResult