def generateDataMOSFLMInputIndexing(self):
        """
        """
        from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition
        xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition()
        xsDataMOSFLMBeamPosition.setX(XSDataLength(102.5))
        xsDataMOSFLMBeamPosition.setY(XSDataLength(104.7))

        from XSDataMOSFLMv10 import XSDataMOSFLMDetector
        xsDataMOSFLMDetector = XSDataMOSFLMDetector()
        xsDataMOSFLMDetector.setType(XSDataString("ADSC"))

        from XSDataMOSFLMv10 import XSDataMOSFLMImage
        xsDataMOSFLMImage1 = XSDataMOSFLMImage()
        xsDataMOSFLMImage1.setNumber(XSDataInteger(1))
        xsDataMOSFLMImage1.setRotationAxisStart(XSDataAngle(0.0))
        xsDataMOSFLMImage1.setRotationAxisEnd(XSDataAngle(1.0))

        from XSDataMOSFLMv10 import XSDataMOSFLMImage
        xsDataMOSFLMImage2 = XSDataMOSFLMImage()
        xsDataMOSFLMImage2.setNumber(XSDataInteger(2))
        xsDataMOSFLMImage2.setRotationAxisStart(XSDataAngle(90.0))
        xsDataMOSFLMImage2.setRotationAxisEnd(XSDataAngle(91.0))

        from XSDataMOSFLMv10 import XSDataMOSFLMInputIndexing
        xsDataMOSFLMInputIndexing = XSDataMOSFLMInputIndexing()
        xsDataMOSFLMInputIndexing.setDistance(XSDataLength(198.4))
        xsDataMOSFLMInputIndexing.setWavelength(XSDataWavelength(0.9340))
        xsDataMOSFLMInputIndexing.setBeam(xsDataMOSFLMBeamPosition)
        xsDataMOSFLMInputIndexing.setDetector(xsDataMOSFLMDetector)
        xsDataMOSFLMInputIndexing.setDirectory(XSDataString(self.strDataImagePath))
        xsDataMOSFLMInputIndexing.setTemplate(XSDataString("ref-testscale_1_###.img"))
        xsDataMOSFLMInputIndexing.addImage(xsDataMOSFLMImage1)
        xsDataMOSFLMInputIndexing.addImage(xsDataMOSFLMImage2)

        return xsDataMOSFLMInputIndexing
