def generateLegacyXSDataISPyBStrategy(_xsDataResultCharacterisation, _xsDataISPyBScreeningOutputContainer): # Anomalus data bAnomalousData = False xsDataCollection = _xsDataResultCharacterisation.dataCollection if xsDataCollection is not None: xsDataDiffractionPlan = xsDataCollection.diffractionPlan if xsDataDiffractionPlan is not None: if xsDataDiffractionPlan.anomalousData is not None: bAnomalousData = xsDataDiffractionPlan.getAnomalousData().getValue() # Use the existing xsDataISPyBScreeningStrategy in the _xsDataISPyBScreeningOutputContainer for the first sub wedge: if len(_xsDataISPyBScreeningOutputContainer.screeningStrategyContainer) > 0: xsDataISPyBScreeningStrategyContainerFirst = _xsDataISPyBScreeningOutputContainer.screeningStrategyContainer[0] xsDataISPyBScreeningStrategyFirst = xsDataISPyBScreeningStrategyContainerFirst.screeningStrategy # Strategy information bFirstStrategy = True xsDataResultStrategy = _xsDataResultCharacterisation.getStrategyResult() if (xsDataResultStrategy is not None): pyListXSDataCollectionPlan = xsDataResultStrategy.getCollectionPlan() if (pyListXSDataCollectionPlan is not None): for xsDataCollectionPlan in pyListXSDataCollectionPlan: iCollectionPlanNumber = xsDataCollectionPlan.getCollectionPlanNumber().getValue() pyStrCollectionPlanComment = None if (xsDataCollectionPlan.getComment() is not None): pyStrCollectionPlanComment = xsDataCollectionPlan.getComment().getValue() fCompleteness = None fMultiplicity = None fResolution = None fRankingResolution = None fTransmission = None xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary() if (xsDataStrategySummary is not None): if (xsDataStrategySummary.getCompleteness() is not None): fCompleteness = xsDataStrategySummary.getCompleteness().getValue() if (xsDataStrategySummary.getRedundancy() is not None): fMultiplicity = xsDataStrategySummary.getRedundancy().getValue() if (xsDataStrategySummary.getResolution() is not None): fResolution = xsDataStrategySummary.getResolution().getValue() if (xsDataStrategySummary.getRankingResolution() is not None): fRankingResolution = xsDataStrategySummary.getRankingResolution().getValue() xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy() if (xsDataCollectionStrategy is not None): pyListXSDataSubWedge = xsDataCollectionStrategy.getSubWedge() if (pyListXSDataSubWedge is not None): for xsDataSubWedge in pyListXSDataSubWedge: iSubWedgeNumber = xsDataSubWedge.getSubWedgeNumber().getValue() if bFirstStrategy: xsDataISPyBScreeningStrategy = xsDataISPyBScreeningStrategyFirst else: xsDataISPyBScreeningStrategy = XSDataISPyBScreeningStrategy() xsDataISPyBScreeningStrategyContainer = XSDataISPyBScreeningStrategyContainer() xsDataISPyBScreeningStrategyContainer.screeningStrategy = xsDataISPyBScreeningStrategy fPhiStart = xsDataSubWedge.getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue() fPhiEnd = xsDataSubWedge.getExperimentalCondition().getGoniostat().getRotationAxisEnd().getValue() fRotation = xsDataSubWedge.getExperimentalCondition().getGoniostat().getOscillationWidth().getValue() fExposureTime = xsDataSubWedge.getExperimentalCondition().getBeam().getExposureTime().getValue() fTransmission = None if xsDataSubWedge.experimentalCondition.beam.transmission: fTransmission = xsDataSubWedge.experimentalCondition.beam.transmission.value pyStrProgram = "BEST: Wedge no %d," % iCollectionPlanNumber if (pyStrCollectionPlanComment is not None): pyStrProgram += " ( %s )" % pyStrCollectionPlanComment pyStrProgram += " sub wedge no %d" % iSubWedgeNumber xsDataISPyBScreeningStrategy.setPhiStart(XSDataDouble(fPhiStart)) xsDataISPyBScreeningStrategy.setPhiEnd(XSDataDouble(fPhiEnd)) xsDataISPyBScreeningStrategy.setRotation(XSDataDouble(fRotation)) xsDataISPyBScreeningStrategy.setExposureTime(XSDataDouble(fExposureTime)) if fTransmission is not None: xsDataISPyBScreeningStrategy.transmission = XSDataDouble(fTransmission) if (fCompleteness is not None): xsDataISPyBScreeningStrategy.setCompleteness(XSDataDouble(fCompleteness)) if (fMultiplicity is not None): xsDataISPyBScreeningStrategy.setMultiplicity(XSDataDouble(fMultiplicity)) if (fResolution is not None): xsDataISPyBScreeningStrategy.setResolution(XSDataDouble(fResolution)) if (fRankingResolution is not None): xsDataISPyBScreeningStrategy.setRankingResolution(XSDataDouble(fRankingResolution)) if (bAnomalousData is not None): xsDataISPyBScreeningStrategy.setAnomalous(XSDataBoolean(bAnomalousData)) else: xsDataISPyBScreeningStrategy.setAnomalous(XSDataBoolean(False)) xsDataISPyBScreeningStrategy.setProgram(XSDataString(pyStrProgram)) if bFirstStrategy: bFirstStrategy = False else: _xsDataISPyBScreeningOutputContainer.addScreeningStrategyContainer(xsDataISPyBScreeningStrategyContainer)
def generateLegacyXSDataISPyBStrategy( _xsDataResultCharacterisation, _xsDataISPyBScreeningOutputContainer): # Anomalus data bAnomalousData = False xsDataCollection = _xsDataResultCharacterisation.dataCollection if xsDataCollection is not None: xsDataDiffractionPlan = xsDataCollection.diffractionPlan if xsDataDiffractionPlan is not None: if xsDataDiffractionPlan.anomalousData is not None: bAnomalousData = xsDataDiffractionPlan.getAnomalousData( ).getValue() # Use the existing xsDataISPyBScreeningStrategy in the _xsDataISPyBScreeningOutputContainer for the first sub wedge: if len(_xsDataISPyBScreeningOutputContainer.screeningStrategyContainer ) > 0: xsDataISPyBScreeningStrategyContainerFirst = _xsDataISPyBScreeningOutputContainer.screeningStrategyContainer[ 0] xsDataISPyBScreeningStrategyFirst = xsDataISPyBScreeningStrategyContainerFirst.screeningStrategy # Strategy information bFirstStrategy = True xsDataResultStrategy = _xsDataResultCharacterisation.getStrategyResult( ) if (xsDataResultStrategy is not None): pyListXSDataCollectionPlan = xsDataResultStrategy.getCollectionPlan( ) if (pyListXSDataCollectionPlan is not None): for xsDataCollectionPlan in pyListXSDataCollectionPlan: iCollectionPlanNumber = xsDataCollectionPlan.getCollectionPlanNumber( ).getValue() pyStrCollectionPlanComment = None if (xsDataCollectionPlan.getComment() is not None): pyStrCollectionPlanComment = xsDataCollectionPlan.getComment( ).getValue() fCompleteness = None fMultiplicity = None fResolution = None fRankingResolution = None fTransmission = None xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary( ) if (xsDataStrategySummary is not None): if (xsDataStrategySummary.getCompleteness() is not None): fCompleteness = xsDataStrategySummary.getCompleteness( ).getValue() if (xsDataStrategySummary.getRedundancy() is not None): fMultiplicity = xsDataStrategySummary.getRedundancy( ).getValue() if (xsDataStrategySummary.getResolution() is not None): fResolution = xsDataStrategySummary.getResolution( ).getValue() if (xsDataStrategySummary.getRankingResolution() is not None): fRankingResolution = xsDataStrategySummary.getRankingResolution( ).getValue() xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy( ) if (xsDataCollectionStrategy is not None): pyListXSDataSubWedge = xsDataCollectionStrategy.getSubWedge( ) if (pyListXSDataSubWedge is not None): for xsDataSubWedge in pyListXSDataSubWedge: iSubWedgeNumber = xsDataSubWedge.getSubWedgeNumber( ).getValue() if bFirstStrategy: xsDataISPyBScreeningStrategy = xsDataISPyBScreeningStrategyFirst else: xsDataISPyBScreeningStrategy = XSDataISPyBScreeningStrategy( ) xsDataISPyBScreeningStrategyContainer = XSDataISPyBScreeningStrategyContainer( ) xsDataISPyBScreeningStrategyContainer.screeningStrategy = xsDataISPyBScreeningStrategy fPhiStart = xsDataSubWedge.getExperimentalCondition( ).getGoniostat().getRotationAxisStart( ).getValue() fPhiEnd = xsDataSubWedge.getExperimentalCondition( ).getGoniostat().getRotationAxisEnd( ).getValue() fRotation = xsDataSubWedge.getExperimentalCondition( ).getGoniostat().getOscillationWidth( ).getValue() fExposureTime = xsDataSubWedge.getExperimentalCondition( ).getBeam().getExposureTime().getValue() fTransmission = None if xsDataSubWedge.experimentalCondition.beam.transmission: fTransmission = xsDataSubWedge.experimentalCondition.beam.transmission.value pyStrProgram = "BEST: Wedge no %d," % iCollectionPlanNumber if (pyStrCollectionPlanComment is not None): pyStrProgram += " ( %s )" % pyStrCollectionPlanComment pyStrProgram += " sub wedge no %d" % iSubWedgeNumber xsDataISPyBScreeningStrategy.setPhiStart( XSDataDouble(fPhiStart)) xsDataISPyBScreeningStrategy.setPhiEnd( XSDataDouble(fPhiEnd)) xsDataISPyBScreeningStrategy.setRotation( XSDataDouble(fRotation)) xsDataISPyBScreeningStrategy.setExposureTime( XSDataDouble(fExposureTime)) if fTransmission is not None: xsDataISPyBScreeningStrategy.transmission = XSDataDouble( fTransmission) if (fCompleteness is not None): xsDataISPyBScreeningStrategy.setCompleteness( XSDataDouble(fCompleteness)) if (fMultiplicity is not None): xsDataISPyBScreeningStrategy.setMultiplicity( XSDataDouble(fMultiplicity)) if (fResolution is not None): xsDataISPyBScreeningStrategy.setResolution( XSDataDouble(fResolution)) if (fRankingResolution is not None): xsDataISPyBScreeningStrategy.setRankingResolution( XSDataDouble(fRankingResolution)) if (bAnomalousData is not None): xsDataISPyBScreeningStrategy.setAnomalous( XSDataBoolean(bAnomalousData)) else: xsDataISPyBScreeningStrategy.setAnomalous( XSDataBoolean(False)) xsDataISPyBScreeningStrategy.setProgram( XSDataString(pyStrProgram)) if bFirstStrategy: bFirstStrategy = False else: _xsDataISPyBScreeningOutputContainer.addScreeningStrategyContainer( xsDataISPyBScreeningStrategyContainer )