def testGenerateExecutiveSummary(self):
     pluginIntegration = self.createPlugin()
     pluginIntegration.setScriptExecutable("cat")
     pluginIntegration.configure()
     from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
     strMOSFLMInputIntegrationXML = self.readAndParseFile(self.strReferenceDataInputFile)
     strMOSFLMOutputIntegrationXML = self.readAndParseFile(self.strReferenceDataOutputFile)
     xsDataMOSFLMInputIntegration = XSDataMOSFLMInputIntegration.parseString(strMOSFLMInputIntegrationXML)
     xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(strMOSFLMOutputIntegrationXML)
     pluginIntegration.setDataInput(xsDataMOSFLMInputIntegration)
     pluginIntegration.setDataOutput(xsDataMOSFLMOutputIntegration)
     pluginIntegration.generateExecutiveSummary(pluginIntegration)
     pluginIntegration.verboseScreenExecutiveSummary()
     self.cleanUp(pluginIntegration)
 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())
Пример #3
0
 def testGenerateExecutiveSummary(self):
     pluginIntegration = self.createPlugin()
     pluginIntegration.setScriptExecutable("cat")
     pluginIntegration.configure()
     from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
     strMOSFLMInputIntegrationXML = self.readAndParseFile(
         self.strReferenceDataInputFile)
     strMOSFLMOutputIntegrationXML = self.readAndParseFile(
         self.strReferenceDataOutputFile)
     xsDataMOSFLMInputIntegration = XSDataMOSFLMInputIntegration.parseString(
         strMOSFLMInputIntegrationXML)
     xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(
         strMOSFLMOutputIntegrationXML)
     pluginIntegration.setDataInput(xsDataMOSFLMInputIntegration)
     pluginIntegration.setDataOutput(xsDataMOSFLMOutputIntegration)
     pluginIntegration.generateExecutiveSummary(pluginIntegration)
     pluginIntegration.verboseScreenExecutiveSummary()
     self.cleanUp(pluginIntegration)
