def generateXSDataISPyBImage(_xsDataInputControlISPyB): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataString from XSDataISPyBv1_2 import XSDataISPyBImage xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult( ) xsDataISPyBImage = None # Find path to first image from data collection information strPathToFirstImage = None xsDataCollection = xsDataResultCharacterisation.getDataCollection() if (xsDataCollection is not None): lXSDataSubWedge = xsDataCollection.getSubWedge() if (lXSDataSubWedge is not None): xsDataSubWedgeFirst = lXSDataSubWedge[0] lXSDataImage = xsDataSubWedgeFirst.getImage() if (lXSDataImage is not None): xsDataImageFirst = lXSDataImage[0] strPathToFirstImage = xsDataImageFirst.getPath().getValue() # Add an image path if the dataCollectionId is not present... if (strPathToFirstImage is not None): xsDataISPyBImage = XSDataISPyBImage() strImageBaseName = EDUtilsFile.getBaseName(strPathToFirstImage) strDirectoryName = EDUtilsPath.getFolderName( strPathToFirstImage) xsDataISPyBImage.setFileName(XSDataString(strImageBaseName)) xsDataISPyBImage.setFileLocation( XSDataString(strDirectoryName)) return xsDataISPyBImage
def generateXSDataISPyBImage(_xsDataInputControlISPyB): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataString from XSDataISPyBv1_2 import XSDataISPyBImage xsDataResultCharacterisationv2_0 = _xsDataInputControlISPyB.getCharacterisationResult() xsDataResultCharacterisation = xsDataResultCharacterisationv2_0.getMxv1ResultCharacterisation() xsDataISPyBImage = None # Find path to first image from data collection information strPathToFirstImage = None xsDataCollection = xsDataResultCharacterisation.getDataCollection() if (xsDataCollection is not None): lXSDataSubWedge = xsDataCollection.getSubWedge() if (lXSDataSubWedge is not None): xsDataSubWedgeFirst = lXSDataSubWedge[0] lXSDataImage = xsDataSubWedgeFirst.getImage() if (lXSDataImage is not None): xsDataImageFirst = lXSDataImage[ 0 ] strPathToFirstImage = xsDataImageFirst.getPath().getValue() # Add an image path if the dataCollectionId is not present... if (strPathToFirstImage is not None): xsDataISPyBImage = XSDataISPyBImage() strImageBaseName = EDUtilsFile.getBaseName(strPathToFirstImage) strDirectoryName = EDUtilsPath.getFolderName(strPathToFirstImage) xsDataISPyBImage.setFileName(XSDataString(strImageBaseName)) xsDataISPyBImage.setFileLocation(XSDataString(strDirectoryName)) return xsDataISPyBImage
def configure(self): EDPluginExecProcessScript.configure(self) self.DEBUG("EDPluginBestv1_3.configure") self.setRequireCCP4(True) strScriptExecutable = self.getScriptExecutable() self.DEBUG("EDPluginBestv1_3.configure: Script Executable: " + strScriptExecutable) strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable) strBestHome = self.config.get(self.strCONF_BEST_HOME_LABEL, strBestScriptHome) self.setBestHome(strBestHome) self.DEBUG("EDPluginBestv1_3.configure: Best Home: " + strBestHome) self.setCommandBestHome("export besthome=" + self.getBestHome()) strVersion = self.config.get(self.CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING, "Unknown")
def configure(self): EDPluginExecProcessScript.configure(self) self.DEBUG("EDPluginBestv1_3.configure") self.setRequireCCP4(True) strScriptExecutable = self.getScriptExecutable() self.DEBUG("EDPluginBestv1_3.configure: Script Executable: " + strScriptExecutable) strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable) strBestHome = self.config.get(self.strCONF_BEST_HOME_LABEL, strBestScriptHome) self.setBestHome(strBestHome) self.DEBUG("EDPluginBestv1_3.configure: Best Home: " + strBestHome) self.setCommandBestHome("export besthome=" + self.getBestHome()) strVersion = self.config.get( self.CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING, "Unknown")
def configure(self): EDPluginExecProcessScript.configure(self) self.DEBUG("EDPluginBestv1_2.configure") self.setRequireCCP4(True) strScriptExecutable = self.getScriptExecutable() self.DEBUG("EDPluginBestv1_2.configure: Script Executable: " + strScriptExecutable) strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable) strBestHome = self.config.get(self.strCONF_BEST_HOME_LABEL, strBestScriptHome) self.setBestHome(strBestHome) self.DEBUG("EDPluginBestv1_2.configure: Best Home: " + strBestHome) self.setCommandBestHome("export besthome=" + self.getBestHome()) strVersion = self.config.get(self.CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING, "Unknown") # Check if version is higher than 4.1: try: if float(strVersion[8:11]) > 4.0: self.bVersionHigherThan4_0 = True except Exception, e: pass
def configure(self): EDPluginExecProcessScript.configure(self) self.DEBUG("EDPluginBestv1_2.configure") self.setRequireCCP4(True) strScriptExecutable = self.getScriptExecutable() self.DEBUG("EDPluginBestv1_2.configure: Script Executable: " + strScriptExecutable) strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable) strBestHome = self.config.get(self.strCONF_BEST_HOME_LABEL, strBestScriptHome) self.setBestHome(strBestHome) self.DEBUG("EDPluginBestv1_2.configure: Best Home: " + strBestHome) self.setCommandBestHome("export besthome=" + self.getBestHome()) strVersion = self.config.get( self.CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING, "Unknown") # Check if version is higher than 4.1: try: if float(strVersion[8:11]) > 4.0: self.bVersionHigherThan4_0 = True except Exception, e: pass
def configure(self): EDPluginExecProcessScript.configure(self) EDVerbose.DEBUG("EDPluginBestv1_2.configure") self.setRequireCCP4(True) strScriptExecutable = self.getScriptExecutable() EDVerbose.DEBUG("EDPluginBestv1_2.configure: Script Executable: " + strScriptExecutable) strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable) strBestHome = None pluginConfiguration = self.getConfiguration() if(pluginConfiguration == None): strBestHome = strBestScriptHome else: strBestHome = EDConfiguration.getStringParamValue(pluginConfiguration, self.__strCONF_BEST_HOME_LABEL) if(strBestHome == None): strBestHome = strBestScriptHome self.setBestHome(strBestHome) EDVerbose.DEBUG("EDPluginBestv1_2.configure: Best Home: " + strBestHome) self.setCommandBestHome("export besthome=" + self.getBestHome())
def configure(self): EDPluginExecProcessScript.configure(self) self.DEBUG("EDPluginBestv1_2.configure") self.setRequireCCP4(True) strScriptExecutable = self.getScriptExecutable() self.DEBUG("EDPluginBestv1_2.configure: Script Executable: " + strScriptExecutable) strBestScriptHome = EDUtilsPath.getFolderName(strScriptExecutable) strBestHome = None pluginConfiguration = self.getConfiguration() if (pluginConfiguration == None): strBestHome = strBestScriptHome else: strBestHome = EDConfiguration.getStringParamValue( pluginConfiguration, self.__strCONF_BEST_HOME_LABEL) if (strBestHome == None): strBestHome = strBestScriptHome self.setBestHome(strBestHome) self.DEBUG("EDPluginBestv1_2.configure: Best Home: " + strBestHome) self.setCommandBestHome("export besthome=" + self.getBestHome())
def generateXSDataInputXDS(_xsDataCollection): xsDataCollection = _xsDataCollection xsDataExperimentalCondition = _xsDataCollection.getSubWedge()[0].getExperimentalCondition() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataInputXDS = XSDataInputXDSGenerateBackgroundImage() 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() # Start with the detector xsDataXDSDetector = EDHandlerXSDataXDSv1_0.getXSDataXDSDetector(xsDataDetector) xsDataInputXDS.setDetector(xsDataXDSDetector) # Then the beam xsDataXDSBeam = XSDataXDSBeam() xsDataVectorDoubleIncidentBeam = XSDataVectorDouble() xsDataVectorDoubleIncidentBeam.setV1(0.0) xsDataVectorDoubleIncidentBeam.setV2(0.0) xsDataVectorDoubleIncidentBeam.setV3(1.0) xsDataXDSBeam.setIncident_beam_direction(xsDataVectorDoubleIncidentBeam) xsDataVectorDoublePolarizationPlaneNormal = XSDataVectorDouble() xsDataVectorDoublePolarizationPlaneNormal.setV1(0.0) xsDataVectorDoublePolarizationPlaneNormal.setV2(1.0) xsDataVectorDoublePolarizationPlaneNormal.setV3(0.0) xsDataXDSBeam.setPolarization_plane_normal(xsDataVectorDoublePolarizationPlaneNormal) xsDataXDSBeam.setX_ray_wavelength(XSDataWavelength(dWavelength)) xsDataInputXDS.setBeam(xsDataXDSBeam) # Then the goniostat xsDataXDSGoniostat = XSDataXDSGoniostat() xsDataVectorDoubleRotationAxis = XSDataVectorDouble() xsDataVectorDoubleRotationAxis.setV1(1.0) xsDataVectorDoubleRotationAxis.setV2(0.0) xsDataVectorDoubleRotationAxis.setV3(0.0) xsDataXDSGoniostat.setRotation_axis(xsDataVectorDoubleRotationAxis) xsDataXDSGoniostat.setOscillation_range(xsDataGoniostat.getOscillationWidth()) xsDataXDSGoniostat.setStarting_angle(xsDataGoniostat.getRotationAxisStart()) xsDataInputXDS.setGoniostat(xsDataXDSGoniostat) # # Then the Crystal # # xsDataXDSCrystal = XSDataXDSCrystal() # # xsDataXDSCrystal.setFriedels_law(XSDataString("FALSE")) # # # if ( xsDataCrystal is not None ): # # xsDataSpaceGroup = xsDataCrystal.getSpaceGroup() # # if ( xsDataSpaceGroup is not None ): # # xsDataStringName = xsDataSpaceGroup.getName() # # if ( xsDataStringName is not None ): # # xsDataInputXDS.setSymmetry( XSDataString( xsDataStringName.getValue() ) ) # xsDataXDSCrystal.setSpace_group_number(XSDataInteger(0)) # # xsDataXDSCrystal.setStrong_pixel(XSDataInteger(8)) # # xsDataCell = XSDataCell() # xsDataCell.setLength_a(XSDataLength(0.0)) # xsDataCell.setLength_b(XSDataLength(0.0)) # xsDataCell.setLength_c(XSDataLength(0.0)) # xsDataCell.setAngle_alpha(XSDataAngle(0.0)) # xsDataCell.setAngle_beta(XSDataAngle(0.0)) # xsDataCell.setAngle_gamma(XSDataAngle(0.0)) # xsDataXDSCrystal.setUnit_cell_constants(xsDataCell) # # xsDataInputXDS.setCrystal(xsDataXDSCrystal) # Finaly the images xsDataXDSImage = XSDataXDSImage() xsDataSubWedgeFirst = xsDataSubWedgeList[0] xsDataImageFirst = xsDataSubWedgeFirst.getImage()[0] pyStrPath = xsDataImageFirst.getPath().getValue() pyStrFileName = EDUtilsFile.getBaseName(pyStrPath) pyStrDirectory = EDUtilsPath.getFolderName(pyStrPath) pyStrPrefix = EDUtilsImage.getPrefix(pyStrFileName) pyStrSuffix = EDUtilsImage.getSuffix(pyStrFileName) pyStrXDSTemplate = "%s_xdslink_?????.%s" % (pyStrPrefix, pyStrSuffix) xsDataXDSImage.setName_template_of_data_frames(XSDataString(pyStrXDSTemplate)) iXDSLowestImageNumberGlobal = 1 xsDataXDSImage.setStarting_frame(XSDataInteger(iXDSLowestImageNumberGlobal)) # First we have to find the smallest goniostat rotation axis start: fGonioStatOscillationStartMin = None for xsDataSubWedge in xsDataSubWedgeList: xsDataGoniostat = xsDataSubWedge.getExperimentalCondition().getGoniostat() fGonioStatOscillationStart = xsDataGoniostat.getRotationAxisStart().getValue() if (fGonioStatOscillationStartMin is None): fGonioStatOscillationStartMin = fGonioStatOscillationStart elif (fGonioStatOscillationStartMin > fGonioStatOscillationStart): fGonioStatOscillationStartMin = fGonioStatOscillationStart # 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 and highest image numbers 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 iLowestXDSImageNumber = None iHighestXDSImageNumber = None for xsDataImage in xsDataImageList: iImageNumber = xsDataImage.getNumber().getValue() fImageOscillationStart = fGonioStatOscillationStart + (iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange iXDSImageNumber = iXDSLowestImageNumberGlobal + int((fImageOscillationStart - fGonioStatOscillationStartMin) / fGonioStatOscillationRange) # print iXDSImageNumber, fImageOscillationStart, fGonioStatOscillationStartMin, fGonioStatOscillationRange pyStrSourcePath = xsDataImage.getPath() pyStrTarget = "%s_xdslink_%05d.%s" % (pyStrPrefix, iXDSImageNumber, pyStrSuffix) xsDataXDSImageLink = XSDataXDSImageLink() xsDataFileSource = XSDataFile() xsDataFileSource.setPath(pyStrSourcePath) xsDataXDSImageLink.setSource(xsDataFileSource) xsDataXDSImageLink.setTarget(XSDataString(pyStrTarget)) xsDataInputXDS.addImage_link(xsDataXDSImageLink) if (iLowestXDSImageNumber is None): iLowestXDSImageNumber = iXDSImageNumber elif (iLowestXDSImageNumber > iXDSImageNumber): iLowestXDSImageNumber = iXDSImageNumber if (iHighestXDSImageNumber is None): iHighestXDSImageNumber = iXDSImageNumber elif (iHighestXDSImageNumber < iXDSImageNumber): iHighestXDSImageNumber = iXDSImageNumber xsDataXDSIntegerRange = XSDataXDSIntegerRange() xsDataXDSIntegerRange.setLower(XSDataInteger(iLowestXDSImageNumber)) xsDataXDSIntegerRange.setUpper(XSDataInteger(iHighestXDSImageNumber)) xsDataXDSImage.addBackground_range(xsDataXDSIntegerRange) xsDataXDSImage.addData_range(xsDataXDSIntegerRange) xsDataXDSImage.addSpot_range(xsDataXDSIntegerRange) xsDataInputXDS.setImage(xsDataXDSImage) return xsDataInputXDS
def generateXSDataInputISPyB(_xsDataInputControlISPyB, _strStatusMessage=None): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_1") from XSDataISPyBv1_1 import XSDataString from XSDataISPyBv1_1 import XSDataBoolean from XSDataISPyBv1_1 import XSDataDouble from XSDataISPyBv1_1 import XSDataInteger from XSDataISPyBv1_1 import XSDataInputISPyB from XSDataISPyBv1_1 import XSDataISPyBScreening from XSDataISPyBv1_1 import XSDataISPyBScreeningInput from XSDataISPyBv1_1 import XSDataISPyBScreeningOutput from XSDataISPyBv1_1 import XSDataISPyBScreeningRank from XSDataISPyBv1_1 import XSDataISPyBScreeningRankSet from XSDataISPyBv1_1 import XSDatadbstatus from XSDataISPyBv1_1 import XSDataISPyBScreeningOutputContainer from XSDataISPyBv1_1 import XSDataISPyBScreeningOutputLattice from XSDataISPyBv1_1 import XSDataISPyBScreeningStrategy from XSDataISPyBv1_1 import XSDataISPyBDataCollection from XSDataISPyBv1_1 import XSDataISPyBImage from XSDataISPyBv1_1 import XSDataResultStatus xsDataInputISPyB = XSDataInputISPyB() xsDataISPyBScreeningInput = XSDataISPyBScreeningInput() xsDataIPSyBScreeningOutput = XSDataISPyBScreeningOutput() xsDataISPyBScreeningOutputContainer = XSDataISPyBScreeningOutputContainer() xsDataISPyBScreeningOutputLattice = XSDataISPyBScreeningOutputLattice() xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult() xsDataIntegerDataCollectionId = _xsDataInputControlISPyB.getDataCollectionId() # General information xsDataISPyBScreening = XSDataISPyBScreening() xsDataISPyBScreening.setProgramVersion(XSDataString("EDNA MXv1")) pyStrTimeStamp = PyTime.strftime("%Y-%m-%d %H:%M:%S") xsDataISPyBScreening.setTimeStamp(XSDataString(pyStrTimeStamp)) # Data collection information bAnomalousData = None pyStrPathToFirstImage = None xsDataCollection = xsDataResultCharacterisation.getDataCollection() if (xsDataCollection is not None): xsDataSubWedgeList = xsDataCollection.getSubWedge() if (xsDataSubWedgeList is not None): xsDataSubWedgeFirst = xsDataSubWedgeList[0] xsDataExperimentalCondition = xsDataSubWedgeFirst.getExperimentalCondition() if (xsDataExperimentalCondition is not None): xsDataDetector = xsDataExperimentalCondition.getDetector() if (xsDataDetector is not None): fBeamPositionX = xsDataDetector.getBeamPositionX().getValue() fBeamPositionY = xsDataDetector.getBeamPositionY().getValue() xsDataISPyBScreeningInput.setBeamX(XSDataDouble(fBeamPositionX)) xsDataISPyBScreeningInput.setBeamY(XSDataDouble(fBeamPositionY)) pyListXSDataImage = xsDataSubWedgeFirst.getImage() if (pyListXSDataImage is not None): xsDataImageFirst = pyListXSDataImage[ 0 ] pyStrPathToFirstImage = xsDataImageFirst.getPath().getValue() xsDataDiffractionPlan = xsDataCollection.getDiffractionPlan() if (xsDataDiffractionPlan is not None): if (xsDataDiffractionPlan.getAnomalousData() is not None): bAnomalousData = xsDataDiffractionPlan.getAnomalousData().getValue() # Use dataCollectionId if provided in the input if (xsDataIntegerDataCollectionId is not None): xsDataISPyBScreening.setDataCollectionId(xsDataIntegerDataCollectionId) else: # Add an image path if the dataCollectionId is not present... if (pyStrPathToFirstImage is not None): xsDataISPyBImage = XSDataISPyBImage() pyStrImageBaseName = EDUtilsFile.getBaseName(pyStrPathToFirstImage) pyStrDirectoryName = EDUtilsPath.getFolderName(pyStrPathToFirstImage) xsDataISPyBImage.setFileName(XSDataString(pyStrImageBaseName)) xsDataISPyBImage.setFileLocation(XSDataString(pyStrDirectoryName)) xsDataInputISPyB.setImage(xsDataISPyBImage) # Indexing information bSuccessfulIndexing = False xsDataIndexingResult = xsDataResultCharacterisation.getIndexingResult() if (xsDataIndexingResult is not None): xsDataIndexingSolutionSelected = xsDataIndexingResult.getSelectedSolution() if (xsDataIndexingSolutionSelected is not None): bSuccessfulIndexing = True xsDataStatisticsIndexing = xsDataIndexingSolutionSelected.getStatistics() if (xsDataStatisticsIndexing is not None): fBeamPositionShiftX = xsDataStatisticsIndexing.getBeamPositionShiftX().getValue() fBeamPositionShiftY = xsDataStatisticsIndexing.getBeamPositionShiftY().getValue() xsDataIPSyBScreeningOutput.setBeamShiftX(XSDataDouble(fBeamPositionShiftX)) xsDataIPSyBScreeningOutput.setBeamShiftY(XSDataDouble(fBeamPositionShiftY)) fSpotDeviationAngular = None if xsDataStatisticsIndexing.getSpotDeviationAngular() is not None: fSpotDeviationAngular = xsDataStatisticsIndexing.getSpotDeviationAngular().getValue() fSpotDeviationPositional = xsDataStatisticsIndexing.getSpotDeviationPositional().getValue() xsDataIPSyBScreeningOutput.setSpotDeviationR(XSDataDouble(fSpotDeviationPositional)) if fSpotDeviationAngular is not None: xsDataIPSyBScreeningOutput.setSpotDeviationTheta(XSDataDouble(fSpotDeviationAngular)) if ((xsDataStatisticsIndexing.getSpotsTotal() is not None) and (xsDataStatisticsIndexing.getSpotsUsed is not None)): iSpotsTotal = xsDataStatisticsIndexing.getSpotsTotal().getValue() iSpotsUsed = xsDataStatisticsIndexing.getSpotsUsed().getValue() xsDataIPSyBScreeningOutput.setNumSpotsFound(XSDataInteger(iSpotsTotal)) xsDataIPSyBScreeningOutput.setNumSpotsUsed(XSDataInteger(iSpotsUsed)) xsDataIPSyBScreeningOutput.setNumSpotsRejected(XSDataInteger(iSpotsTotal - iSpotsUsed)) xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal() xsDataIPSyBScreeningOutput.setMosaicityEstimated(XSDataBoolean(False)) if (xsDataCrystal is not None): if (xsDataCrystal.getMosaicity() is not None): fMosaicity = xsDataCrystal.getMosaicity().getValue() xsDataIPSyBScreeningOutput.setMosaicity(XSDataDouble(fMosaicity)) xsDataIPSyBScreeningOutput.setMosaicityEstimated(XSDataBoolean(True)) xsDataCell = xsDataCrystal.getCell() if (xsDataCell is not None): fLength_a = xsDataCell.getLength_a().getValue() fLength_b = xsDataCell.getLength_b().getValue() fLength_c = xsDataCell.getLength_c().getValue() fAngle_alpha = xsDataCell.getAngle_alpha().getValue() fAngle_beta = xsDataCell.getAngle_beta().getValue() fAngle_gamma = xsDataCell.getAngle_gamma().getValue() xsDataISPyBScreeningOutputLattice.setUnitCell_a(XSDataDouble(fLength_a)) xsDataISPyBScreeningOutputLattice.setUnitCell_b(XSDataDouble(fLength_b)) xsDataISPyBScreeningOutputLattice.setUnitCell_c(XSDataDouble(fLength_c)) xsDataISPyBScreeningOutputLattice.setUnitCell_alpha(XSDataDouble(fAngle_alpha)) xsDataISPyBScreeningOutputLattice.setUnitCell_beta(XSDataDouble(fAngle_beta)) xsDataISPyBScreeningOutputLattice.setUnitCell_gamma(XSDataDouble(fAngle_gamma)) xsDataSpaceGroup = xsDataCrystal.getSpaceGroup() if (xsDataSpaceGroup is not None): pyStrSpaceGroupName = xsDataSpaceGroup.getName().getValue() xsDataISPyBScreeningOutputLattice.setSpaceGroup(XSDataString(pyStrSpaceGroupName)) if (bSuccessfulIndexing): xsDataIPSyBScreeningOutput.setScreeningSuccess(XSDataBoolean(True)) if _strStatusMessage: xsDataIPSyBScreeningOutput.setStatusDescription(XSDataString(_strStatusMessage)) else: xsDataIPSyBScreeningOutput.setStatusDescription(XSDataString("Indexing successful")) else: xsDataIPSyBScreeningOutput.setScreeningSuccess(XSDataBoolean(False)) if _strStatusMessage: xsDataIPSyBScreeningOutput.setStatusDescription(XSDataString(_strStatusMessage)) else: xsDataIPSyBScreeningOutput.setStatusDescription(XSDataString("Indexing failed")) # Strategy information 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() xsDataISPyBScreeningStrategy = 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 = xsDataSubWedge.getExperimentalCondition().getBeam().getTransmission().getValue() 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)) xsDataISPyBScreeningStrategy.setTransmission(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)) xsDataISPyBScreeningOutputContainer.addScreeningStrategy(xsDataISPyBScreeningStrategy) xsDataInputISPyB.setScreening(xsDataISPyBScreening) xsDataInputISPyB.addScreeningInput(xsDataISPyBScreeningInput) xsDataISPyBScreeningOutputContainer.setScreeningOutput(xsDataIPSyBScreeningOutput) xsDataISPyBScreeningOutputContainer.addScreeningOutputLattice(xsDataISPyBScreeningOutputLattice) xsDataInputISPyB.addScreeningOutputContainer(xsDataISPyBScreeningOutputContainer) return xsDataInputISPyB
def generateXSDataInputXDS(_xsDataCollection): xsDataCollection = _xsDataCollection xsDataExperimentalCondition = _xsDataCollection.getSubWedge( )[0].getExperimentalCondition() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataInputXDS = XSDataInputXDSGenerateBackgroundImage() 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() # Start with the detector xsDataXDSDetector = EDHandlerXSDataXDSv1_0.getXSDataXDSDetector( xsDataDetector) xsDataInputXDS.setDetector(xsDataXDSDetector) # Then the beam xsDataXDSBeam = XSDataXDSBeam() xsDataVectorDoubleIncidentBeam = XSDataVectorDouble() xsDataVectorDoubleIncidentBeam.setV1(0.0) xsDataVectorDoubleIncidentBeam.setV2(0.0) xsDataVectorDoubleIncidentBeam.setV3(1.0) xsDataXDSBeam.setIncident_beam_direction( xsDataVectorDoubleIncidentBeam) xsDataVectorDoublePolarizationPlaneNormal = XSDataVectorDouble() xsDataVectorDoublePolarizationPlaneNormal.setV1(0.0) xsDataVectorDoublePolarizationPlaneNormal.setV2(1.0) xsDataVectorDoublePolarizationPlaneNormal.setV3(0.0) xsDataXDSBeam.setPolarization_plane_normal( xsDataVectorDoublePolarizationPlaneNormal) xsDataXDSBeam.setX_ray_wavelength(XSDataWavelength(dWavelength)) xsDataInputXDS.setBeam(xsDataXDSBeam) # Then the goniostat xsDataXDSGoniostat = XSDataXDSGoniostat() xsDataVectorDoubleRotationAxis = XSDataVectorDouble() xsDataVectorDoubleRotationAxis.setV1(1.0) xsDataVectorDoubleRotationAxis.setV2(0.0) xsDataVectorDoubleRotationAxis.setV3(0.0) xsDataXDSGoniostat.setRotation_axis(xsDataVectorDoubleRotationAxis) xsDataXDSGoniostat.setOscillation_range( xsDataGoniostat.getOscillationWidth()) xsDataXDSGoniostat.setStarting_angle( xsDataGoniostat.getRotationAxisStart()) xsDataInputXDS.setGoniostat(xsDataXDSGoniostat) # # Then the Crystal # # xsDataXDSCrystal = XSDataXDSCrystal() # # xsDataXDSCrystal.setFriedels_law(XSDataString("FALSE")) # ## if ( xsDataCrystal is not None ): ## xsDataSpaceGroup = xsDataCrystal.getSpaceGroup() ## if ( xsDataSpaceGroup is not None ): ## xsDataStringName = xsDataSpaceGroup.getName() ## if ( xsDataStringName is not None ): ## xsDataInputXDS.setSymmetry( XSDataString( xsDataStringName.getValue() ) ) # xsDataXDSCrystal.setSpace_group_number(XSDataInteger(0)) # # xsDataXDSCrystal.setStrong_pixel(XSDataInteger(8)) # # xsDataCell = XSDataCell() # xsDataCell.setLength_a(XSDataLength(0.0)) # xsDataCell.setLength_b(XSDataLength(0.0)) # xsDataCell.setLength_c(XSDataLength(0.0)) # xsDataCell.setAngle_alpha(XSDataAngle(0.0)) # xsDataCell.setAngle_beta(XSDataAngle(0.0)) # xsDataCell.setAngle_gamma(XSDataAngle(0.0)) # xsDataXDSCrystal.setUnit_cell_constants(xsDataCell) # # xsDataInputXDS.setCrystal(xsDataXDSCrystal) # Finaly the images xsDataXDSImage = XSDataXDSImage() xsDataSubWedgeFirst = xsDataSubWedgeList[0] xsDataImageFirst = xsDataSubWedgeFirst.getImage()[0] pyStrPath = xsDataImageFirst.getPath().getValue() pyStrFileName = EDUtilsFile.getBaseName(pyStrPath) pyStrDirectory = EDUtilsPath.getFolderName(pyStrPath) pyStrPrefix = EDUtilsImage.getPrefix(pyStrFileName) pyStrSuffix = EDUtilsImage.getSuffix(pyStrFileName) pyStrXDSTemplate = "%s_xdslink_?????.%s" % (pyStrPrefix, pyStrSuffix) xsDataXDSImage.setName_template_of_data_frames( XSDataString(pyStrXDSTemplate)) iXDSLowestImageNumberGlobal = 1 xsDataXDSImage.setStarting_frame( XSDataInteger(iXDSLowestImageNumberGlobal)) # First we have to find the smallest goniostat rotation axis start: fGonioStatOscillationStartMin = None for xsDataSubWedge in xsDataSubWedgeList: xsDataGoniostat = xsDataSubWedge.getExperimentalCondition( ).getGoniostat() fGonioStatOscillationStart = xsDataGoniostat.getRotationAxisStart( ).getValue() if (fGonioStatOscillationStartMin is None): fGonioStatOscillationStartMin = fGonioStatOscillationStart elif (fGonioStatOscillationStartMin > fGonioStatOscillationStart): fGonioStatOscillationStartMin = fGonioStatOscillationStart # 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 and highest image numbers 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 iLowestXDSImageNumber = None iHighestXDSImageNumber = None for xsDataImage in xsDataImageList: iImageNumber = xsDataImage.getNumber().getValue() fImageOscillationStart = fGonioStatOscillationStart + ( iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange iXDSImageNumber = iXDSLowestImageNumberGlobal + int( (fImageOscillationStart - fGonioStatOscillationStartMin) / fGonioStatOscillationRange) #print iXDSImageNumber, fImageOscillationStart, fGonioStatOscillationStartMin, fGonioStatOscillationRange pyStrSourcePath = xsDataImage.getPath() pyStrTarget = "%s_xdslink_%05d.%s" % ( pyStrPrefix, iXDSImageNumber, pyStrSuffix) xsDataXDSImageLink = XSDataXDSImageLink() xsDataFileSource = XSDataFile() xsDataFileSource.setPath(pyStrSourcePath) xsDataXDSImageLink.setSource(xsDataFileSource) xsDataXDSImageLink.setTarget(XSDataString(pyStrTarget)) xsDataInputXDS.addImage_link(xsDataXDSImageLink) if (iLowestXDSImageNumber is None): iLowestXDSImageNumber = iXDSImageNumber elif (iLowestXDSImageNumber > iXDSImageNumber): iLowestXDSImageNumber = iXDSImageNumber if (iHighestXDSImageNumber is None): iHighestXDSImageNumber = iXDSImageNumber elif (iHighestXDSImageNumber < iXDSImageNumber): iHighestXDSImageNumber = iXDSImageNumber xsDataXDSIntegerRange = XSDataXDSIntegerRange() xsDataXDSIntegerRange.setLower( XSDataInteger(iLowestXDSImageNumber)) xsDataXDSIntegerRange.setUpper( XSDataInteger(iHighestXDSImageNumber)) xsDataXDSImage.addBackground_range(xsDataXDSIntegerRange) xsDataXDSImage.addData_range(xsDataXDSIntegerRange) xsDataXDSImage.addSpot_range(xsDataXDSIntegerRange) xsDataInputXDS.setImage(xsDataXDSImage) return xsDataInputXDS