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
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
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 generateXSDataMOSFLMInputGeneratePrediction( xsDataGeneratePredictionInput): """ Translation from XSDataGeneratePredictionInput to XSDataMOSFLMInputGeneratePrediction. """ EDVerbose.DEBUG( "EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputGeneratePrediction" ) EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10") from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition from XSDataMOSFLMv10 import XSDataMOSFLMImage from XSDataMOSFLMv10 import XSDataMOSFLMNewmat from XSDataMOSFLMv10 import XSDataMOSFLMMissettingsAngles from XSDataMOSFLMv10 import XSDataMOSFLMInputGeneratePrediction xsDataIndexingSolutionSelected = xsDataGeneratePredictionInput.getSelectedIndexingSolution( ) xsDataCollection = xsDataGeneratePredictionInput.getDataCollection() xsDataSubWedge = xsDataCollection.getSubWedge()[0] xsDataImageList = xsDataSubWedge.getImage() xsDataImageFirst = xsDataImageList[0] xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal() xsDataOrientation = xsDataIndexingSolutionSelected.getOrientation() xsDataExperimentalCondition = xsDataIndexingSolutionSelected.getExperimentalConditionRefined( ) xsDataDetector = xsDataExperimentalCondition.getDetector() xsDataBeam = xsDataExperimentalCondition.getBeam() xsDataMatrixA = xsDataOrientation.getMatrixA() xsDataMatrixU = xsDataOrientation.getMatrixU() xsDataCell = xsDataCrystal.getCell() xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction( ) xsDataMOSFLMNewmat = XSDataMOSFLMNewmat() xsDataMOSFLMNewmat.setRefinedCell(xsDataCell) xsDataMOSFLMNewmat.setAMatrix(xsDataMatrixA) xsDataMOSFLMNewmat.setUMatrix(xsDataMatrixU) xsDataMOSFLMInputGeneratePrediction.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()) xsDataMOSFLMInputGeneratePrediction.setBeam(xsDataMOSFLMBeamPosition) xsDataMOSFLMInputGeneratePrediction.setMosaicity( xsDataCrystal.getMosaicity()) xsDataMOSFLMInputGeneratePrediction.setSymmetry( xsDataCrystal.getSpaceGroup().getName()) strPathFirst = xsDataImageFirst.getPath().getValue() strDirectoryFirst = os.path.dirname(strPathFirst) strFilenameFirst = os.path.basename(strPathFirst) xsDataMOSFLMInputGeneratePrediction.setWavelength( xsDataBeam.getWavelength()) xsDataMOSFLMInputGeneratePrediction.setDistance( xsDataDetector.getDistance()) xsDataMOSFLMInputGeneratePrediction.setDirectory( XSDataString(strDirectoryFirst)) xsDataMOSFLMDetector = EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector( xsDataDetector) xsDataMOSFLMInputGeneratePrediction.setDetector(xsDataMOSFLMDetector) # The MOSFLM plugin can only handle one image xsDataImage = xsDataSubWedge.getImage()[0] xsDataGoniostat = xsDataSubWedge.getExperimentalCondition( ).getGoniostat() iImageNumber = xsDataImage.getNumber().getValue() if xsDataDetector.type.value == "eiger2_16m": strMOSFLMTemplate = EDUtilsImage.getH5MasterTemplate( strFilenameFirst, iImageNumber) else: strMOSFLMTemplate = EDUtilsImage.getTemplate(strFilenameFirst, "#") xsDataMOSFLMInputGeneratePrediction.setTemplate( XSDataString(strMOSFLMTemplate)) xsDataMOSFLMImage = XSDataMOSFLMImage() xsDataMOSFLMImage.setNumber(XSDataInteger(iImageNumber)) fOscillationStart = xsDataGoniostat.getRotationAxisStart().getValue() fOscillationRange = xsDataGoniostat.getOscillationWidth().getValue() xsDataMOSFLMImage.setRotationAxisStart(XSDataAngle(fOscillationStart)) xsDataMOSFLMImage.setRotationAxisEnd( XSDataAngle(fOscillationStart + fOscillationRange)) xsDataMOSFLMInputGeneratePrediction.setImage(xsDataMOSFLMImage) return xsDataMOSFLMInputGeneratePrediction
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
def generateXSDataMOSFLMInputGeneratePrediction(xsDataGeneratePredictionInput): """ Translation from XSDataGeneratePredictionInput to XSDataMOSFLMInputGeneratePrediction. """ EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputGeneratePrediction") EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10") from XSDataMOSFLMv10 import XSDataMOSFLMBeamPosition from XSDataMOSFLMv10 import XSDataMOSFLMImage from XSDataMOSFLMv10 import XSDataMOSFLMNewmat from XSDataMOSFLMv10 import XSDataMOSFLMMissettingsAngles from XSDataMOSFLMv10 import XSDataMOSFLMInputGeneratePrediction xsDataIndexingSolutionSelected = xsDataGeneratePredictionInput.getSelectedIndexingSolution() xsDataCollection = xsDataGeneratePredictionInput.getDataCollection() xsDataSubWedge = xsDataCollection.getSubWedge()[0] xsDataImageList = xsDataSubWedge.getImage() xsDataImageFirst = xsDataImageList[0] xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal() xsDataOrientation = xsDataIndexingSolutionSelected.getOrientation() xsDataExperimentalCondition = xsDataIndexingSolutionSelected.getExperimentalConditionRefined() xsDataDetector = xsDataExperimentalCondition.getDetector() xsDataBeam = xsDataExperimentalCondition.getBeam() xsDataMatrixA = xsDataOrientation.getMatrixA() xsDataMatrixU = xsDataOrientation.getMatrixU() xsDataCell = xsDataCrystal.getCell() xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction() xsDataMOSFLMNewmat = XSDataMOSFLMNewmat() xsDataMOSFLMNewmat.setRefinedCell(xsDataCell) xsDataMOSFLMNewmat.setAMatrix(xsDataMatrixA) xsDataMOSFLMNewmat.setUMatrix(xsDataMatrixU) xsDataMOSFLMInputGeneratePrediction.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()) xsDataMOSFLMInputGeneratePrediction.setBeam(xsDataMOSFLMBeamPosition) xsDataMOSFLMInputGeneratePrediction.setMosaicity(xsDataCrystal.getMosaicity()) xsDataMOSFLMInputGeneratePrediction.setSymmetry(xsDataCrystal.getSpaceGroup().getName()) strPathFirst = xsDataImageFirst.getPath().getValue() strDirectoryFirst = os.path.dirname(strPathFirst) strFilenameFirst = os.path.basename(strPathFirst) xsDataMOSFLMInputGeneratePrediction.setWavelength(xsDataBeam.getWavelength()) xsDataMOSFLMInputGeneratePrediction.setDistance(xsDataDetector.getDistance()) xsDataMOSFLMInputGeneratePrediction.setDirectory(XSDataString(strDirectoryFirst)) xsDataMOSFLMDetector = EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector(xsDataDetector) xsDataMOSFLMInputGeneratePrediction.setDetector(xsDataMOSFLMDetector) strMOSFLMTemplate = EDUtilsImage.getTemplate(strFilenameFirst, "#") xsDataMOSFLMInputGeneratePrediction.setTemplate(XSDataString(strMOSFLMTemplate)) # The MOSFLM plugin can only handle one image xsDataImage = xsDataSubWedge.getImage()[0] xsDataGoniostat = xsDataSubWedge.getExperimentalCondition().getGoniostat() xsDataMOSFLMImage = XSDataMOSFLMImage() iImageNumber = xsDataImage.getNumber().getValue() xsDataMOSFLMImage.setNumber(XSDataInteger(iImageNumber)) fOscillationStart = xsDataGoniostat.getRotationAxisStart().getValue() fOscillationRange = xsDataGoniostat.getOscillationWidth().getValue() xsDataMOSFLMImage.setRotationAxisStart(XSDataAngle(fOscillationStart)) xsDataMOSFLMImage.setRotationAxisEnd(XSDataAngle(fOscillationStart + fOscillationRange)) xsDataMOSFLMInputGeneratePrediction.setImage(xsDataMOSFLMImage) return xsDataMOSFLMInputGeneratePrediction