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
def getXSDataStrategyResult(self, _xsDataBestOutput, _xsDataExperimentalCondition, _xsDataSample): xsDataStrategyResult = XSDataStrategyResult() #xsDataCollectionRunsBest = _xsDataBestOutput.getCollectionRun() xsDataCollectionPlansBest = _xsDataBestOutput.getCollectionPlan() for xsDataCollectionPlanBest in xsDataCollectionPlansBest: xsDataCollectionPlan = XSDataCollectionPlan() xsDataCollectionStrategy = XSDataCollection() for xsDataCollectionRunBest in xsDataCollectionPlanBest.getCollectionRun(): xsDataSubWedge = XSDataSubWedge() strXmlStringDataExperimentalCondition = _xsDataExperimentalCondition.marshal() xsDataExperimentalCondition = XSDataExperimentalCondition.parseString(strXmlStringDataExperimentalCondition) xsDataExperimentalCondition.getBeam().setExposureTime(xsDataCollectionRunBest.getExposureTime()) 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) xsDataCollectionStrategy.addSubWedge(xsDataSubWedge) xsDataCollectionStrategy.setSample(_xsDataSample) xsDataCollectionPlan.setCollectionStrategy(xsDataCollectionStrategy) xsDataStrategySummary = xsDataCollectionPlanBest.getStrategySummary() xsDataCollectionPlan.setStrategySummary(xsDataStrategySummary) xsDataStatistics = xsDataCollectionPlanBest.getStatisticalPrediction() xsDataCollectionPlan.setStatistics(xsDataStatistics) xsDataStrategyResult.addCollectionPlan(xsDataCollectionPlan) return xsDataStrategyResult
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
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