本文整理汇总了Python中XSDataMXv1.XSDataExperimentalCondition类的典型用法代码示例。如果您正苦于以下问题:Python XSDataExperimentalCondition类的具体用法?Python XSDataExperimentalCondition怎么用?Python XSDataExperimentalCondition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XSDataExperimentalCondition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateXSDataIndexingResult
def generateXSDataIndexingResult(_xsDataResultXDSIndexing, _xsDataExperimentalCondition=None):
xsDataIndexingResult = XSDataIndexingResult()
xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected()
xsDataCrystalSelected = XSDataCrystal()
# xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex))
# xsDataCellSelected = xsDataLabelitSolution.getUnitCell()
spaceGroupName = EDUtilsSymmetry.getMinimumSymmetrySpaceGroupFromBravaisLattice(_xsDataResultXDSIndexing.bravaisLattice.value)
xsDataCrystalSelected = XSDataCrystal()
xsDataSpaceGroupSelected = XSDataSpaceGroup()
xsDataSpaceGroupSelected.setName(XSDataString(spaceGroupName))
xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected)
# xsDataCrystalSelected.setCell(xsDataCellSelected)
xsDataCrystalSelected.setMosaicity(XSDataDouble(_xsDataResultXDSIndexing.mosaicity.value))
xsDataCrystalSelected.setCell(XSDataCell.parseString(_xsDataResultXDSIndexing.unitCell.marshal()))
xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected)
xsDataOrientation = XSDataOrientation()
xsDataOrientation.setMatrixA(_xsDataResultXDSIndexing.getAMatrix())
xsDataOrientation.setMatrixU(_xsDataResultXDSIndexing.getUMatrix())
xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation)
xsDataStatisticsIndexing = XSDataStatisticsIndexing()
if (_xsDataExperimentalCondition is not None):
fBeamPositionXOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionX().getValue()
fBeamPositionYOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionY().getValue()
fBeamPositionXNew = _xsDataResultXDSIndexing.getBeamCentreX().getValue()
fBeamPositionYNew = _xsDataResultXDSIndexing.getBeamCentreY().getValue()
xsDataStatisticsIndexing.setBeamPositionShiftX(XSDataLength(fBeamPositionXOrig - fBeamPositionXNew))
xsDataStatisticsIndexing.setBeamPositionShiftY(XSDataLength(fBeamPositionYOrig - fBeamPositionYNew))
xsDataExperimentalConditionRefined = None
if (_xsDataExperimentalCondition is None):
xsDataExperimentalConditionRefined = XSDataExperimentalCondition()
else:
# Copy the incoming experimental condition
xmlExperimentalCondition = _xsDataExperimentalCondition.marshal()
xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition)
xsDataDetector = xsDataExperimentalConditionRefined.getDetector()
if (xsDataDetector is None):
xsDataDetector = XSDataDetector()
xsDataDetector.setBeamPositionX(XSDataLength(_xsDataResultXDSIndexing.getBeamCentreX().value))
xsDataDetector.setBeamPositionY(XSDataLength(_xsDataResultXDSIndexing.getBeamCentreY().value))
xsDataDetector.setDistance(_xsDataResultXDSIndexing.getDistance())
xsDataExperimentalConditionRefined.setDetector(xsDataDetector)
xsDataIndexingSolutionSelected.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)
xsDataIndexingResult.setSelectedSolution(xsDataIndexingSolutionSelected)
return xsDataIndexingResult
示例2: preProcess
def preProcess(self, _edObject=None):
"""
Gets the Configuration Parameters, if found, overrides default parameters
"""
EDPluginControl.preProcess(self, _edObject)
self.DEBUG("EDPluginControlGeneratePredictionv10.preProcess...")
xsDataGeneratePredictionInput = self.getDataInput()
xsDataSelectedIndexingSolution = xsDataGeneratePredictionInput.getSelectedIndexingSolution()
xsDataExperimentalConditionRefined = xsDataSelectedIndexingSolution.getExperimentalConditionRefined()
xsDataCollection = xsDataGeneratePredictionInput.getDataCollection()
xsDataSubWedgeList = xsDataCollection.getSubWedge()
# List containing instances of all the generate prediction plugins
self.__listPluginGeneratePrediction = []
# Loop through all subwedges
iIndex = 0
for xsDataSubWedge in xsDataSubWedgeList:
xsDataImageList = xsDataSubWedge.getImage()
# 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
# Then loop through all images in a sub wedge
for xsDataImage in xsDataImageList:
iIndex += 1
edPluginGeneratePrediction = self.loadPlugin(self.__strPluginGeneratePredictionName,
"%s-%02d" % (self.__strPluginGeneratePredictionName, iIndex))
xsDataGeneratePredictionInput = XSDataGeneratePredictionInput()
xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataSelectedIndexingSolution.marshal()))
xsDataCollectionNew = XSDataCollection()
xsDataSubWedgeNew = XSDataSubWedge()
xsDataSubWedgeNew.addImage(XSDataImage.parseString(xsDataImage.marshal()))
xsDataSubWedgeNew.setExperimentalCondition(XSDataExperimentalCondition.parseString(xsDataSubWedge.getExperimentalCondition().marshal()))
# We must modify the rotationOscillationStart for the new subwedge
xsDataGoniostatNew = xsDataSubWedgeNew.getExperimentalCondition().getGoniostat()
fGoniostatRotationAxisStart = xsDataGoniostatNew.getRotationAxisStart().getValue()
fGonioStatOscillationRange = xsDataGoniostatNew.getOscillationWidth().getValue()
iImageNumber = xsDataImage.getNumber().getValue()
fGoniostatRotationAxisStartNew = fGoniostatRotationAxisStart + (iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange
xsDataGoniostatNew.setRotationAxisStart(XSDataAngle(fGoniostatRotationAxisStartNew))
#
xsDataCollectionNew.addSubWedge(xsDataSubWedgeNew)
xsDataGeneratePredictionInput.setDataCollection(xsDataCollectionNew)
from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
xsDataMOSFLMInputGeneratePrediction = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputGeneratePrediction(xsDataGeneratePredictionInput)
edPluginGeneratePrediction.setDataInput(xsDataMOSFLMInputGeneratePrediction)
self.__listPluginGeneratePrediction.append(edPluginGeneratePrediction)
示例3: preProcess
def preProcess(self, _edObject=None):
"""
Gets the Configuration Parameters, if found, overrides default parameters
"""
EDPluginControl.preProcess(self, _edObject)
self.DEBUG("EDPluginControlIntegrationv10.preProcess...")
xsDataIntegrationInput = self.getDataInput()
xsDataSelectedIndexingSolution = xsDataIntegrationInput.getSelectedIndexingSolution()
self.__xsDataExperimentalConditionRefined = xsDataIntegrationInput.getExperimentalConditionRefined()
# To be changed (see bug #40)
if (self.__xsDataExperimentalConditionRefined is None):
self.__xsDataExperimentalConditionRefined = xsDataSelectedIndexingSolution.getExperimentalConditionRefined()
xsDataCollection = xsDataIntegrationInput.getDataCollection()
xsDataSubWedgeList = xsDataCollection.getSubWedge()
self.__edPluginIntegrationList = []
iIndex = 0
for xsDataSubWedge in xsDataSubWedgeList:
iSubWedgeNumber = iIndex
if (xsDataSubWedge.getSubWedgeNumber() is not None):
# Use the incoming subwedge number if it exists
iSubWedgeNumber = xsDataSubWedge.getSubWedgeNumber().getValue()
edPluginIntegration = self.loadPlugin(self.__strPluginIntegrationName)
if (not edPluginIntegration is None):
iIndex += 1
xsDataIntegrationInputSubWedge = XSDataIntegrationInput()
xsDataIntegrationInputSubWedge.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataSelectedIndexingSolution.marshal()))
xsDataIntegrationInputSubWedge.setExperimentalConditionRefined(XSDataExperimentalCondition.parseString(self.__xsDataExperimentalConditionRefined.marshal()))
xsDataCollection = XSDataCollection()
xsDataCollection.addSubWedge(xsDataSubWedge)
xsDataIntegrationInputSubWedge.setDataCollection(xsDataCollection)
try:
from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(xsDataIntegrationInputSubWedge)
edPluginIntegration.setDataInput(xsDataMOSFLMInputIntegration)
edPluginIntegration.setBaseName("%s-%02d" % (self.__strPluginIntegrationName, iIndex))
edPluginIntegration.connectSUCCESS(self.doSuccessActionIntegration)
edPluginIntegration.connectFAILURE(self.doFailureActionIntegration)
# Here we store the sub wedge number for use in the results
self.__edPluginIntegrationList.append([iSubWedgeNumber, edPluginIntegration])
except Exception as strErrorMessage:
self.addErrorMessage(strErrorMessage)
self.ERROR(strErrorMessage)
self.setFailure()
else:
strErrorMessage = "EDPluginControlIntegrationv10.preProcess: could not load plugin %s" % self.__strPluginIntegrationName
self.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
示例4: getXSDataResultStrategy
def getXSDataResultStrategy(self, _xsDataResultBest, _xsDataExperimentalCondition, _xsDataSample):
xsDataResultStrategy = XSDataResultStrategy()
#xsDataCollectionRunsBest = _xsDataResultBest.getCollectionRun()
xsDataCollectionPlansBest = _xsDataResultBest.getCollectionPlan()
for xsDataCollectionPlanBest in xsDataCollectionPlansBest:
xsDataCollectionPlan = XSDataCollectionPlan()
xsDataCollectionStrategy = XSDataCollection()
xsDataDoubleTransmission = xsDataCollectionPlanBest.getStrategySummary().getAttenuation()
for xsDataCollectionRunBest in xsDataCollectionPlanBest.getCollectionRun():
xsDataSubWedge = XSDataSubWedge()
strXmlStringDataExperimentalCondition = _xsDataExperimentalCondition.marshal()
xsDataExperimentalCondition = XSDataExperimentalCondition.parseString(strXmlStringDataExperimentalCondition)
xsDataExperimentalCondition.getBeam().setExposureTime(xsDataCollectionRunBest.getExposureTime())
xsDataExperimentalCondition.getBeam().setTransmission(xsDataDoubleTransmission)
xsDataExperimentalCondition.getDetector().setDistance(xsDataCollectionRunBest.getDistance())
xsDataExperimentalCondition.getGoniostat().setRotationAxisStart(xsDataCollectionRunBest.getPhiStart())
xsDataExperimentalCondition.getGoniostat().setOscillationWidth(xsDataCollectionRunBest.getPhiWidth())
fRotationAxisEnd = xsDataCollectionRunBest.getPhiStart().getValue() + xsDataCollectionRunBest.getNumberOfImages().getValue() * xsDataCollectionRunBest.getPhiWidth().getValue()
xsDataExperimentalCondition.getGoniostat().setRotationAxisEnd(XSDataAngle(fRotationAxisEnd))
xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
xsDataSubWedge.setSubWedgeNumber(xsDataCollectionRunBest.getCollectionRunNumber())
xsDataCollectionStrategy.addSubWedge(xsDataSubWedge)
xsDataCollectionStrategy.setSample(_xsDataSample)
xsDataCollectionPlan.setCollectionStrategy(xsDataCollectionStrategy)
xsDataStrategySummary = xsDataCollectionPlanBest.getStrategySummary()
xsDataCollectionPlan.setStrategySummary(xsDataStrategySummary)
xsDataStatistics = xsDataCollectionPlanBest.getStatisticalPrediction()
xsDataCollectionPlan.setStatistics(xsDataStatistics)
xsDataCollectionPlan.setCollectionPlanNumber(xsDataCollectionPlanBest.getCollectionPlanNumber())
xsDataResultStrategy.addCollectionPlan(xsDataCollectionPlan)
return xsDataResultStrategy
示例5: process
def process(self, _edObject=None):
EDPluginExec.process(self)
EDVerbose.DEBUG("EDPluginExecReadImageHeaderPilatus2Mv10.process")
xsDataInputReadImageHeader = self.getDataInput()
xsDataFile = xsDataInputReadImageHeader.getImage()
strPath = xsDataFile.getPath().getValue()
dictPilatus2MHeader = self.readHeaderPilatus2M(strPath)
if (dictPilatus2MHeader is None):
strErrorMessage = "EDPluginExecReadImageHeaderPilatus2Mv10.process : Cannot read header : %s" % strPath
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
else:
xsDataExperimentalCondition = XSDataExperimentalCondition()
xsDataDetector = XSDataDetector()
iNoPixelsX = 1475
iNoPixelsY = 1679
xsDataDetector.setNumberPixelX(XSDataInteger(iNoPixelsX))
xsDataDetector.setNumberPixelY(XSDataInteger(iNoPixelsY))
# Pixel size
listPixelSizeXY = dictPilatus2MHeader[ "Pixel_size" ].split(" ")
fPixelSizeX = float(listPixelSizeXY[0]) * 1000
xsDataDetector.setPixelSizeX(XSDataLength(fPixelSizeX))
fPixelSizeY = float(listPixelSizeXY[3]) * 1000
xsDataDetector.setPixelSizeY(XSDataLength(fPixelSizeY))
# Beam position
listBeamPosition = dictPilatus2MHeader["Beam_xy"].replace("(", " ").replace(")", " ").replace(",", " ").split()
fBeamPositionX = float(listBeamPosition[1]) * fPixelSizeX
fBeamPositionY = float(listBeamPosition[0]) * fPixelSizeY
xsDataDetector.setBeamPositionX(XSDataLength(fBeamPositionX))
xsDataDetector.setBeamPositionY(XSDataLength(fBeamPositionY))
fDistance = float(dictPilatus2MHeader[ "Detector_distance" ].split(" ")[0]) * 1000
xsDataDetector.setDistance(XSDataLength(fDistance))
# xsDataDetector.setNumberBytesInHeader(XSDataInteger(float(dictPilatus2MHeader[ "header_size" ])))
xsDataDetector.setSerialNumber(XSDataString(dictPilatus2MHeader[ "Detector:" ]))
# #xsDataDetector.setBin( XSDataString( dictPilatus2MHeader[ "BIN" ] ) ) )
# #xsDataDetector.setDataType( XSDataString( dictPilatus2MHeader[ "TYPE" ] ) ) )
# #xsDataDetector.setByteOrder( XSDataString( dictPilatus2MHeader[ "BYTE_ORDER" ] ) ) )
# xsDataDetector.setImageSaturation(XSDataInteger(int(dictPilatus2MHeader[ "saturation_level" ])))
xsDataDetector.setName(XSDataString("PILATUS2 3M"))
xsDataDetector.setType(XSDataString("pilatus2m"))
xsDataExperimentalCondition.setDetector(xsDataDetector)
# Beam object
xsDataBeam = XSDataBeam()
xsDataBeam.setWavelength(XSDataWavelength(float(dictPilatus2MHeader[ "Wavelength" ].split(" ")[0])))
xsDataBeam.setExposureTime(XSDataTime(float(dictPilatus2MHeader[ "Exposure_time" ].split(" ")[0])))
xsDataExperimentalCondition.setBeam(xsDataBeam)
# Goniostat object
xsDataGoniostat = XSDataGoniostat()
fRotationAxisStart = float(dictPilatus2MHeader[ "Start_angle" ].split(" ")[0])
fOscillationWidth = float(dictPilatus2MHeader[ "Angle_increment" ].split(" ")[0])
xsDataGoniostat.setRotationAxisStart(XSDataAngle(fRotationAxisStart))
xsDataGoniostat.setRotationAxisEnd(XSDataAngle(fRotationAxisStart + fOscillationWidth))
xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth))
xsDataExperimentalCondition.setGoniostat(xsDataGoniostat)
#
# Create the image object
xsDataImage = XSDataImage()
xsDataImage.setPath(XSDataString(strPath))
if "DateTime" in dictPilatus2MHeader:
strTimeStamp = dictPilatus2MHeader[ "DateTime" ]
xsDataImage.setDate(XSDataString(strTimeStamp))
iImageNumber = EDUtilsImage.getImageNumber(strPath)
xsDataImage.setNumber(XSDataInteger(iImageNumber))
xsDataSubWedge = XSDataSubWedge()
xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
xsDataSubWedge.addImage(xsDataImage)
self.__xsDataResultReadImageHeader = XSDataResultReadImageHeader()
self.__xsDataResultReadImageHeader.setSubWedge(xsDataSubWedge)
示例6: process
def process(self, _edObject=None):
EDPluginExec.process(self)
EDVerbose.DEBUG("*** EDPluginExecReadImageHeaderADSCv10.process")
xsDataInputReadImageHeader = self.getDataInput()
xsDataFile = xsDataInputReadImageHeader.getImage()
strPath = xsDataFile.getPath().getValue()
strAbsolutePath = os.path.abspath(strPath)
dictHeader = self.readHeaderADSC(strPath)
if (dictHeader is None):
strErrorMessage = "EDPluginExecReadImageHeaderADSCv10.process : error when reading header from %s" % strAbsolutePath
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
else:
xsDataExperimentalCondition = XSDataExperimentalCondition()
xsDataDetector = XSDataDetector()
xsDataDetector.setBeamPositionX(XSDataLength(float(dictHeader[ "BEAM_CENTER_X" ])))
xsDataDetector.setBeamPositionY(XSDataLength(float(dictHeader[ "BEAM_CENTER_Y" ])))
xsDataDetector.setDistance(XSDataLength(float(dictHeader[ "DISTANCE" ])))
fPixelSize = float(dictHeader[ "PIXEL_SIZE" ])
xsDataDetector.setPixelSizeX(XSDataLength(fPixelSize))
xsDataDetector.setPixelSizeY(XSDataLength(fPixelSize))
if "TWOTHETA" in dictHeader.keys():
xsDataDetector.setTwoTheta(XSDataAngle(float(dictHeader[ "TWOTHETA" ])))
xsDataDetector.setNumberBytesInHeader(XSDataInteger(float(dictHeader[ "HEADER_BYTES" ])))
xsDataDetector.setSerialNumber(XSDataString(dictHeader[ "DETECTOR_SN" ]))
xsDataDetector.setNumberPixelX(XSDataInteger(int(dictHeader[ "SIZE1" ])))
xsDataDetector.setNumberPixelY(XSDataInteger(int(dictHeader[ "SIZE2" ])))
xsDataDetector.setBin(XSDataString(dictHeader[ "BIN" ]))
xsDataDetector.setDataType(XSDataString(dictHeader[ "TYPE" ]))
xsDataDetector.setByteOrder(XSDataString(dictHeader[ "BYTE_ORDER" ]))
if "CCD_IMAGE_SATURATION" in dictHeader.keys():
xsDataDetector.setImageSaturation(XSDataInteger(int(dictHeader[ "CCD_IMAGE_SATURATION" ])))
# Determine type of detector...
iNoPixelsX = xsDataDetector.getNumberPixelX().getValue()
iNoPixelsY = xsDataDetector.getNumberPixelY().getValue()
if (iNoPixelsX == 2304 and iNoPixelsY == 2304):
xsDataDetector.setName(XSDataString("ADSC Q4"))
xsDataDetector.setType(XSDataString("q4"))
elif (iNoPixelsX == 1152 and iNoPixelsY == 1152):
xsDataDetector.setName(XSDataString("ADSC Q4 bin 2x2"))
xsDataDetector.setType(XSDataString("q4-2x"))
elif (iNoPixelsX == 4096 and iNoPixelsY == 4096):
xsDataDetector.setName(XSDataString("ADSC Q210"))
xsDataDetector.setType(XSDataString("q210"))
elif (iNoPixelsX == 2048 and iNoPixelsY == 2048):
xsDataDetector.setName(XSDataString("ADSC Q210 bin 2x2"))
xsDataDetector.setType(XSDataString("q210-2x"))
elif (iNoPixelsX == 6144 and iNoPixelsY == 6144):
xsDataDetector.setName(XSDataString("ADSC Q315"))
xsDataDetector.setType(XSDataString("q315"))
elif (iNoPixelsX == 3072 and iNoPixelsY == 3072):
xsDataDetector.setName(XSDataString("ADSC Q315 bin 2x2"))
xsDataDetector.setType(XSDataString("q315-2x"))
else:
strErrorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginExecReadImageHeaderADSCv10.process", "Unknown detector type")
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
raise RuntimeError, strErrorMessage
xsDataExperimentalCondition.setDetector(xsDataDetector)
# Beam object
xsDataBeam = XSDataBeam()
xsDataBeam.setWavelength(XSDataWavelength(float(dictHeader[ "WAVELENGTH" ])))
xsDataBeam.setExposureTime(XSDataTime(float(dictHeader[ "TIME" ])))
xsDataExperimentalCondition.setBeam(xsDataBeam)
# Goniostat object
xsDataGoniostat = XSDataGoniostat()
fRotationAxisStart = float(dictHeader[ "OSC_START" ])
fOscillationWidth = float(dictHeader[ "OSC_RANGE" ])
xsDataGoniostat.setRotationAxisStart(XSDataAngle(fRotationAxisStart))
xsDataGoniostat.setRotationAxisEnd(XSDataAngle(fRotationAxisStart + fOscillationWidth))
xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth))
strRotationAxis = None
if ("AXIS" in dictHeader.keys()):
strRotationAxis = dictHeader[ "AXIS" ]
elif ("OSC_AXIS" in dictHeader.keys()):
strRotationAxis = dictHeader[ "OSC_AXIS" ]
else:
strErrorMessage = "EDPluginExecReadImageHeaderADSCv10.process : Neither AXIS nor OSC_AXIS header item found."
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
xsDataGoniostat.setRotationAxis(XSDataString(strRotationAxis))
xsDataExperimentalCondition.setGoniostat(xsDataGoniostat)
# Create the image object
xsDataImage = XSDataImage()
xsDataImage.setPath(XSDataString(strAbsolutePath))
xsDataImage.setDate(XSDataString(dictHeader[ "DATE" ]))
strFileName = os.path.basename(strPath)
iImageNumber = EDUtilsImage.getImageNumber(strFileName)
xsDataImage.setNumber(XSDataInteger(iImageNumber))
xsDataSubWedge = XSDataSubWedge()
#.........这里部分代码省略.........
示例7: getTestExperimentalCondition
def getTestExperimentalCondition(self):
strPathToTestExperimentalCondition = os.path.join(self.getPluginTestsDataHome(), "XSDataExperimentalCondition_test.xml")
strXMLInput = self.readAndParseFile(strPathToTestExperimentalCondition)
xsDataExperimentalCondition = XSDataExperimentalCondition.parseString(strXMLInput)
return xsDataExperimentalCondition
示例8: testSetDataModelInput
def testSetDataModelInput(self):
edPluginStrategy = self.createPlugin()
strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration_ESRF.xml")
edConfiguration = EDConfiguration(strPathToTestConfigFile)
dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
edPluginStrategy.setConfig(dictItem)
edPluginStrategy.configure()
xsDataStrategy = XSDataInputStrategy()
# Beam
xsExperimentalCondition = XSDataExperimentalCondition()
xsBeam = XSDataBeam()
xsBeam.setFlux(XSDataFlux(1e+12))
xsBeam.setWavelength(XSDataWavelength(2.41))
xsBeam.setSize(XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1)))
xsBeam.setExposureTime(XSDataTime(1))
xsExperimentalCondition.setBeam(xsBeam)
# Detector and Exposure Time
xsDataDetector = XSDataDetector()
xsDataDetector.setType(XSDataString("q210-2x"))
xsExperimentalCondition.setDetector(xsDataDetector)
xsDataGoniostat = XSDataGoniostat()
xsDataGoniostat.setRotationAxis(XSDataString("phi"))
xsExperimentalCondition.setGoniostat(xsDataGoniostat)
xsDataStrategy.setExperimentalCondition(xsExperimentalCondition)
# Best Files
bestFileContentDat = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.dat"))
xsDataStrategy.setBestFileContentDat(XSDataString(bestFileContentDat))
bestFileContentPar = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.par"))
xsDataStrategy.setBestFileContentPar(XSDataString(bestFileContentPar))
bestFileContentHKL = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile1.hkl"))
xsDataStrategy.addBestFileContentHKL(XSDataString(bestFileContentHKL))
# Crystal
xsDataSampleCrystalMM = XSDataSampleCrystalMM()
xsDataStructure = XSDataStructure()
xsDataComposition = XSDataChemicalCompositionMM()
xsDataChain = XSDataChain()
xsDataChain.setType(XSDataString("protein"))
xsDataChain.setNumberOfCopies(XSDataDouble(2))
xsDataAtomicComposition = XSDataAtomicComposition()
xsDataAtom1 = XSDataAtom()
xsDataAtom1.setSymbol(XSDataString("Se"))
xsDataAtom1.setNumberOf(XSDataDouble(4))
xsDataAtomicComposition.addAtom(xsDataAtom1)
xsDataChain.setHeavyAtoms(xsDataAtomicComposition)
xsDataChain.setNumberOfMonomers(XSDataDouble(100))
xsDataStructure.addChain(xsDataChain)
xsDataChain2 = XSDataChain()
xsDataChain2.setType(XSDataString("rna"))
xsDataChain2.setNumberOfCopies(XSDataDouble(1))
xsDataChain2.setNumberOfMonomers(XSDataDouble(60))
xsDataStructure.addChain(xsDataChain2)
xsDataLigand = XSDataLigand()
xsDataLigand.setNumberOfCopies(XSDataDouble(2))
xsDataLigand.setNumberOfLightAtoms(XSDataDouble(42))
xsDataAtomicComposition = XSDataAtomicComposition()
xsDataAtom2 = XSDataAtom()
xsDataAtom2.setSymbol(XSDataString("Fe"))
xsDataAtom2.setNumberOf(XSDataDouble(1))
xsDataAtomicComposition.addAtom(xsDataAtom2)
xsDataLigand.setHeavyAtoms(xsDataAtomicComposition)
xsDataStructure.addLigand(xsDataLigand)
xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataDouble(0.25))
xsDataSolvent = XSDataSolvent()
xsDataAtomicComposition = XSDataAtomicComposition()
xsDataAtom3 = XSDataAtom()
xsDataAtom3.setSymbol(XSDataString("Na"))
xsDataAtom3.setConcentration(XSDataDouble(1000))
xsDataAtom4 = XSDataAtom()
xsDataAtom4.setSymbol(XSDataString("Cl"))
xsDataAtom4.setConcentration(XSDataDouble(1000))
xsDataAtomicComposition.addAtom(xsDataAtom3)
xsDataAtomicComposition.addAtom(xsDataAtom4)
xsDataSolvent.setAtoms(xsDataAtomicComposition)
xsDataComposition.setStructure(xsDataStructure)
xsDataComposition.setSolvent(xsDataSolvent)
xsDataSampleCrystalMM.setChemicalComposition(xsDataComposition)
xsDataSampleCrystalMM.setSize(XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1)))
#.........这里部分代码省略.........
示例9: generateXSDataIndexingResult
def generateXSDataIndexingResult(_xsDataResultLabelitIndexing, _xsDataExperimentalCondition=None):
EDVerbose.DEBUG("EDHandlerXSDataLabelitv1_1.generateXSDataIndexingOutput")
xsDataLabelitScreenOutput = _xsDataResultLabelitIndexing.screenOutput
xsDataLabelitMosflmScriptsOutput = _xsDataResultLabelitIndexing.mosflmScriptsOutput
iSelectedSolutionNumber = xsDataLabelitScreenOutput.getSelectedSolutionNumber().getValue()
xsDataIndexingResult = XSDataIndexingResult()
xsDataIndexingSolutionSelected = None
for xsDataLabelitSolution in xsDataLabelitScreenOutput.getLabelitScreenSolution():
xsDataCrystal = XSDataCrystal()
xsDataSpaceGroup = XSDataSpaceGroup()
edStringSpaceGroupName = EDUtilsSymmetry.getMinimumSymmetrySpaceGroupFromBravaisLattice(xsDataLabelitSolution.getBravaisLattice().getValue())
xsDataSpaceGroup.setName(XSDataString(edStringSpaceGroupName))
xsDataCrystal.setSpaceGroup(xsDataSpaceGroup)
xsDataCrystal.setCell(xsDataLabelitSolution.getUnitCell())
xsDataIndexingSolution = XSDataIndexingSolution()
xsDataIndexingSolution.setCrystal(xsDataCrystal)
iIndex = xsDataLabelitSolution.getSolutionNumber().getValue()
xsDataIndexingSolution.setNumber(XSDataInteger(iIndex))
xsDataIndexingResult.addSolution(xsDataIndexingSolution)
if (iIndex == iSelectedSolutionNumber):
xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected()
xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex))
edStringSelectedSpaceGroupName = edStringSpaceGroupName
xsDataCellSelected = xsDataLabelitSolution.getUnitCell()
fRmsdSelected = xsDataLabelitSolution.getRmsd().getValue()
iNumberOfSpotsSelected = xsDataLabelitSolution.getNumberOfSpots().getValue()
xsDataCrystalSelected = XSDataCrystal()
xsDataSpaceGroupSelected = XSDataSpaceGroup()
xsDataSpaceGroupSelected.setName(XSDataString(edStringSelectedSpaceGroupName))
xsDataSpaceGroupSelected.setITNumber(XSDataInteger(EDUtilsSymmetry.getITNumberFromSpaceGroupName(edStringSelectedSpaceGroupName)))
xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected)
xsDataCrystalSelected.setCell(xsDataCellSelected)
xsDataCrystalSelected.setMosaicity(XSDataDouble(xsDataLabelitScreenOutput.getMosaicity().getValue()))
xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected)
xsDataOrientation = XSDataOrientation()
xsDataOrientation.setMatrixA(xsDataLabelitMosflmScriptsOutput.getAMatrix())
xsDataOrientation.setMatrixU(xsDataLabelitMosflmScriptsOutput.getUMatrix())
xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation)
xsDataStatisticsIndexing = XSDataStatisticsIndexing()
if (_xsDataExperimentalCondition is not None):
fBeamPositionXOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionX().getValue()
fBeamPositionYOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionY().getValue()
fBeamPositionXNew = xsDataLabelitScreenOutput.getBeamCentreX().getValue()
fBeamPositionYNew = xsDataLabelitScreenOutput.getBeamCentreY().getValue()
xsDataStatisticsIndexing.setBeamPositionShiftX(XSDataLength(fBeamPositionXOrig - fBeamPositionXNew))
xsDataStatisticsIndexing.setBeamPositionShiftY(XSDataLength(fBeamPositionYOrig - fBeamPositionYNew))
# xsDataStatisticsIndexing.setSpotDeviXSDataLength( dDistanceRefinedationAngular( XSDataAngle( dDeviationAngular ) )
xsDataStatisticsIndexing.setSpotDeviationPositional(XSDataLength(fRmsdSelected))
xsDataStatisticsIndexing.setSpotsUsed(XSDataInteger(iNumberOfSpotsSelected))
xsDataStatisticsIndexing.setSpotsTotal(XSDataInteger(iNumberOfSpotsSelected))
xsDataIndexingSolutionSelected.setStatistics(xsDataStatisticsIndexing)
xsDataExperimentalConditionRefined = None
if (_xsDataExperimentalCondition is None):
xsDataExperimentalConditionRefined = XSDataExperimentalCondition()
else:
# Copy the incoming experimental condition
xmlExperimentalCondition = _xsDataExperimentalCondition.marshal()
xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition)
xsDataDetector = xsDataExperimentalConditionRefined.getDetector()
if (xsDataDetector is None):
xsDataDetector = XSDataDetector()
xsDataDetector.setBeamPositionX(xsDataLabelitScreenOutput.getBeamCentreX())
xsDataDetector.setBeamPositionY(xsDataLabelitScreenOutput.getBeamCentreY())
xsDataDetector.setDistance(xsDataLabelitScreenOutput.getDistance())
xsDataExperimentalConditionRefined.setDetector(xsDataDetector)
xsDataIndexingSolutionSelected.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)
xsDataIndexingResult.setSelectedSolution(xsDataIndexingSolutionSelected)
xsDataIndexingResult.setIndexingLogFile(xsDataLabelitScreenOutput.getPathToLogFile())
return xsDataIndexingResult
示例10: testSetDataModelInput
def testSetDataModelInput(self):
from XSDataCCP4iv1_1 import XSDataInputCCP4i
xsDataInputCCP4i = XSDataInputCCP4i()
# Beam
from XSDataCommon import XSDataFlux
from XSDataCommon import XSDataSize
from XSDataCommon import XSDataLength
from XSDataCommon import XSDataFloat
from XSDataMXv1 import XSDataBeam
from XSDataMXv1 import XSDataExperimentalCondition
xsExperimentalCondition = XSDataExperimentalCondition()
xsBeam = XSDataBeam()
xsBeam.setFlux(XSDataFlux(1e+12))
xsBeam.setSize(XSDataSize(XSDataLength(0.1), XSDataLength(0.1)))
xsBeam.setMinExposureTimePerImage(XSDataFloat(0.1))
xsExperimentalCondition.setBeam(xsBeam)
# Goniostat
from XSDataCommon import XSDataSpeed
from XSDataCommon import XSDataAngle
from XSDataMXv1 import XSDataGoniostat
xsDataGoniostat = XSDataGoniostat()
xsDataGoniostat.setMaxOscillationSpeed(XSDataSpeed(0.2))
xsDataGoniostat.setMinOscillationWidth(XSDataAngle(0.1))
xsExperimentalCondition.setGoniostat(xsDataGoniostat)
xsDataInputCCP4i.setExperimentalCondition(xsExperimentalCondition)
# Sample
from XSDataCommon import XSDataString
from XSDataCommon import XSDataFloat
from XSDataCommon import XSDataString
from XSDataMXv1 import XSDataStructure
from XSDataMXv1 import XSDataChain
from XSDataMXv1 import XSDataAtom
from XSDataMXv1 import XSDataLigand
from XSDataMXv1 import XSDataSampleCrystalMM
from XSDataMXv1 import XSDataChemicalCompositionMM
from XSDataMXv1 import XSDataAtomicComposition
from XSDataMXv1 import XSDataSolvent
xsDataSampleCrystalMM = XSDataSampleCrystalMM()
xsDataStructure = XSDataStructure()
xsDataComposition = XSDataChemicalCompositionMM()
xsDataChain = XSDataChain()
xsDataChain.setType(XSDataString("protein"))
xsDataChain.setNumberOfCopies(XSDataFloat(2))
xsDataAtomicComposition = XSDataAtomicComposition()
xsDataAtom1 = XSDataAtom()
xsDataAtom1.setSymbol(XSDataString("Se"))
xsDataAtom1.setNumberOf(XSDataFloat(4))
xsDataAtomicComposition.addAtom(xsDataAtom1)
xsDataChain.setHeavyAtoms(xsDataAtomicComposition)
xsDataChain.setNumberOfMonomers(XSDataFloat(100))
xsDataStructure.addChain(xsDataChain)
xsDataChain2 = XSDataChain()
xsDataChain2.setType(XSDataString("rna"))
xsDataChain2.setNumberOfCopies(XSDataFloat(1))
xsDataChain2.setNumberOfMonomers(XSDataFloat(60))
xsDataStructure.addChain(xsDataChain2)
xsDataLigand = XSDataLigand()
xsDataLigand.setNumberOfCopies(XSDataFloat(2))
xsDataLigand.setNumberOfLightAtoms(XSDataFloat(42))
xsDataAtomicComposition = XSDataAtomicComposition()
xsDataAtom2 = XSDataAtom()
xsDataAtom2.setSymbol(XSDataString("Fe"))
xsDataAtom2.setNumberOf(XSDataFloat(1))
xsDataAtomicComposition.addAtom(xsDataAtom2)
xsDataLigand.setHeavyAtoms(xsDataAtomicComposition)
xsDataStructure.addLigand(xsDataLigand)
xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataFloat(0.25))
xsDataSolvent = XSDataSolvent()
xsDataAtomicComposition = XSDataAtomicComposition()
xsDataAtom3 = XSDataAtom()
xsDataAtom3.setSymbol(XSDataString("Na"))
xsDataAtom3.setConcentration(XSDataFloat(1000))
xsDataAtom4 = XSDataAtom()
xsDataAtom4.setSymbol(XSDataString("Cl"))
xsDataAtom4.setConcentration(XSDataFloat(1000))
xsDataAtomicComposition.addAtom(xsDataAtom3)
xsDataAtomicComposition.addAtom(xsDataAtom4)
xsDataSolvent.setAtoms(xsDataAtomicComposition)
xsDataComposition.setStructure(xsDataStructure)
xsDataComposition.setSolvent(xsDataSolvent)
xsDataSampleCrystalMM.setChemicalComposition(xsDataComposition)
#.........这里部分代码省略.........
示例11: buildChildren
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'experimentalCondition':
obj_ = XSDataExperimentalCondition()
obj_.build(child_)
self.setExperimentalCondition(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'diffractionPlan':
obj_ = XSDataDiffractionPlan()
obj_.build(child_)
self.setDiffractionPlan(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'sample':
obj_ = XSDataSampleCrystalMM()
obj_.build(child_)
self.setSample(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'imagePath':
obj_ = XSDataFile()
obj_.build(child_)
self.imagePath.append(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'flux':
obj_ = XSDataFloat()
obj_.build(child_)
self.setFlux(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'minExposureTimePerImage':
obj_ = XSDataTime()
obj_.build(child_)
self.setMinExposureTimePerImage(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'beamSize':
obj_ = XSDataLength()
obj_.build(child_)
self.setBeamSize(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'beamSizeX':
obj_ = XSDataLength()
obj_.build(child_)
self.setBeamSizeX(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'beamSizeY':
obj_ = XSDataLength()
obj_.build(child_)
self.setBeamSizeY(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'templateMode':
obj_ = XSDataBoolean()
obj_.build(child_)
self.setTemplateMode(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'generatedTemplateFile':
obj_ = XSDataFile()
obj_.build(child_)
self.setGeneratedTemplateFile(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'resultsFilePath':
obj_ = XSDataFile()
obj_.build(child_)
self.setResultsFilePath(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'beamPosX':
obj_ = XSDataFloat()
obj_.build(child_)
self.setBeamPosX(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'beamPosY':
obj_ = XSDataFloat()
obj_.build(child_)
self.setBeamPosY(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'wavelength':
obj_ = XSDataWavelength()
obj_.build(child_)
self.setWavelength(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'transmission':
obj_ = XSDataDouble()
obj_.build(child_)
self.setTransmission(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'dataCollectionId':
obj_ = XSDataInteger()
obj_.build(child_)
self.setDataCollectionId(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'shortComments':
obj_ = XSDataString()
obj_.build(child_)
self.setShortComments(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'comments':
obj_ = XSDataString()
obj_.build(child_)
self.setComments(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'inputCharacterisation':
obj_ = XSDataInputCharacterisation()
obj_.build(child_)
#.........这里部分代码省略.........
示例12: generateXSDataIntegrationSubWedgeResult
def generateXSDataIntegrationSubWedgeResult(_xsDataMOSFLMOutputIntegration, _xsDataExperimentalCondition=None):
"""
Translation from XSDataMOSFLMOutputIntegration to XSDataIntegrationSubWedgeResult.
"""
EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationInput")
EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult()
xsDataExperimentalConditionRefined = None
if (_xsDataExperimentalCondition is None):
xsDataExperimentalConditionRefined = XSDataExperimentalCondition()
else:
# Copy the incoming experimental condition
xmlExperimentalCondition = _xsDataExperimentalCondition.marshal()
xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition)
xsDataDetector = xsDataExperimentalConditionRefined.getDetector()
if (xsDataDetector is None):
xsDataDetector = XSDataDetector()
xsDataIntegrationSubWedgeResult.setBestfilePar(XSDataString(_xsDataMOSFLMOutputIntegration.getBestfilePar().getValue()))
xsDataIntegrationSubWedgeResult.setBestfileDat(XSDataString(_xsDataMOSFLMOutputIntegration.getBestfileDat().getValue()))
xsDataIntegrationSubWedgeResult.setBestfileHKL(XSDataString(_xsDataMOSFLMOutputIntegration.getBestfileHKL().getValue()))
xsDataLengthRefinedDistance = _xsDataMOSFLMOutputIntegration.getRefinedDistance()
if (xsDataLengthRefinedDistance is not None):
xsDataDetector.setDistance(xsDataLengthRefinedDistance)
xsDataMOSFLMBeamPositionRefined = _xsDataMOSFLMOutputIntegration.getRefinedBeam()
if (xsDataMOSFLMBeamPositionRefined is not None):
xsDataDetector.setBeamPositionX(XSDataLength(xsDataMOSFLMBeamPositionRefined.getX().getValue()))
xsDataDetector.setBeamPositionY(XSDataLength(xsDataMOSFLMBeamPositionRefined.getY().getValue()))
xsDataExperimentalConditionRefined.setDetector(xsDataDetector)
xsDataIntegrationSubWedgeResult.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)
if (_xsDataMOSFLMOutputIntegration.getGeneratedMTZFile() is not None):
xsDataIntegrationSubWedgeResult.setGeneratedMTZFile(_xsDataMOSFLMOutputIntegration.getGeneratedMTZFile())
xsDataStatisticsIntegration = XSDataStatisticsIntegration()
if (_xsDataMOSFLMOutputIntegration.getOverallIOverSigma() is not None):
xsDataStatisticsIntegration.setIOverSigmaOverall(XSDataDouble(_xsDataMOSFLMOutputIntegration.getOverallIOverSigma().getValue()))
if (_xsDataMOSFLMOutputIntegration.getHighestResolutionIOverSigma() is not None):
xsDataStatisticsIntegration.setIOverSigmaAtHighestResolution(XSDataDouble(_xsDataMOSFLMOutputIntegration.getHighestResolutionIOverSigma().getValue()))
if (_xsDataMOSFLMOutputIntegration.getRMSSpotDeviation() is not None):
xsDataStatisticsIntegration.setRMSSpotDeviation(XSDataLength(_xsDataMOSFLMOutputIntegration.getRMSSpotDeviation().getValue()))
if (_xsDataMOSFLMOutputIntegration.getNumberOfBadReflections() is not None):
xsDataStatisticsIntegration.setNumberOfBadReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfBadReflections().getValue()))
if (_xsDataMOSFLMOutputIntegration.getNumberOfFullyRecordedReflections() is not None):
xsDataStatisticsIntegration.setNumberOfFullyRecordedReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfFullyRecordedReflections().getValue()))
if (_xsDataMOSFLMOutputIntegration.getNumberOfNegativeReflections() is not None):
xsDataStatisticsIntegration.setNumberOfNegativeReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfNegativeReflections().getValue()))
if (_xsDataMOSFLMOutputIntegration.getNumberOfOverlappedReflections() is not None):
xsDataStatisticsIntegration.setNumberOfOverlappedReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfOverlappedReflections().getValue()))
if (_xsDataMOSFLMOutputIntegration.getNumberOfPartialReflections() is not None):
xsDataStatisticsIntegration.setNumberOfPartialReflections(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfPartialReflections().getValue()))
if (_xsDataMOSFLMOutputIntegration.getNumberOfReflectionsGenerated() is not None):
xsDataStatisticsIntegration.setNumberOfReflectionsGenerated(XSDataInteger(_xsDataMOSFLMOutputIntegration.getNumberOfReflectionsGenerated().getValue()))
xsDataIntegrationSubWedgeResult.setStatistics(xsDataStatisticsIntegration)
xsDataIntegrationSubWedgeResult.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)
for xsDataMOSFLMIntegrationStatisticsPerResolutionBin in _xsDataMOSFLMOutputIntegration.getStatisticsPerResolutionBin():
xsDataStatisticsIntegrationPerResolutionBin = XSDataStatisticsIntegrationPerResolutionBin()
if (xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMaxResolution() is not None):
xsDataStatisticsIntegrationPerResolutionBin.setMaxResolution(XSDataDouble(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMaxResolution().getValue()))
if (xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMinResolution() is not None):
xsDataStatisticsIntegrationPerResolutionBin.setMinResolution(XSDataDouble(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMinResolution().getValue()))
xsDataStatisticsIntegrationPerResolutionBin.setProfileFitted(EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationStatisticsPerReflectionType(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getProfileFitted()))
xsDataStatisticsIntegrationPerResolutionBin.setSummation(EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationStatisticsPerReflectionType(xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getSummation()))
xsDataIntegrationSubWedgeResult.addStatisticsPerResolutionBin(xsDataStatisticsIntegrationPerResolutionBin)
return xsDataIntegrationSubWedgeResult
示例13: generateXSDataIndexingResult
def generateXSDataIndexingResult(_xsDataMOSFLMIndexingOutput, _xsDataExperimentalCondition=None):
"""
Translation from XSDataMOSFLMIndexingOutput to XSDataIndexingResult.
"""
EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataIndexingOutput")
xsDataMOSFLMBeamPositionRefined = _xsDataMOSFLMIndexingOutput.getRefinedBeam()
xsDataMOSFLMBeamPositionShift = _xsDataMOSFLMIndexingOutput.getBeamShift()
dDeviationAngular = _xsDataMOSFLMIndexingOutput.getDeviationAngular().getValue()
dDeviationPositional = _xsDataMOSFLMIndexingOutput.getDeviationPositional().getValue()
dMosaicityEstimation = _xsDataMOSFLMIndexingOutput.getMosaicityEstimation().getValue()
dDistanceRefined = _xsDataMOSFLMIndexingOutput.getRefinedDistance().getValue()
iSelectedSolution = _xsDataMOSFLMIndexingOutput.getSelectedSolutionNumber().getValue()
iSpotsTotal = _xsDataMOSFLMIndexingOutput.getSpotsTotal().getValue()
iSpotsUsed = _xsDataMOSFLMIndexingOutput.getSpotsUsed().getValue()
xsDataCellRefined = _xsDataMOSFLMIndexingOutput.getRefinedNewmat().getRefinedCell()
xsDataMatrixA = _xsDataMOSFLMIndexingOutput.getRefinedNewmat().getAMatrix()
xsDataMatrixU = _xsDataMOSFLMIndexingOutput.getRefinedNewmat().getUMatrix()
strSelectedSpaceGroupName = _xsDataMOSFLMIndexingOutput.getSelectedSolutionSpaceGroup().getValue()
iSelectedSpaceGroupNumber = _xsDataMOSFLMIndexingOutput.getSelectedSolutionSpaceGroupNumber().getValue()
xsDataIndexingResult = XSDataIndexingResult()
xsDataIndexingSolutionSelected = None
for possibleSolutions in _xsDataMOSFLMIndexingOutput.getPossibleSolutions():
xsDataCrystal = XSDataCrystal()
xsDataSpaceGroup = XSDataSpaceGroup()
xsDataSpaceGroup.setName(XSDataString(possibleSolutions.getLattice().getValue()))
xsDataCrystal.setSpaceGroup(xsDataSpaceGroup)
xsDataCrystal.setCell(possibleSolutions.getCell())
xsDataIndexingSolution = XSDataIndexingSolution()
xsDataIndexingSolution.setCrystal(xsDataCrystal)
iIndex = possibleSolutions.getIndex().getValue()
xsDataIndexingSolution.setNumber(XSDataInteger(iIndex))
xsDataIndexingSolution.setPenalty(XSDataFloat(possibleSolutions.getPenalty().getValue()))
xsDataIndexingResult.addSolution(xsDataIndexingSolution)
if (iIndex == iSelectedSolution):
xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected()
xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex))
xsDataIndexingSolutionSelected.setPenalty(XSDataFloat(possibleSolutions.getPenalty().getValue()))
xsDataCrystalSelected = XSDataCrystal()
xsDataSpaceGroupSelected = XSDataSpaceGroup()
xsDataSpaceGroupSelected.setName(XSDataString(strSelectedSpaceGroupName))
xsDataSpaceGroupSelected.setITNumber(XSDataInteger(iSelectedSpaceGroupNumber))
xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected)
xsDataCrystalSelected.setCell(xsDataCellRefined)
xsDataCrystalSelected.setMosaicity(XSDataDouble(dMosaicityEstimation))
xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected)
xsDataOrientation = XSDataOrientation()
xsDataOrientation.setMatrixA(xsDataMatrixA)
xsDataOrientation.setMatrixU(xsDataMatrixU)
xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation)
xsDataStatisticsIndexing = XSDataStatisticsIndexing()
xsDataStatisticsIndexing.setBeamPositionShiftX(XSDataLength(xsDataMOSFLMBeamPositionShift.getX().getValue()))
xsDataStatisticsIndexing.setBeamPositionShiftY(XSDataLength(xsDataMOSFLMBeamPositionShift.getY().getValue()))
xsDataStatisticsIndexing.setSpotDeviationAngular(XSDataAngle(dDeviationAngular))
xsDataStatisticsIndexing.setSpotDeviationPositional(XSDataLength(dDeviationPositional))
xsDataStatisticsIndexing.setSpotsUsed(XSDataInteger(iSpotsUsed))
xsDataStatisticsIndexing.setSpotsTotal(XSDataInteger(iSpotsTotal))
xsDataIndexingSolutionSelected.setStatistics(xsDataStatisticsIndexing)
xsDataExperimentalConditionRefined = None
if (_xsDataExperimentalCondition is None):
xsDataExperimentalConditionRefined = XSDataExperimentalCondition()
else:
# Copy the incoming experimental condition
xmlExperimentalCondition = _xsDataExperimentalCondition.marshal()
xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition)
xsDataDetector = xsDataExperimentalConditionRefined.getDetector()
if (xsDataDetector is None):
xsDataDetector = XSDataDetector()
xsDataDetector.setBeamPositionX(XSDataLength(xsDataMOSFLMBeamPositionRefined.getX().getValue()))
xsDataDetector.setBeamPositionY(XSDataLength(xsDataMOSFLMBeamPositionRefined.getY().getValue()))
xsDataDetector.setDistance(XSDataLength(dDistanceRefined))
xsDataExperimentalConditionRefined.setDetector(xsDataDetector)
xsDataIndexingSolutionSelected.setExperimentalConditionRefined(xsDataExperimentalConditionRefined)
xsDataIndexingResult.setSelectedSolution(xsDataIndexingSolutionSelected)
return xsDataIndexingResult
示例14: process
def process(self, _edObject=None):
EDPluginExec.process(self)
EDVerbose.DEBUG("EDPluginExecReadImageHeaderMARCCDv10.process")
xsDataInputReadImageHeader = self.getDataInput()
xsDataFile = xsDataInputReadImageHeader.getImage()
strPath = xsDataFile.getPath().getValue()
dictMARCCDHeader = self.readHeaderMarccd(strPath)
if (dictMARCCDHeader is None):
strErrorMessage = "EDPluginExecReadImageHeaderMARCCDv10.process : Cannot read header : %s" % strPath
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
else:
xsDataExperimentalCondition = XSDataExperimentalCondition()
xsDataDetector = XSDataDetector()
iNoPixelsX = int(dictMARCCDHeader[ "nslow" ])
iNoPixelsY = int(dictMARCCDHeader[ "nfast" ])
xsDataDetector.setNumberPixelX(XSDataInteger(iNoPixelsX))
xsDataDetector.setNumberPixelY(XSDataInteger(iNoPixelsY))
fPixelSizeX = float(dictMARCCDHeader[ "pixelsize_x" ]) / 1000.0
xsDataDetector.setPixelSizeX(XSDataLength(fPixelSizeX))
fPixelSizeY = float(dictMARCCDHeader[ "pixelsize_y" ]) / 1000.0
xsDataDetector.setPixelSizeY(XSDataLength(fPixelSizeY))
fBeamPositionX = float(dictMARCCDHeader[ "beam_x" ]) / 1000.0
fBeamPositionY = float(dictMARCCDHeader[ "beam_y" ]) / 1000.0
# Fix for bug 397 - check if the beam position is close to the centre of the image
fTwoTheta = float(dictMARCCDHeader[ "end_twotheta" ]) / 1000.0
xsDataDetector.setTwoTheta(XSDataAngle(fTwoTheta))
if (abs(fTwoTheta) < 0.1):
if (abs(fBeamPositionX / (fPixelSizeX / 1000.0) - iNoPixelsX / 2.0) > (2 * iNoPixelsX)):
fBeamPositionX = fBeamPositionX * fPixelSizeX / 1000.0
fBeamPositionY = fBeamPositionY * fPixelSizeY / 1000.0
xsDataDetector.setBeamPositionX(XSDataLength(fBeamPositionX))
xsDataDetector.setBeamPositionY(XSDataLength(fBeamPositionY))
fDistance = float(dictMARCCDHeader[ "xtal_to_detector" ]) / 1000.0
if (abs(fDistance) < 0.1):
fDistanceStart = float(dictMARCCDHeader[ "start_xtal_to_detector" ]) / 1000.0
fDistanceEnd = float(dictMARCCDHeader[ "end_xtal_to_detector" ]) / 1000.0
if (abs(fDistanceStart - fDistanceEnd) < 0.1):
fDistance = fDistanceStart
else:
# Somethings very wrong with the distances...
strErrorMessage = "EDPluginExecReadImageHeaderMARCCDv10.process : Inconsistency in MAR CCD image header: start_xtal_to_detector = %d, end_xtal_to_detector = %d" % \
(fDistanceStart, fDistanceEnd)
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
xsDataDetector.setDistance(XSDataLength(fDistance))
xsDataDetector.setNumberBytesInHeader(XSDataInteger(float(dictMARCCDHeader[ "header_size" ])))
# xsDataDetector.setSerialNumber( XSDataInteger( dictMARCCDHeader[ "DETECTOR_SN" ] ) ) )
# xsDataDetector.setBin( XSDataString( dictMARCCDHeader[ "BIN" ] ) ) )
# xsDataDetector.setDataType( XSDataString( dictMARCCDHeader[ "TYPE" ] ) ) )
# xsDataDetector.setByteOrder( XSDataString( dictMARCCDHeader[ "BYTE_ORDER" ] ) ) )
xsDataDetector.setImageSaturation(XSDataInteger(int(dictMARCCDHeader[ "saturation_level" ])))
# Determine type of detector...
if (iNoPixelsX == 2048 and iNoPixelsY == 2048):
xsDataDetector.setName(XSDataString("MAR CCD 165"))
xsDataDetector.setType(XSDataString("mar165"))
elif (iNoPixelsX == 3072 and iNoPixelsY == 3072):
xsDataDetector.setName(XSDataString("MAR CCD 225"))
xsDataDetector.setType(XSDataString("mar225"))
elif (iNoPixelsX == 4096 and iNoPixelsY == 4096):
xsDataDetector.setName(XSDataString("MAR CCD 325"))
xsDataDetector.setType(XSDataString("mar325"))
else:
strErrorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginExecReadImageHeaderMARCCDv10.process", "Unknown detector type")
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
raise RuntimeError, strErrorMessage
xsDataExperimentalCondition.setDetector(xsDataDetector)
# Beam object
xsDataBeam = XSDataBeam()
xsDataBeam.setWavelength(XSDataWavelength(float(dictMARCCDHeader[ "source_wavelength" ]) / 100000.0))
xsDataBeam.setExposureTime(XSDataTime(float(dictMARCCDHeader[ "exposure_time" ]) / 1000.0))
xsDataExperimentalCondition.setBeam(xsDataBeam)
# Goniostat object
xsDataGoniostat = XSDataGoniostat()
fRotationAxisStart = float(dictMARCCDHeader[ "start_phi" ]) / 1000.0
fOscillationWidth = float(dictMARCCDHeader[ "rotation_range" ]) / 1000.0
xsDataGoniostat.setRotationAxisStart(XSDataAngle(fRotationAxisStart))
xsDataGoniostat.setRotationAxisEnd(XSDataAngle(fRotationAxisStart + fOscillationWidth))
xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth))
xsDataExperimentalCondition.setGoniostat(xsDataGoniostat)
# Create the image object
xsDataImage = XSDataImage()
xsDataImage.setPath(XSDataString(strPath))
strTimeStamp = dictMARCCDHeader[ "acquire_timestamp" ]
xsDataImage.setDate(XSDataString(strTimeStamp))
iImageNumber = EDUtilsImage.getImageNumber(strPath)
xsDataImage.setNumber(XSDataInteger(iImageNumber))
xsDataSubWedge = XSDataSubWedge()
xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
xsDataSubWedge.addImage(xsDataImage)
#.........这里部分代码省略.........
示例15: getXSDataResultStrategy
def getXSDataResultStrategy(self, _xsDataResultBest, _xsDataExperimentalCondition, _xsDataSample):
xsDataResultStrategy = XSDataResultStrategy()
listXSDataBestCollectionPlan = _xsDataResultBest.getCollectionPlan()
for xsDataBestCollectionPlan in listXSDataBestCollectionPlan:
xsDataCollectionPlan = XSDataCollectionPlan()
xsDataCollectionStrategy = XSDataCollection()
xsDataBestStrategySummary = xsDataBestCollectionPlan.getStrategySummary()
xsDataDoubleTransmission = xsDataBestStrategySummary.getTransmission()
for xsDataBestCollectionRun in xsDataBestCollectionPlan.getCollectionRun():
xsDataSubWedge = XSDataSubWedge()
strXmlStringDataExperimentalCondition = _xsDataExperimentalCondition.marshal()
xsDataExperimentalCondition = XSDataExperimentalCondition.parseString(
strXmlStringDataExperimentalCondition
)
xsDataExperimentalCondition.getBeam().setExposureTime(xsDataBestCollectionRun.getExposureTime())
if xsDataBestCollectionRun.getTransmission() is None:
xsDataExperimentalCondition.getBeam().setTransmission(xsDataDoubleTransmission)
else:
xsDataExperimentalCondition.getBeam().setTransmission(xsDataBestCollectionRun.getTransmission())
xsDataExperimentalCondition.getDetector().setDistance(xsDataBestStrategySummary.getDistance())
xsDataExperimentalCondition.getGoniostat().setRotationAxisStart(xsDataBestCollectionRun.getPhiStart())
xsDataExperimentalCondition.getGoniostat().setOscillationWidth(xsDataBestCollectionRun.getPhiWidth())
fRotationAxisEnd = (
xsDataBestCollectionRun.getPhiStart().getValue()
+ xsDataBestCollectionRun.getNumberOfImages().getValue()
* xsDataBestCollectionRun.getPhiWidth().getValue()
)
xsDataExperimentalCondition.getGoniostat().setRotationAxisEnd(XSDataAngle(fRotationAxisEnd))
xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
xsDataSubWedge.setSubWedgeNumber(xsDataBestCollectionRun.getCollectionRunNumber())
if xsDataBestCollectionRun.getCrystalPosition():
xsDataSubWedge.setAction(
XSDataString("Crystal position: %d" % xsDataBestCollectionRun.getCrystalPosition().getValue())
)
else:
xsDataSubWedge.setAction(xsDataBestCollectionRun.getAction())
xsDataCollectionStrategy.addSubWedge(xsDataSubWedge)
xsDataCollectionStrategy.setSample(_xsDataSample)
xsDataCollectionPlan.setCollectionStrategy(xsDataCollectionStrategy)
xsDataStrategySummary = XSDataStrategySummary()
xsDataStrategySummary.setCompleteness(xsDataBestStrategySummary.getCompleteness())
xsDataStrategySummary.setISigma(xsDataBestStrategySummary.getISigma())
xsDataStrategySummary.setRankingResolution(xsDataBestStrategySummary.getRankingResolution())
xsDataStrategySummary.setRedundancy(xsDataBestStrategySummary.getRedundancy())
xsDataStrategySummary.setResolution(xsDataBestStrategySummary.getResolution())
xsDataStrategySummary.setResolutionReasoning(xsDataBestStrategySummary.getResolutionReasoning())
xsDataStrategySummary.setTotalDataCollectionTime(xsDataBestStrategySummary.getTotalDataCollectionTime())
xsDataStrategySummary.setTotalExposureTime(xsDataBestStrategySummary.getTotalExposureTime())
xsDataCollectionPlan.setStrategySummary(xsDataStrategySummary)
if xsDataBestCollectionPlan.getStatisticalPrediction() is not None:
xsDataStatisticsStrategy = XSDataStatisticsStrategy.parseString(
xsDataBestCollectionPlan.getStatisticalPrediction().marshal()
)
xsDataCollectionPlan.setStatistics(xsDataStatisticsStrategy)
xsDataCollectionPlan.setCollectionPlanNumber(xsDataBestCollectionPlan.getCollectionPlanNumber())
xsDataResultStrategy.addCollectionPlan(xsDataCollectionPlan)
if _xsDataResultBest.getPathToLogFile() != None:
xsDataResultStrategy.setBestLogFile(_xsDataResultBest.getPathToLogFile())
return xsDataResultStrategy