Пример #4
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())
    def generateXSDataMOSFLMInputIntegration(_xsDataIntegrationInput):
        """
        Translation from XSDataIntegrationInput to XSDataMOSFLMInputIntegration.
        """
        EDVerbose.DEBUG(
            "EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration")
        EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
        from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition
        from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
        from XSDataMOSFLMv10 import XSDataMOSFLMNewmat
        from XSDataMOSFLMv10 import XSDataMOSFLMMissettingsAngles
        xsDataCrystalRefined = _xsDataIntegrationInput.getCrystalRefined()
        xsDataIndexingSolutionSelected = _xsDataIntegrationInput.getSelectedIndexingSolution(
        )

        if (xsDataCrystalRefined is None):
            xsDataCrystalRefined = xsDataIndexingSolutionSelected.getCrystal()

        xsDataCollection = _xsDataIntegrationInput.getDataCollection()
        xsDataSubWedge = xsDataCollection.getSubWedge()[0]
        xsDataImageList = xsDataSubWedge.getImage()
        xsDataImageFirst = xsDataImageList[0]
        xsDataGoniostat = xsDataSubWedge.getExperimentalCondition(
        ).getGoniostat()

        xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal()
        xsDataOrientation = xsDataIndexingSolutionSelected.getOrientation()
        xsDataExperimentalCondition = xsDataIndexingSolutionSelected.getExperimentalConditionRefined(
        )
        xsDataDetector = xsDataExperimentalCondition.getDetector()
        xsDataBeam = xsDataExperimentalCondition.getBeam()
        xsDataMatrixA = xsDataOrientation.getMatrixA()
        xsDataMatrixU = xsDataOrientation.getMatrixU()
        xsDataCell = xsDataCrystal.getCell()

        xsDataMOSFLMInputIntegration = XSDataMOSFLMInputIntegration()
        xsDataMOSFLMNewmat = XSDataMOSFLMNewmat()
        xsDataMOSFLMNewmat.setRefinedCell(xsDataCell)
        xsDataMOSFLMNewmat.setAMatrix(xsDataMatrixA)
        xsDataMOSFLMNewmat.setUMatrix(xsDataMatrixU)
        xsDataMOSFLMInputIntegration.setMatrix(xsDataMOSFLMNewmat)

        xsDataMOSFLMMissettingsAngles = XSDataMOSFLMMissettingsAngles()
        xsDataMOSFLMMissettingsAngles.setPhix(XSDataAngle(0.0))
        xsDataMOSFLMMissettingsAngles.setPhiy(XSDataAngle(0.0))
        xsDataMOSFLMMissettingsAngles.setPhiz(XSDataAngle(0.0))
        xsDataMOSFLMNewmat.setMissettingAngles(xsDataMOSFLMMissettingsAngles)

        xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition()
        xsDataMOSFLMBeamPosition.setX(xsDataDetector.getBeamPositionX())
        xsDataMOSFLMBeamPosition.setY(xsDataDetector.getBeamPositionY())
        xsDataMOSFLMInputIntegration.setBeam(xsDataMOSFLMBeamPosition)

        xsDataMOSFLMInputIntegration.setMosaicity(xsDataCrystal.getMosaicity())
        xsDataMOSFLMInputIntegration.setSymmetry(
            xsDataCrystal.getSpaceGroup().getName())

        strPathFirst = xsDataImageFirst.getPath().getValue()
        strDirectoryFirst = os.path.dirname(strPathFirst)
        strFilenameFirst = os.path.basename(strPathFirst)
        fOscillationRange = xsDataGoniostat.getOscillationWidth().getValue()

        xsDataMOSFLMInputIntegration.setWavelength(xsDataBeam.getWavelength())
        xsDataMOSFLMInputIntegration.setDistance(xsDataDetector.getDistance())
        xsDataMOSFLMInputIntegration.setDirectory(
            XSDataString(strDirectoryFirst))
        xsDataMOSFLMInputIntegration.setOscillationWidth(
            XSDataAngle(fOscillationRange))
        xsDataMOSFLMDetector = EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector(
            xsDataDetector)
        xsDataMOSFLMInputIntegration.setDetector(xsDataMOSFLMDetector)

        iImageStart = None
        iImageEnd = None
        for xsDataImage in xsDataImageList:
            iImageNumber = xsDataImage.getNumber().getValue()
            if (iImageStart is None):
                iImageStart = iImageNumber
            elif (iImageStart > iImageNumber):
                iImageStart = iImageNumber
            if (iImageEnd is None):
                iImageEnd = iImageNumber
            elif (iImageEnd < iImageNumber):
                iImageEnd = iImageNumber

        if xsDataDetector.type.value == "eiger2_16m":
            strMOSFLMTemplate = EDUtilsImage.getH5MasterTemplate(
                strFilenameFirst, iImageStart)
        else:
            strMOSFLMTemplate = EDUtilsImage.getTemplate(strFilenameFirst, "#")

        xsDataMOSFLMInputIntegration.setTemplate(
            XSDataString(strMOSFLMTemplate))
        xsDataMOSFLMInputIntegration.setImageStart(XSDataInteger(iImageStart))
        xsDataMOSFLMInputIntegration.setImageEnd(XSDataInteger(iImageEnd))
        xsDataMOSFLMInputIntegration.setRotationAxisStart(
            xsDataGoniostat.getRotationAxisStart())

        # print xsDataMOSFLMInputIntegration.marshal()

        return xsDataMOSFLMInputIntegration
    def generateXSDataMOSFLMInputIntegration(_xsDataIntegrationInput):
        """
        Translation from XSDataIntegrationInput to XSDataMOSFLMInputIntegration.
        """
        EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration")
        EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
        from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition
        from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
        from XSDataMOSFLMv10 import XSDataMOSFLMNewmat
        from XSDataMOSFLMv10 import XSDataMOSFLMMissettingsAngles
        xsDataCrystalRefined = _xsDataIntegrationInput.getCrystalRefined()
        xsDataIndexingSolutionSelected = _xsDataIntegrationInput.getSelectedIndexingSolution()

        if (xsDataCrystalRefined is None):
            xsDataCrystalRefined = xsDataIndexingSolutionSelected.getCrystal()

        xsDataCollection = _xsDataIntegrationInput.getDataCollection()
        xsDataSubWedge = xsDataCollection.getSubWedge()[0]
        xsDataImageList = xsDataSubWedge.getImage()
        xsDataImageFirst = xsDataImageList[0]
        xsDataGoniostat = xsDataSubWedge.getExperimentalCondition().getGoniostat()

        xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal()
        xsDataOrientation = xsDataIndexingSolutionSelected.getOrientation()
        xsDataExperimentalCondition = xsDataIndexingSolutionSelected.getExperimentalConditionRefined()
        xsDataDetector = xsDataExperimentalCondition.getDetector()
        xsDataBeam = xsDataExperimentalCondition.getBeam()
        xsDataMatrixA = xsDataOrientation.getMatrixA()
        xsDataMatrixU = xsDataOrientation.getMatrixU()
        xsDataCell = xsDataCrystal.getCell()

        xsDataMOSFLMInputIntegration = XSDataMOSFLMInputIntegration()
        xsDataMOSFLMNewmat = XSDataMOSFLMNewmat()
        xsDataMOSFLMNewmat.setRefinedCell(xsDataCell)
        xsDataMOSFLMNewmat.setAMatrix(xsDataMatrixA)
        xsDataMOSFLMNewmat.setUMatrix(xsDataMatrixU)
        xsDataMOSFLMInputIntegration.setMatrix(xsDataMOSFLMNewmat)

        xsDataMOSFLMMissettingsAngles = XSDataMOSFLMMissettingsAngles()
        xsDataMOSFLMMissettingsAngles.setPhix(XSDataAngle(0.0))
        xsDataMOSFLMMissettingsAngles.setPhiy(XSDataAngle(0.0))
        xsDataMOSFLMMissettingsAngles.setPhiz(XSDataAngle(0.0))
        xsDataMOSFLMNewmat.setMissettingAngles(xsDataMOSFLMMissettingsAngles)

        xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition()
        xsDataMOSFLMBeamPosition.setX(xsDataDetector.getBeamPositionX())
        xsDataMOSFLMBeamPosition.setY(xsDataDetector.getBeamPositionY())
        xsDataMOSFLMInputIntegration.setBeam(xsDataMOSFLMBeamPosition)

        xsDataMOSFLMInputIntegration.setMosaicity(xsDataCrystal.getMosaicity())
        xsDataMOSFLMInputIntegration.setSymmetry(xsDataCrystal.getSpaceGroup().getName())

        strPathFirst = xsDataImageFirst.getPath().getValue()
        strDirectoryFirst = os.path.dirname(strPathFirst)
        strFilenameFirst = os.path.basename(strPathFirst)
        fOscillationRange = xsDataGoniostat.getOscillationWidth().getValue()

        xsDataMOSFLMInputIntegration.setWavelength(xsDataBeam.getWavelength())
        xsDataMOSFLMInputIntegration.setDistance(xsDataDetector.getDistance())
        xsDataMOSFLMInputIntegration.setDirectory(XSDataString(strDirectoryFirst))
        xsDataMOSFLMInputIntegration.setOscillationWidth(XSDataAngle(fOscillationRange))
        xsDataMOSFLMDetector = EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector(xsDataDetector)
        xsDataMOSFLMInputIntegration.setDetector(xsDataMOSFLMDetector)

        strMOSFLMTemplate = EDUtilsImage.getTemplate(strFilenameFirst, "#")
        xsDataMOSFLMInputIntegration.setTemplate(XSDataString(strMOSFLMTemplate))

        iImageStart = None
        iImageEnd = None
        for xsDataImage in xsDataImageList:
            iImageNumber = xsDataImage.getNumber().getValue()
            if (iImageStart is None):
                iImageStart = iImageNumber
            elif (iImageStart > iImageNumber):
                iImageStart = iImageNumber
            if (iImageEnd is None):
                iImageEnd = iImageNumber
            elif (iImageEnd < iImageNumber):
                iImageEnd = iImageNumber

        xsDataMOSFLMInputIntegration.setImageStart(XSDataInteger(iImageStart))
        xsDataMOSFLMInputIntegration.setImageEnd(XSDataInteger(iImageEnd))
        xsDataMOSFLMInputIntegration.setRotationAxisStart(xsDataGoniostat.getRotationAxisStart())

        #print xsDataMOSFLMInputIntegration.marshal()

        return xsDataMOSFLMInputIntegration