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
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("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