示例#2
0
    def generateDataMOSFLMInputIndexing(self):
        """
        """
        from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition
        xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition()
        xsDataMOSFLMBeamPosition.setX(XSDataLength(102.5))
        xsDataMOSFLMBeamPosition.setY(XSDataLength(104.7))

        from XSDataMOSFLMv10 import XSDataMOSFLMDetector
        xsDataMOSFLMDetector = XSDataMOSFLMDetector()
        xsDataMOSFLMDetector.setType(XSDataString("ADSC"))

        from XSDataMOSFLMv10 import XSDataMOSFLMImage
        xsDataMOSFLMImage1 = XSDataMOSFLMImage()
        xsDataMOSFLMImage1.setNumber(XSDataInteger(1))
        xsDataMOSFLMImage1.setRotationAxisStart(XSDataAngle(0.0))
        xsDataMOSFLMImage1.setRotationAxisEnd(XSDataAngle(1.0))

        from XSDataMOSFLMv10 import XSDataMOSFLMImage
        xsDataMOSFLMImage2 = XSDataMOSFLMImage()
        xsDataMOSFLMImage2.setNumber(XSDataInteger(2))
        xsDataMOSFLMImage2.setRotationAxisStart(XSDataAngle(90.0))
        xsDataMOSFLMImage2.setRotationAxisEnd(XSDataAngle(91.0))

        from XSDataMOSFLMv10 import XSDataMOSFLMInputIndexing
        xsDataMOSFLMInputIndexing = XSDataMOSFLMInputIndexing()
        xsDataMOSFLMInputIndexing.setDistance(XSDataLength(198.4))
        xsDataMOSFLMInputIndexing.setWavelength(XSDataWavelength(0.9340))
        xsDataMOSFLMInputIndexing.setBeam(xsDataMOSFLMBeamPosition)
        xsDataMOSFLMInputIndexing.setDetector(xsDataMOSFLMDetector)
        xsDataMOSFLMInputIndexing.setDirectory(XSDataString(self.strDataImagePath))
        xsDataMOSFLMInputIndexing.setTemplate(XSDataString("ref-testscale_1_###.img"))
        xsDataMOSFLMInputIndexing.addImage(xsDataMOSFLMImage1)
        xsDataMOSFLMInputIndexing.addImage(xsDataMOSFLMImage2)

        return xsDataMOSFLMInputIndexing
    def generateXSDataMOSFLMInputIndexing(_xsDataIndexingInput):
        """
        Translation from XSDataIndexingInput to XSDataMOSFLMInputIndexing.
        """
        EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
        from XSDataMOSFLMv10 import XSDataMOSFLMInputIndexing
        from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition
        from XSDataMOSFLMv10 import XSDataMOSFLMImage

        EDVerbose.DEBUG(
            "EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing")

        xsDataCollection = _xsDataIndexingInput.getDataCollection()
        xsDataExperimentalCondition = _xsDataIndexingInput.getExperimentalCondition(
        )
        xsDataCrystal = _xsDataIndexingInput.getCrystal()
        xsDataSubWedgeList = xsDataCollection.getSubWedge()
        xsDataMOSFLMInputIndexing = XSDataMOSFLMInputIndexing()

        if (xsDataExperimentalCondition is None):
            xsDataExperimentalCondition = xsDataSubWedgeList[
                0].getExperimentalCondition()

        xsDataBeam = xsDataExperimentalCondition.getBeam()
        xsDataDetector = xsDataExperimentalCondition.getDetector()
        xsDataGoniostat = xsDataExperimentalCondition.getGoniostat()

        dWavelength = xsDataBeam.getWavelength().getValue()
        dDistance = xsDataDetector.getDistance().getValue()
        dBeamPositionX = xsDataDetector.getBeamPositionX().getValue()
        dBeamPositionY = xsDataDetector.getBeamPositionY().getValue()

        xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition()
        xsDataMOSFLMBeamPosition.setX(XSDataLength(dBeamPositionX))
        xsDataMOSFLMBeamPosition.setY(XSDataLength(dBeamPositionY))
        xsDataMOSFLMInputIndexing.setBeam(xsDataMOSFLMBeamPosition)

        xsDataMOSFLMDetector = EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector(
            xsDataDetector)
        xsDataMOSFLMInputIndexing.setDetector(xsDataMOSFLMDetector)

        xsDataMOSFLMInputIndexing.setWavelength(XSDataWavelength(dWavelength))
        xsDataMOSFLMInputIndexing.setDistance(XSDataLength(dDistance))

        xsDataSubWedgeFirst = xsDataSubWedgeList[0]
        xsDataImageFirst = xsDataSubWedgeFirst.getImage()[0]
        strPath = xsDataImageFirst.getPath().getValue()
        strFileName = os.path.basename(strPath)
        strDirectory = os.path.dirname(strPath)

        if xsDataDetector.type.value == "eiger2_16m":
            strMOSFLMTemplate = EDUtilsImage.getH5MasterTemplate(
                strFileName, 1)
        else:
            strMOSFLMTemplate = EDUtilsImage.getTemplate(strFileName, "#")
        xsDataMOSFLMInputIndexing.setTemplate(XSDataString(strMOSFLMTemplate))
        xsDataMOSFLMInputIndexing.setDirectory(XSDataString(strDirectory))

        if (xsDataCrystal is not None):
            xsDataSpaceGroup = xsDataCrystal.getSpaceGroup()
            if (xsDataSpaceGroup is not None):
                xsDataStringName = xsDataSpaceGroup.getName()
                if (xsDataStringName is not None):
                    xsDataMOSFLMInputIndexing.setSymmetry(
                        XSDataString(xsDataStringName.getValue()))

        # Loop through the list of sub wedges

        for xsDataSubWedge in xsDataSubWedgeList:

            xsDataImageList = xsDataSubWedge.getImage()
            xsDataGoniostat = xsDataSubWedge.getExperimentalCondition(
            ).getGoniostat()
            fGonioStatOscillationStart = xsDataGoniostat.getRotationAxisStart(
            ).getValue()
            fGonioStatOscillationRange = xsDataGoniostat.getOscillationWidth(
            ).getValue()

            # First find the lowest image number
            iLowestImageNumber = None
            for xsDataImage in xsDataImageList:
                iImageNumber = xsDataImage.getNumber().getValue()
                if (iLowestImageNumber is None):
                    iLowestImageNumber = iImageNumber
                elif (iImageNumber < iLowestImageNumber):
                    iLowestImageNumber = iImageNumber

            # Loop through the list of images

            for xsDataImage in xsDataImageList:
                # Create the MOSFLM image object

                xsDataMOSFLMImage = XSDataMOSFLMImage()

                iImageNumber = xsDataImage.getNumber().getValue()
                xsDataMOSFLMImage.setNumber(XSDataInteger(iImageNumber))

                fImageOscillationStart = fGonioStatOscillationStart + (
                    iImageNumber -
                    iLowestImageNumber) * fGonioStatOscillationRange
                xsDataMOSFLMImage.setRotationAxisStart(
                    XSDataAngle(fImageOscillationStart))
                xsDataMOSFLMImage.setRotationAxisEnd(
                    XSDataAngle(fImageOscillationStart +
                                fGonioStatOscillationRange))

                xsDataMOSFLMInputIndexing.addImage(xsDataMOSFLMImage)

        return xsDataMOSFLMInputIndexing
    def generateXSDataMOSFLMInputIndexing(_xsDataIndexingInput):
        """
        Translation from XSDataIndexingInput to XSDataMOSFLMInputIndexing.
        """
        EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
        from XSDataMOSFLMv10 import XSDataMOSFLMInputIndexing
        from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition
        from XSDataMOSFLMv10 import XSDataMOSFLMImage

        EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing")

        xsDataCollection = _xsDataIndexingInput.getDataCollection()
        xsDataExperimentalCondition = _xsDataIndexingInput.getExperimentalCondition()
        xsDataCrystal = _xsDataIndexingInput.getCrystal()
        xsDataSubWedgeList = xsDataCollection.getSubWedge()
        xsDataMOSFLMInputIndexing = XSDataMOSFLMInputIndexing()

        if (xsDataExperimentalCondition is None):
            xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition()

        xsDataBeam = xsDataExperimentalCondition.getBeam()
        xsDataDetector = xsDataExperimentalCondition.getDetector()
        xsDataGoniostat = xsDataExperimentalCondition.getGoniostat()

        dWavelength = xsDataBeam.getWavelength().getValue()
        dDistance = xsDataDetector.getDistance().getValue()
        dBeamPositionX = xsDataDetector.getBeamPositionX().getValue()
        dBeamPositionY = xsDataDetector.getBeamPositionY().getValue()

        xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition()
        xsDataMOSFLMBeamPosition.setX(XSDataLength(dBeamPositionX))
        xsDataMOSFLMBeamPosition.setY(XSDataLength(dBeamPositionY))
        xsDataMOSFLMInputIndexing.setBeam(xsDataMOSFLMBeamPosition)

        xsDataMOSFLMDetector = EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector(xsDataDetector)
        xsDataMOSFLMInputIndexing.setDetector(xsDataMOSFLMDetector)

        xsDataMOSFLMInputIndexing.setWavelength(XSDataWavelength(dWavelength))
        xsDataMOSFLMInputIndexing.setDistance(XSDataLength(dDistance))

        xsDataSubWedgeFirst = xsDataSubWedgeList[0]
        xsDataImageFirst = xsDataSubWedgeFirst.getImage()[0]
        strPath = xsDataImageFirst.getPath().getValue()
        strFileName = os.path.basename(strPath)
        strDirectory = os.path.dirname(strPath)

        strMOSFLMTemplate = EDUtilsImage.getTemplate(strFileName, "#")
        xsDataMOSFLMInputIndexing.setTemplate(XSDataString(strMOSFLMTemplate))
        xsDataMOSFLMInputIndexing.setDirectory(XSDataString(strDirectory))

        if (xsDataCrystal is not None):
            xsDataSpaceGroup = xsDataCrystal.getSpaceGroup()
            if (xsDataSpaceGroup is not None):
                xsDataStringName = xsDataSpaceGroup.getName()
                if (xsDataStringName is not None):
                    xsDataMOSFLMInputIndexing.setSymmetry(XSDataString(xsDataStringName.getValue()))

        # Loop through the list of sub wedges 

        for xsDataSubWedge in xsDataSubWedgeList:

            xsDataImageList = xsDataSubWedge.getImage()
            xsDataGoniostat = xsDataSubWedge.getExperimentalCondition().getGoniostat()
            fGonioStatOscillationStart = xsDataGoniostat.getRotationAxisStart().getValue()
            fGonioStatOscillationRange = xsDataGoniostat.getOscillationWidth().getValue()

            # First find the lowest image number
            iLowestImageNumber = None
            for xsDataImage in xsDataImageList:
                iImageNumber = xsDataImage.getNumber().getValue()
                if (iLowestImageNumber is None):
                    iLowestImageNumber = iImageNumber
                elif (iImageNumber < iLowestImageNumber):
                    iLowestImageNumber = iImageNumber

            # Loop through the list of images

            for xsDataImage in xsDataImageList:
                # Create the MOSFLM image object

                xsDataMOSFLMImage = XSDataMOSFLMImage()

                iImageNumber = xsDataImage.getNumber().getValue()
                xsDataMOSFLMImage.setNumber(XSDataInteger(iImageNumber))

                fImageOscillationStart = fGonioStatOscillationStart + (iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange
                xsDataMOSFLMImage.setRotationAxisStart(XSDataAngle(fImageOscillationStart))
                xsDataMOSFLMImage.setRotationAxisEnd(XSDataAngle(fImageOscillationStart + fGonioStatOscillationRange))

                xsDataMOSFLMInputIndexing.addImage(xsDataMOSFLMImage)

        return xsDataMOSFLMInputIndexing