コード例 #1
0
 def testRasterConfiguration(self):
     strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome,
                                            "XSConfiguration_raster.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(self.getPluginName())
     xsDataMOSFLMInput = XSDataMOSFLMInput()
     xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
     xsDataMOSFLMBeam.setX(XSDataLength(1.0))
     xsDataMOSFLMBeam.setY(XSDataLength(2.0))
     xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
     xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
     xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
     xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
     xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
     edPluginMOSFLMv10 = self.createPlugin()
     edPluginMOSFLMv10.setScriptExecutable("cat")
     edPluginMOSFLMv10.setConfig(dictItem, _bLocal=True)
     edPluginMOSFLMv10.configure()
     edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
     edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
     edPluginMOSFLMv10.generateMOSFLMCommands()
     edListCommands = edPluginMOSFLMv10.getListCommandExecution()
     edListCommandsReference = [
         'WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0',
         'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img',
         'RASTER 15 15 3 3 3'
     ]
     EDAssert.equal(edListCommandsReference, edListCommands,
                    "MOSFLM commands with ratser configured")
    def generateDataMOSFLMInputGeneratePrediction(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 XSDataMOSFLMInputGeneratePrediction
        xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction(
        )
        xsDataMOSFLMInputGeneratePrediction.setDistance(XSDataLength(198.4))
        xsDataMOSFLMInputGeneratePrediction.setWavelength(
            XSDataWavelength(0.9340))
        xsDataMOSFLMInputGeneratePrediction.setBeam(xsDataMOSFLMBeamPosition)
        xsDataMOSFLMInputGeneratePrediction.setDetector(xsDataMOSFLMDetector)
        xsDataMOSFLMInputGeneratePrediction.setDirectory(
            XSDataString(self.strDataImagePath))
        xsDataMOSFLMInputGeneratePrediction.setTemplate(
            XSDataString("ref-testscale_1_###.img"))
        xsDataMOSFLMInputGeneratePrediction.setImage(xsDataMOSFLMImage1)

        return xsDataMOSFLMInputGeneratePrediction
コード例 #3
0
 def testGenerateMOSFLMCommands(self):
     xsDataMOSFLMInput = XSDataMOSFLMInput()
     xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
     xsDataMOSFLMBeam.setX(XSDataLength(1.0))
     xsDataMOSFLMBeam.setY(XSDataLength(2.0))
     xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
     xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
     xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
     xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
     xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
     edPluginMOSFLMv10 = self.createPlugin()
     edPluginMOSFLMv10.setScriptExecutable("cat")
     edPluginMOSFLMv10.configure()
     edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
     edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
     edPluginMOSFLMv10.generateMOSFLMCommands()
     edListCommands = edPluginMOSFLMv10.getListCommandExecution()
     edListCommandsReference = [
         'WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0',
         'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img'
     ]
     EDAssert.equal(edListCommandsReference, edListCommands,
                    "MOSFLM commands")
     self.cleanUp(edPluginMOSFLMv10)
コード例 #4
0
    def generateDataMOSFLMInputGeneratePrediction(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 XSDataMOSFLMInputGeneratePrediction

        xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction()
        xsDataMOSFLMInputGeneratePrediction.setDistance(XSDataLength(198.4))
        xsDataMOSFLMInputGeneratePrediction.setWavelength(XSDataWavelength(0.9340))
        xsDataMOSFLMInputGeneratePrediction.setBeam(xsDataMOSFLMBeamPosition)
        xsDataMOSFLMInputGeneratePrediction.setDetector(xsDataMOSFLMDetector)
        xsDataMOSFLMInputGeneratePrediction.setDirectory(XSDataString(self.strDataImagePath))
        xsDataMOSFLMInputGeneratePrediction.setTemplate(XSDataString("ref-testscale_1_###.img"))
        xsDataMOSFLMInputGeneratePrediction.setImage(xsDataMOSFLMImage1)

        return xsDataMOSFLMInputGeneratePrediction
コード例 #5
0
 def testRasterConfiguration(self):
     strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome, "XSConfiguration_raster.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     edConfiguration.load()
     xsPluginItem = edConfiguration.getPluginItem("EDPluginMOSFLMv10")
     xsDataMOSFLMInput = XSDataMOSFLMInput()
     xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
     xsDataMOSFLMBeam.setX(XSDataLength(1.0))
     xsDataMOSFLMBeam.setY(XSDataLength(2.0))
     xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
     xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
     xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
     xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
     xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
     edPluginMOSFLMv10 = self.createPlugin()
     edPluginMOSFLMv10.setScriptExecutable("cat")
     edPluginMOSFLMv10.setConfiguration(xsPluginItem)
     edPluginMOSFLMv10.configure()
     edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
     edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
     edPluginMOSFLMv10.generateMOSFLMCommands()
     edListCommands = edPluginMOSFLMv10.getListCommandExecution()
     edListCommandsReference = ['WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0', 'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img', 'RASTER 15 15 3 3 3']
     EDAssert.equal(edListCommandsReference, edListCommands, "MOSFLM commands with ratser configured")
コード例 #6
0
 def testGenerateMOSFLMCommands(self):
     xsDataMOSFLMInput = XSDataMOSFLMInput()
     xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
     xsDataMOSFLMBeam.setX(XSDataLength(1.0))
     xsDataMOSFLMBeam.setY(XSDataLength(2.0))
     xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
     xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
     xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
     xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
     xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
     edPluginMOSFLMv10 = self.createPlugin()
     edPluginMOSFLMv10.setScriptExecutable("cat")
     edPluginMOSFLMv10.configure()
     edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
     edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
     edPluginMOSFLMv10.generateMOSFLMCommands()
     edListCommands = edPluginMOSFLMv10.getListCommandExecution()
     edListCommandsReference = ['WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0', 'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img']
     EDAssert.equal(edListCommandsReference, edListCommands, "MOSFLM commands")
     self.cleanUp(edPluginMOSFLMv10)
コード例 #7
0
 def getXSDataMOSFLMDetector(_xsDataDetector):
     """
     Translates an XSDataDetector object to XSDataMOSFLMv10.
     """
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMDetector
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     strDetectorType = _xsDataDetector.getType().getValue()
     if (strDetectorType == "q4") or \
          (strDetectorType == "q4-2x") or \
          (strDetectorType == "q210") or \
          (strDetectorType == "q210-2x") or \
          (strDetectorType == "q315") or \
          (strDetectorType == "q315-2x"):
         xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     elif (strDetectorType == "mar165") or \
            (strDetectorType == "mar225"):
         xsDataMOSFLMDetector.setType(XSDataString("MARCCD"))
     elif (strDetectorType == "pilatus6m"
           or strDetectorType == "pilatus2m"):
         xsDataMOSFLMDetector.setType(XSDataString("PILATUS"))
     elif strDetectorType.startswith("eiger2"):
         xsDataMOSFLMDetector.setType(XSDataString("EIGER2"))
     elif strDetectorType.startswith("eiger"):
         xsDataMOSFLMDetector.setType(XSDataString("EIGER"))
     elif (strDetectorType == "raxis4"):
         xsDataMOSFLMDetector.setType(XSDataString("RAXISIV"))
     else:
         # This is a temporary solution for the exception problem pointed out in bug #43.
         # Instead of raising an exception with a known type we send the error message as a string.
         strErrorMessage = "EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector: Unknown detector type : " + strDetectorType
         raise BaseException(strErrorMessage)
     if (_xsDataDetector.getNumberPixelX() is not None):
         xsDataMOSFLMDetector.setNumberPixelX(
             _xsDataDetector.getNumberPixelX())
     if (_xsDataDetector.getNumberPixelY() is not None):
         xsDataMOSFLMDetector.setNumberPixelY(
             _xsDataDetector.getNumberPixelY())
     if (_xsDataDetector.getPixelSizeX() is not None):
         xsDataMOSFLMDetector.setPixelSizeX(_xsDataDetector.getPixelSizeX())
     if (_xsDataDetector.getPixelSizeY() is not None):
         xsDataMOSFLMDetector.setPixelSizeY(_xsDataDetector.getPixelSizeY())
     return xsDataMOSFLMDetector
コード例 #8
0
 def getXSDataMOSFLMDetector(_xsDataDetector):
     """
     Translates an XSDataDetector object to XSDataMOSFLMv10.
     """
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMDetector
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     strDetectorType = _xsDataDetector.getType().getValue()
     if (strDetectorType == "q4") or \
          (strDetectorType == "q4-2x") or \
          (strDetectorType == "q210") or \
          (strDetectorType == "q210-2x") or \
          (strDetectorType == "q315") or \
          (strDetectorType == "q315-2x"):
         xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     elif (strDetectorType == "mar165") or \
            (strDetectorType == "mar225"):
         xsDataMOSFLMDetector.setType(XSDataString("MARCCD"))
     elif (strDetectorType == "pilatus6m" or strDetectorType == "pilatus2m"):
         xsDataMOSFLMDetector.setType(XSDataString("PILATUS"))
     elif (strDetectorType == "raxis4"):
         xsDataMOSFLMDetector.setType(XSDataString("RAXISIV"))
     else:
         # This is a temporary solution for the exception problem pointed out in bug #43.
         # Instead of raising an exception with a known type we send the error message as a string.
         strErrorMessage = "EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector: Unknown detector type : " + strDetectorType
         raise Exception, strErrorMessage
     if (_xsDataDetector.getNumberPixelX() is not None):
         xsDataMOSFLMDetector.setNumberPixelX(_xsDataDetector.getNumberPixelX())
     if (_xsDataDetector.getNumberPixelY() is not None):
         xsDataMOSFLMDetector.setNumberPixelY(_xsDataDetector.getNumberPixelY())
     if (_xsDataDetector.getPixelSizeX() is not None):
         xsDataMOSFLMDetector.setPixelSizeX(_xsDataDetector.getPixelSizeX())
     if (_xsDataDetector.getPixelSizeY() is not None):
         xsDataMOSFLMDetector.setPixelSizeY(_xsDataDetector.getPixelSizeY())
     return xsDataMOSFLMDetector