def doSuccessExecMetadata(self, _edPlugin=None): self.DEBUG("EDPluginBioSaxsNormalizev1_0.doSuccessExecMetadata") self.retrieveSuccessMessages(_edPlugin, "EDPluginBioSaxsNormalizev1_0.doSuccessExecMetadata") if os.path.isfile(self.strNormalizedImage): xsNormFile = XSDataImage() xsNormFile.setPath(XSDataString(self.strNormalizedImage)) self.xsdResult.setNormalizedImage(xsNormFile)
def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'image': obj_ = XSDataImage() obj_.build(child_) self.image.append(obj_) XSDataInput.buildChildren(self, child_, nodeName_)
def testCheckParameters(self): xsDataInput = XSDataInputBioSaxsHPLCv1_0() xsDataInput.rawImage = XSDataImage() xsDataInput.sample = XSDataBioSaxsSample() xsDataInput.experimentSetup = XSDataBioSaxsExperimentSetup() xsDataInput.logFile = XSDataFile() xsDataInput.normalizedImage = XSDataImage() xsDataInput.rawImageSize = XSDataInteger() edPluginExecBioSaxsNormalize = self.createPlugin() edPluginExecBioSaxsNormalize.setDataInput(xsDataInput) edPluginExecBioSaxsNormalize.checkParameters()
def postProcess(self, _edObject=None): EDPluginControl.postProcess(self) self.DEBUG("EDPluginBioSaxsNormalizev1_1.postProcess") if os.path.isfile(self.strNormalizedImage): xsNormFile = XSDataImage() xsNormFile.setPath(XSDataString(self.strNormalizedImage)) self.xsdResult.setNormalizedImage(xsNormFile) self.xsdResult.status = XSDataStatus(executiveSummary=XSDataString(os.linesep.join(self.lstProcessLog))) # Create some output data self.setDataOutput(self.xsdResult)
def createDataMOSFLMOutputGeneratePrediction(self): EDVerbose.DEBUG("EDPluginMOSFLMGeneratePredictionv10.createDataMOSFLMOutputIntegration") xsDataMOSFLMInputGeneratePrediction = self.getDataInput() xsDataMOSFLMImage = xsDataMOSFLMInputGeneratePrediction.getImage() iImageNumber = xsDataMOSFLMImage.getNumber().getValue() xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction() xsDataImage = XSDataImage() xsDataImage.setNumber(XSDataInteger(iImageNumber)) xsDataImage.setPath(XSDataString(os.path.join(self.getWorkingDirectory(), self.getPredictionImageFileName()))) xsDataMOSFLMOutputGeneratePrediction.setPredictionImage(xsDataImage) return xsDataMOSFLMOutputGeneratePrediction
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecSaxsMacv1_0.postProcess") # Create some output data xsDataResult = XSDataResultSaxsMacv1_0() if self.outputImage is None: self.outputImage = "output.edf" if os.path.isfile(self.outputImage): xsdFile = XSDataImage() xsdFile.setPath(XSDataString(os.path.abspath(self.outputImage))) xsDataResult.setOutputImage(xsdFile) self.setDataOutput(xsDataResult)
def makeXML(self, filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ bProcessFile = False basename = os.path.basename(filename) for oneExt in self.listExtensions: if basename.endswith(oneExt): bProcessFile = True break if bProcessFile: for onePref in self.listExcludedPrefix: if basename.startswith(onePref): bProcessFile = False if not bProcessFile: EDVerbose.screen("Not processing file: %s" % filename) return xsdimage = XSDataImage() xsdimage.setPath(XSDataString(filename)) xsd = XSDataInputDiffractionCT() xsd.setImage(xsdimage) xsd.setDestinationDirectory(self.destinationDirectory) xsd.setSinogramFileNamePrefix(self.sinogramFileNamePrefix) xsd.setPowderDiffractionSubdirectory(self.powderDiffractionSubdirectory) xsd.setPowderDiffractionFormat(self.powderDiffractionFormat) if self.indexOffset is not None and self.fastMotorSteps is not None: idx = 0 basename = list(os.path.splitext(os.path.basename(filename))[0]) basename.reverse() number = "" for i in basename: if i.isdigit(): number = i + number else: break idx = int(number) - self.indexOffset if idx < 0:return self.forceInstrument.set_tomo_spec_displ_x(XSDataLength(idx % (self.fastMotorSteps + 1))) self.forceInstrument.set_tomo_spec_displ_rotation(XSDataLength(idx // (self.fastMotorSteps + 1))) xsd.setOverrideScanParam(self.forceInstrument) xsd.setOverrideImageParam(self.forceImage) return xsd.marshal()
def doSucessGetMetadata(self, _edPlugin=None): EDVerbose.DEBUG("EDPluginBioSaxsAveragev1_0.doSuccessGetMetadata") # self.strProcessLog += "Averaging EDF images to '%s'\n" % (self.averagedImage) self.xsdMetadata = _edPlugin.getDataOutput() xsdSaxsMac = XSDataInputSaxsMacv1_0() prefix = os.path.commonprefix(self.integratedImages) listFilesReversed = [] for oneFile in self.integratedImages: revLst = list(oneFile) revLst.reverse() listFilesReversed.append("".join(revLst)) revLst = list(os.path.commonprefix(listFilesReversed)) revLst.reverse() suffix = "".join(revLst) lenSuffix = len(suffix) lenPrefix = len(prefix) maxdif = 0 maxInt = 0 miniInt = sys.maxint for oneFile in self.integratedImages: lenOneFile = len(oneFile) if lenOneFile - lenSuffix - lenPrefix > maxdif: maxdif = lenOneFile - lenSuffix - lenPrefix try: val = int(oneFile[lenPrefix:-lenSuffix]) except Exception: val = None pass if val is not None: if val < miniInt: miniInt = val if val > maxInt: maxInt = val strImages = prefix + """%""" * maxdif + suffix + ",%i,%i" % (miniInt, maxInt) self.strProcessLog += "Averaging images '%s' to %s\n" % (strImages, self.averagedImage) EDVerbose.DEBUG("Averaging '%s'\n" % (strImages)) xsdImage = XSDataImage() xsdImage.setPath(XSDataString(strImages)) xsdiSaxsMac = XSDataInputSaxsMacv1_0() xsdiSaxsMac.setInputImage(xsdImage) xsdiSaxsMac.setOutputImage(self.dataInput.getAveragedImage()) xsdiSaxsMac.setOptions(XSDataString("+pass -omod n +var -add %d" % len(self.integratedImages))) xsdiSaxsMac.setMultConst(XSDataDouble(1.0 / len(self.integratedImages))) self.__edPluginSaxsMac.setDataInput(xsdiSaxsMac) self.__edPluginSaxsMac.connectSUCCESS(self.doSuccessSaxsMac) self.__edPluginSaxsMac.connectFAILURE(self.doFailureSaxsMac) self.__edPluginSaxsMac.executeSynchronous()
def doSuccessReadImageHeader(self, _edPlugin=None): self.DEBUG("EDPluginControlGridScreeningv1_0.doSuccessReadImageHeader") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlGridScreeningv1_0.doSuccessReadImageHeader") xsDataResultReadImageHeader = self.edPluginControlReadImageHeader.getDataOutput() if xsDataResultReadImageHeader is not None: xsDataSubWedge = xsDataResultReadImageHeader.getSubWedge() self.xsDataCollection = XSDataCollection() self.xsDataCollection.addSubWedge(xsDataSubWedge) self.xsDataCollection.setDiffractionPlan(self.xsDataDiffractionPlan) if not self.bDoOnlyIntegrationWithXMLOutput: xsDataInputControlImageQualityIndicators = XSDataInputControlImageQualityIndicators() if self.bStoreImageQualityIndicatorsInISPyB: xsDataInputControlImageQualityIndicators.doUploadToIspyb = XSDataBoolean(True) else: xsDataInputControlImageQualityIndicators.doUploadToIspyb = XSDataBoolean(False) xsDataInputControlImageQualityIndicators.addImage(XSDataImage(path=XSDataString(self.strImageFile))) self.edPluginControlIndicators.setDataInput(xsDataInputControlImageQualityIndicators) self.edPluginControlIndicators.connectSUCCESS(self.doSuccessIndicators) self.edPluginControlIndicators.connectFAILURE(self.doFailureIndicators) self.executePluginSynchronous(self.edPluginControlIndicators) else: xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.setDataCollection(self.xsDataCollection) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(xsDataIndexingInput) self.edPluginMOSFLMIndexing.connectSUCCESS(self.doSuccessIndexingMOSFLM) self.edPluginMOSFLMIndexing.connectFAILURE(self.doFailureIndexingMOSFLM) self.edPluginMOSFLMIndexing.setDataInput(xsDataMOSFLMIndexingInput) self.edPluginMOSFLMIndexing.executeSynchronous()
def doSuccessGeneratePrediction(self, _edPlugin=None): self.DEBUG("EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction") if (self.__xsDataGeneratePredictionResult is None): self.__xsDataGeneratePredictionResult = XSDataGeneratePredictionResult() xsDataMOSFLMOutputGeneratePrediction = _edPlugin.getDataOutput() xsDataImage = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage() self.__xsDataGeneratePredictionResult.addPredictionImage(XSDataImage.parseString(xsDataImage.marshal()))
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)
def generateListXSDataImageReference(_xsDataIndexingInput): listXSDataImageReference = [] xsDataCollection = _xsDataIndexingInput.getDataCollection() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataImageFirst = xsDataSubWedgeList[0].getImage()[0] listXSDataImageReference.append(XSDataImage.parseString(xsDataImageFirst.marshal())) fPhiStartFirst = xsDataSubWedgeList[0].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue() if (len(xsDataSubWedgeList) > 1): xsDataImageSecond = xsDataSubWedgeList[-1].getImage()[0] fPhiStartSecond = xsDataSubWedgeList[-1].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue() # Add modulus! if (abs(fPhiStartSecond - fPhiStartFirst) > 4): listXSDataImageReference.append(XSDataImage.parseString(xsDataImageSecond.marshal())) return listXSDataImageReference
def fileName2xml(filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ if not filename.endswith(".edf"): return basename = os.path.basename(filename) upperDir = os.path.dirname(os.path.dirname(filename)) if not os.path.isdir(os.path.join(upperDir, "MedianFiltered")): os.makedirs(os.path.join(upperDir, "MedianFiltered"), int("775", 8)) destinationPath = os.path.join(upperDir, "MedianFiltered", basename) xsd = XSDataInputMedianFilterImage() xsd.setFilterWidth(XSDataInteger(FilterWidth)) xsd.setInputImage(XSDataImage(XSDataString(filename))) xsd.setMedianFilteredImage(XSDataImage(XSDataString(destinationPath))) return xsd.marshal()
def testCheckParameters(self): xsDataInput = XSDataInputBioSaxsProcessOneFilev1_0() xsDataInput.rawImage = XSDataImage() xsDataInput.sample = XSDataBioSaxsSample() xsDataInput.experimentSetup = XSDataBioSaxsExperimentSetup() xsDataInput.logFile = XSDataFile() xsDataInput.normalizedImage = XSDataImage() xsDataInput.rawImageSize = XSDataInteger() # xsDataInput.beamStopDiode = XSDataDouble() # xsDataInput.normalizationFactor = XSDataDouble() # xsDataInput.machineCurrent = XSDataDouble() # xsDataInput.maskFile = XSDataImage() # xsDataInput.detectorDistance = XSDataLength() # xsDataInput.wavelength = XSDataWavelength() # xsDataInput.pixelSize_1 = XSDataLength() # xsDataInput.pixelSize_2 = XSDataLength() # xsDataInput.beamCenter_1 = XSDataDouble() # xsDataInput.beamCenter_2 = XSDataDouble() edPluginExecBioSaxsNormalize = self.createPlugin() edPluginExecBioSaxsNormalize.setDataInput(xsDataInput) edPluginExecBioSaxsNormalize.checkParameters()
def generateImageList(self, _xsDataCollection): """ Make a list of all images in the subwedges """ self.verboseDebug("EDPluginControlIndexingIndicatorsv1_1.generateImageList") listImage = None if (_xsDataCollection is not None): listImage = [] xsDataSubWedgeList = _xsDataCollection.getSubWedge() for xsDataSubWedge in xsDataSubWedgeList: xsDataImageList = xsDataSubWedge.getImage() for xsDataImage in xsDataImageList: listImage.append(XSDataImage.parseString(xsDataImage.marshal())) return listImage
def testParseLabelitDistlOutput(self): """ This method test the parsing of the Labelit results in the log file. """ edPluginLabelitDistlv1_1 = self.createPlugin() strPathToLabelitLogText = os.path.join(self.getPluginTestsDataHome(), "labelit.distl_v116.log") strLabelitLogText = self.readAndParseFile(strPathToLabelitLogText) xsDataImageQualityIndicators = edPluginLabelitDistlv1_1.parseLabelitDistlOutput(strLabelitLogText) xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1) xsDataImage1 = XSDataImage.parseString(xmlInput1) xsDataImageQualityIndicators.setImage(xsDataImage1) strLabelitDistlOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataImageQualityIndicators_reference.xml") strLabelitDistlOutputXML = self.readAndParseFile(strLabelitDistlOutputFile) from XSDataLabelitv1_1 import XSDataImageQualityIndicators xsDataImageQualityIndicatorsReference = XSDataImageQualityIndicators.parseString(strLabelitDistlOutputXML) EDAssert.equal(xsDataImageQualityIndicatorsReference.marshal(), xsDataImageQualityIndicators.marshal())
def process(self, _edObject=None): EDPluginControl.process(self) self.DEBUG("EDPluginControlH5ToCBFv1_0.process") imageNumber = self.dataInput.imageNumber.value if self.dataInput.hdf5ImageNumber is None: hdf5ImageNumber = imageNumber else: hdf5ImageNumber = self.dataInput.hdf5ImageNumber.value if self.dataInput.ispybDataCollection is None: xsDataInputRetrieveDataCollection = XSDataInputRetrieveDataCollection( ) xsDataImage = XSDataImage(self.dataInput.hdf5File.path) xsDataInputRetrieveDataCollection.image = xsDataImage self.edPluginISPyBRetrieveDataCollection.dataInput = xsDataInputRetrieveDataCollection self.edPluginISPyBRetrieveDataCollection.executeSynchronous() xsDataResultRetrieveDataCollection = self.edPluginISPyBRetrieveDataCollection.dataOutput dataCollection = xsDataResultRetrieveDataCollection.dataCollection else: dataCollection = self.dataInput.ispybDataCollection if dataCollection is not None: if dataCollection.overlap is None: overlap = 0.0 else: overlap = dataCollection.overlap axisStart = dataCollection.axisStart oscillationRange = dataCollection.axisRange axisStartNew = axisStart - (overlap + oscillationRange) * (imageNumber - 1) dataCollection.axisStart = axisStartNew xsDataISPyBDataCollection = XSDataISPyBDataCollection.parseString( dataCollection.marshal()) else: xsDataISPyBDataCollection = None xsDataInputH5ToCBF = XSDataInputH5ToCBF() xsDataInputH5ToCBF.hdf5File = self.dataInput.hdf5File xsDataInputH5ToCBF.imageNumber = self.dataInput.imageNumber xsDataInputH5ToCBF.hdf5ImageNumber = XSDataInteger(hdf5ImageNumber) xsDataInputH5ToCBF.dataCollection = xsDataISPyBDataCollection xsDataInputH5ToCBF.forcedOutputDirectory = self.dataInput.forcedOutputDirectory self.edPluginEDPluginH5ToCBF.dataInput = xsDataInputH5ToCBF self.edPluginEDPluginH5ToCBF.executeSynchronous() if self.edPluginEDPluginH5ToCBF.dataOutput is not None: self.dataOutput.outputCBFFile = self.edPluginEDPluginH5ToCBF.dataOutput.outputCBFFile if dataCollection is not None: self.dataOutput.ispybDataCollection = XSDataISPyBDataCollection.parseString( dataCollection.marshal())
def postProcess(self, _edObject=None): EDPluginControl.postProcess(self) EDVerbose.DEBUG("EDPluginBioSaxsMetadatav1_0.postProcess") # Create some output data xsDataResult = XSDataResultBioSaxsMetadatav1_0() if self.strOutputImage is not None: xsdImage = XSDataImage() xsdImage.setPath(XSDataString(self.strOutputImage)) xsDataResult.setOutputImage(xsdImage) if self.detector is not None: # EDVerbose.DEBUG("Detector=%s" % self.detector) xsDataResult.setDetector(XSDataString(self.detector)) if self.detectorDistance is not None: # EDVerbose.DEBUG("DetectorDistance %s(%s)" % (self.detectorDistance, self.detectorDistance.__class__)) xsDataResult.setDetectorDistance(XSDataLength(self.detectorDistance)) if self.pixelSize_1 is not None: # EDVerbose.DEBUG("pixelSize_1 %s(%s)" % (self.pixelSize_1, self.pixelSize_1.__class__)) xsDataResult.setPixelSize_1(XSDataLength(self.pixelSize_1)) if self.pixelSize_2 is not None: # EDVerbose.DEBUG("pixelSize_2 %s(%s)" % (self.pixelSize_2, self.pixelSize_2.__class__)) xsDataResult.setPixelSize_2(XSDataLength(self.pixelSize_2)) if self.beamCenter_1 is not None: # EDVerbose.DEBUG("beamCenter_1 %s(%s)" % (self.beamCenter_1, self.beamCenter_1.__class__)) xsDataResult.setBeamCenter_1(XSDataDouble(self.beamCenter_1)) if self.beamCenter_2 is not None: # EDVerbose.DEBUG("beamCenter_2 %s(%s)" % (self.beamCenter_2, self.beamCenter_2.__class__)) xsDataResult.setBeamCenter_2(XSDataDouble(self.beamCenter_2)) if self.beamStopDiode is not None: # EDVerbose.DEBUG("beamStopDiode %s(%s)" % (self.beamStopDiode, self.beamStopDiode.__class__)) xsDataResult.setBeamStopDiode(XSDataDouble(self.beamStopDiode)) if self.wavelength is not None: xsDataResult.setWavelength(XSDataWavelength(self.wavelength)) if self.maskFile is not None: xsdFile = XSDataImage() xsdFile.setPath(XSDataString(self.maskFile)) xsDataResult.setMaskFile(xsdFile) if self.normalizationFactor is not None: xsDataResult.setNormalizationFactor(XSDataDouble(self.normalizationFactor)) if self.machineCurrent is not None: xsDataResult.setMachineCurrent(XSDataDouble(self.machineCurrent)) if self.code is not None: xsDataResult.setCode(XSDataString(self.code)) if self.comments is not None: xsDataResult.setComments(XSDataString(self.comments)) if self.concentration is not None: xsDataResult.setConcentration(XSDataDouble(self.concentration)) EDVerbose.DEBUG("xsDataResult=%s" % xsDataResult.marshal()) self.setDataOutput(xsDataResult)
def testParseLabelitDistlOutput(self): """ This method test the parsing of the Labelit results in the log file. """ edPluginLabelitDistlv1_1 = self.createPlugin() strPathToLabelitLogText = os.path.join(self.getPluginTestsDataHome(), "labelit.distl_v116.log") strLabelitLogText = self.readAndParseFile(strPathToLabelitLogText) xsDataImageQualityIndicators = edPluginLabelitDistlv1_1.parseLabelitDistlOutput( strLabelitLogText) xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1) xsDataImage1 = XSDataImage.parseString(xmlInput1) xsDataImageQualityIndicators.setImage(xsDataImage1) strLabelitDistlOutputFile = os.path.join( self.getPluginTestsDataHome(), "XSDataImageQualityIndicators_reference.xml") strLabelitDistlOutputXML = self.readAndParseFile( strLabelitDistlOutputFile) from XSDataLabelitv1_1 import XSDataImageQualityIndicators xsDataImageQualityIndicatorsReference = XSDataImageQualityIndicators.parseString( strLabelitDistlOutputXML) EDAssert.equal(xsDataImageQualityIndicatorsReference.marshal(), xsDataImageQualityIndicators.marshal())
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() xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition) xsDataSubWedge.addImage(xsDataImage) self.__xsDataResultReadImageHeader = XSDataResultReadImageHeader() self.__xsDataResultReadImageHeader.setSubWedge(xsDataSubWedge)
def postProcess(self, _edObject=None): """ complex type XSDataBioSaxsExperimentSetup extends XSData{ detector : XSDataString optional detectorDistance : XSDataLength optional pixelSize_1 : XSDataLength optional pixelSize_2 : XSDataLength optional beamCenter_1 : XSDataDouble optional beamCenter_2 : XSDataDouble optional beamStopDiode : XSDataDouble optional wavelength : XSDataWavelength optional machineCurrent : XSDataDouble optional maskFile : XSDataImage optional normalizationFactor : XSDataDouble optional storageTemperature: XSDataDouble optional exposureTemperature: XSDataDouble optional exposureTime: XSDataTime optional frameNumber: XSDataInteger optional frameMax: XSDataInteger optional } complex type XSDataBioSaxsSample extends XSData { concentration : XSDataDouble optional comments : XSDataString optional code : XSDataString optional temperature: XSDataDouble optional """ EDPluginExec.postProcess(self) EDVerbose.DEBUG("EDPluginBioSaxsMetadatav1_1.postProcess") # Create some output data xsDataResult = XSDataResultBioSaxsMetadatav1_0() xsdSample = XSDataBioSaxsSample() xsdExperiment = XSDataBioSaxsExperimentSetup() if self.strOutputImage is not None: xsdImage = XSDataImage() xsdImage.setPath(XSDataString(self.strOutputImage)) xsDataResult.setOutputImage(xsdImage) if self.detector is not None: xsdExperiment.detector = xsDataResult.detector = XSDataString(self.detector) if self.detectorDistance is not None: xsdExperiment.detectorDistance = xsDataResult.detectorDistance = XSDataLength(self.detectorDistance) if self.pixelSize_1 is not None: xsDataResult.pixelSize_1 = XSDataLength(self.pixelSize_1) xsdExperiment.pixelSize_1 = xsDataResult.pixelSize_1 if self.pixelSize_2 is not None: xsDataResult.pixelSize_2 = XSDataLength(self.pixelSize_2) xsdExperiment.pixelSize_2 = xsDataResult.pixelSize_2 if self.beamCenter_1 is not None: xsDataResult.beamCenter_1 = XSDataDouble(self.beamCenter_1) xsdExperiment.beamCenter_1 = xsDataResult.beamCenter_1 if self.beamCenter_2 is not None: xsDataResult.beamCenter_2 = XSDataDouble(self.beamCenter_2) xsdExperiment.beamCenter_2 = xsDataResult.beamCenter_2 if self.beamStopDiode is not None: xsdExperiment.beamStopDiode = xsDataResult.beamStopDiode = XSDataDouble(self.beamStopDiode) if self.wavelength is not None: xsdExperiment.wavelength = xsDataResult.wavelength = XSDataWavelength(self.wavelength) if self.maskFile is not None: xsdFile = XSDataImage() xsdFile.setPath(XSDataString(self.maskFile)) xsdExperiment.maskFile = xsDataResult.maskFile = xsdFile if self.normalizationFactor is not None: xsdExperiment.normalizationFactor = xsDataResult.normalizationFactor = XSDataDouble(self.normalizationFactor) if self.machineCurrent is not None: xsdExperiment.machineCurrent = xsDataResult.machineCurrent = XSDataDouble(self.machineCurrent) if self.storageTemperature is not None: xsdExperiment.storageTemperature = xsDataResult.storageTemperature = XSDataDouble(self.storageTemperature) if self.exposureTemperature is not None: xsdExperiment.exposureTemperature = xsDataResult.exposureTemperature = XSDataDouble(self.exposureTemperature) if self.exposureTime is not None: xsdExperiment.exposureTime = xsDataResult.exposureTime = XSDataTime(self.exposureTime) if self.frameNumber is not None: xsdExperiment.frameNumber = xsDataResult.frameNumber = XSDataInteger(self.frameNumber) if self.frameMax is not None: xsdExperiment.frameMax = xsDataResult.frameMax = XSDataInteger(self.frameMax) if self.timeOfFrame is not None: xsdExperiment.timeOfFrame = xsDataResult.timeOfFrame = XSDataTime(self.timeOfFrame) if self.code is not None: xsdSample.code = xsDataResult.code = XSDataString(self.code) if self.comments is not None: xsdSample.comments = xsDataResult.comments = XSDataString(self.comments) if self.concentration is not None: xsdSample.concentration = xsDataResult.concentration = XSDataDouble(self.concentration) xsDataResult.sample = xsdSample xsDataResult.experimentSetup = xsdExperiment self.setDataOutput(xsDataResult)
def process(self, _edPlugin=None): """ Executes the execution plugins """ EDPluginControl.process(self, _edPlugin) self.DEBUG("EDPluginControlImageQualityIndicatorsv1_5.process") EDUtilsParallel.initializeNbThread() # Check batch size if self.dataInput.batchSize is None: batchSize = 1 else: batchSize = self.dataInput.batchSize.value self.screen("Image quality indicators batch size: {0}".format(batchSize)) # Check if we should do distlSignalStrength: bDoDistlSignalStrength = True if self.dataInput.doDistlSignalStrength is not None: if not self.dataInput.doDistlSignalStrength.value: bDoDistlSignalStrength = False # Check if we should do indexing: bDoIndexing = False if self.dataInput.doIndexing is not None: if self.dataInput.doIndexing.value: bDoIndexing = True # Check if fast mesh (for HDF5) isFastMesh = False if self.dataInput.fastMesh: isFastMesh = self.dataInput.fastMesh.value # Loop through all the incoming reference images if len(self.dataInput.image) == 0: directory = self.dataInput.directory.path.value template = self.dataInput.template.value startNo = self.dataInput.startNo.value endNo = self.dataInput.endNo.value listXSDataImage = [] for index in range(startNo, endNo + 1): imageName = template.replace("####", "{0:04d}".format(index)) imagePath = os.path.join(directory, imageName) xsDataImage = XSDataImage(path=XSDataString(imagePath), number=XSDataInteger(index)) listXSDataImage.append(xsDataImage) else: listXSDataImage = self.dataInput.image xsDataInputMXWaitFile = XSDataInputMXWaitFile() self.xsDataResultControlImageQualityIndicators = XSDataResultControlImageQualityIndicators() listPluginDistl = [] listPluginDozor = [] listOfImagesInBatch = [] listOfAllBatches = [] indexBatch = 0 listH5FilePath = [] # Process data in batches for xsDataImage in listXSDataImage: listOfImagesInBatch.append(xsDataImage.copy()) if len(listOfImagesInBatch) == batchSize: listOfAllBatches.append(listOfImagesInBatch) listOfImagesInBatch = [] if len(listOfImagesInBatch) > 0: listOfAllBatches.append(listOfImagesInBatch) listOfImagesInBatch = [] # Loop over batches for listOfImagesInBatch in listOfAllBatches: # First wait for images for image in listOfImagesInBatch: strPathToImage = image.path.value # If Eiger, just wait for the h5 file if strPathToImage.endswith(".h5"): h5MasterFilePath, h5DataFilePath, hdf5ImageNumber = self.getH5FilePath(strPathToImage, batchSize=batchSize, isFastMesh=isFastMesh) # print(h5FilePath) # print(hdf5ImageNumber) if not h5DataFilePath in listH5FilePath: self.screen("ID30a3 Eiger data, waiting for master and data files...") listH5FilePath.append(h5DataFilePath) self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName) xsDataInputMXWaitFile.file = XSDataFile(XSDataString(h5DataFilePath)) xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize)) xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut)) self.screen("Waiting for file {0}".format(h5DataFilePath)) self.DEBUG("Wait file timeOut set to %f" % self.fMXWaitFileTimeOut) self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile) self.edPluginMXWaitFile.executeSynchronous() # hdf5FilePath = strPathToImage.replace(".cbf", ".h5") time.sleep(1) if not os.path.exists(h5DataFilePath): strError = "Time-out while waiting for image %s" % h5DataFilePath self.error(strError) self.addErrorMessage(strError) self.setFailure() else: if not os.path.exists(strPathToImage): # self.screen("Waiting for file {0}".format(strPathToImage)) self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName) xsDataInputMXWaitFile.file = XSDataFile(XSDataString(strPathToImage)) xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize)) xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut)) self.screen("Wait file timeOut set to %.0f s" % self.fMXWaitFileTimeOut) self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile) self.edPluginMXWaitFile.executeSynchronous() if not os.path.exists(strPathToImage): strError = "Time-out while waiting for image %s" % strPathToImage self.error(strError) self.addErrorMessage(strError) self.setFailure() if not self.isFailure(): strPathToFirstImage = listOfImagesInBatch[0].path.value if strPathToImage.endswith(".h5"): indexLoop = 1 continueLoop = True while continueLoop: directory = os.path.dirname(strPathToFirstImage) firstImage = EDUtilsImage.getImageNumber(listOfImagesInBatch[0].path.value) lastImage = EDUtilsImage.getImageNumber(listOfImagesInBatch[-1].path.value) xsDataInputH5ToCBF = XSDataInputH5ToCBF() xsDataInputH5ToCBF.hdf5File = XSDataFile(listOfImagesInBatch[0].path) xsDataInputH5ToCBF.hdf5ImageNumber = XSDataInteger(1) xsDataInputH5ToCBF.startImageNumber = XSDataInteger(firstImage) xsDataInputH5ToCBF.endImageNumber = XSDataInteger(lastImage) xsDataInputH5ToCBF.forcedOutputDirectory = XSDataFile(XSDataString(directory)) edPluginH5ToCBF = self.loadPlugin("EDPluginH5ToCBFv1_1") edPluginH5ToCBF.dataInput = xsDataInputH5ToCBF edPluginH5ToCBF.execute() edPluginH5ToCBF.synchronize() outputCBFFileTemplate = edPluginH5ToCBF.dataOutput.outputCBFFileTemplate if outputCBFFileTemplate is not None: lastCbfFile = outputCBFFileTemplate.path.value.replace("######", "{0:06d}".format(EDUtilsImage.getImageNumber(listOfImagesInBatch[-1].path.value))) strPathToImage = os.path.join(directory, lastCbfFile) # print(cbfFile.path.value) if os.path.exists(strPathToImage): # Rename all images for image in listOfImagesInBatch: image.path.value = image.path.value.replace(".h5", ".cbf") imageNumber = EDUtilsImage.getImageNumber(image.path.value) oldPath = os.path.join(directory, outputCBFFileTemplate.path.value.replace("######", "{0:06d}".format(imageNumber))) newPath = os.path.join(directory, outputCBFFileTemplate.path.value.replace("######", "{0:04d}".format(imageNumber))) os.rename(oldPath, newPath) lastCbfFile = outputCBFFileTemplate.path.value.replace("######", "{0:04d}".format(EDUtilsImage.getImageNumber(listOfImagesInBatch[-1].path.value))) strPathToImage = os.path.join(directory, lastCbfFile) self.screen("Image has been converted to CBF file: {0}".format(strPathToImage)) continueLoop = False # print(continueLoop) if continueLoop: self.screen("Still waiting for converting to CBF file: {0}".format(strPathToImage)) indexLoop += 1 time.sleep(5) if indexLoop > 10: continueLoop = False for image in listOfImagesInBatch: strPathToImage = image.path.value # Check if we should run distl.signalStrength xsDataImageNew = XSDataImage(XSDataString(strPathToImage)) xsDataImageNew.number = XSDataInteger(EDUtilsImage.getImageNumber(image.path.value)) edPluginPluginExecImageQualityIndicator = None if bDoDistlSignalStrength: if self.bUseThinClient: strPluginName = self.strPluginNameThinClient else: strPluginName = self.strPluginName edPluginPluginExecImageQualityIndicator = self.loadPlugin(strPluginName) self.listPluginExecImageQualityIndicator.append(edPluginPluginExecImageQualityIndicator) xsDataInputDistlSignalStrength = XSDataInputDistlSignalStrength() xsDataInputDistlSignalStrength.setReferenceImage(xsDataImageNew) edPluginPluginExecImageQualityIndicator.setDataInput(xsDataInputDistlSignalStrength) edPluginPluginExecImageQualityIndicator.execute() listPluginDistl.append((xsDataImageNew.copy(), edPluginPluginExecImageQualityIndicator)) edPluginControlDozor = self.loadPlugin(self.strPluginNameControlDozor, "ControlDozor_{0}".format(os.path.splitext(os.path.basename(strPathToFirstImage))[0])) xsDataInputControlDozor = XSDataInputControlDozor() for image in listOfImagesInBatch: xsDataInputControlDozor.addImage(XSDataFile(image.path)) xsDataInputControlDozor.batchSize = XSDataInteger(len(listOfImagesInBatch)) edPluginControlDozor.dataInput = xsDataInputControlDozor edPluginControlDozor.execute() listPluginDozor.append((edPluginControlDozor, list(listOfImagesInBatch))) if not self.isFailure(): listIndexing = [] # Synchronize all image quality indicator plugins and upload to ISPyB xsDataInputStoreListOfImageQualityIndicators = XSDataInputStoreListOfImageQualityIndicators() for (xsDataImage, edPluginPluginExecImageQualityIndicator) in listPluginDistl: xsDataImageQualityIndicators = XSDataImageQualityIndicators() xsDataImageQualityIndicators.image = xsDataImage.copy() if edPluginPluginExecImageQualityIndicator is not None: edPluginPluginExecImageQualityIndicator.synchronize() if edPluginPluginExecImageQualityIndicator.dataOutput is not None: if edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators is not None: xsDataImageQualityIndicators = XSDataImageQualityIndicators.parseString(\ edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators.marshal()) self.xsDataResultControlImageQualityIndicators.addImageQualityIndicators(xsDataImageQualityIndicators) for (edPluginControlDozor, listBatch) in listPluginDozor: edPluginControlDozor.synchronize() # Check that we got at least one result if len(edPluginControlDozor.dataOutput.imageDozor) == 0: # Run the dozor plugin again, this time synchronously firstImage = os.path.basename(listBatch[0].path.value) lastImage = os.path.basename(listBatch[-1].path.value) self.screen("No dozor results! Re-executing Dozor for images {0} to {1}".format(firstImage, lastImage)) time.sleep(5) edPluginControlDozor = self.loadPlugin(self.strPluginNameControlDozor, "ControlDozor_reexecution_{0}".format(os.path.splitext(firstImage)[0])) xsDataInputControlDozor = XSDataInputControlDozor() for image in listBatch: xsDataInputControlDozor.addImage(XSDataFile(image.path)) xsDataInputControlDozor.batchSize = XSDataInteger(batchSize) edPluginControlDozor.dataInput = xsDataInputControlDozor edPluginControlDozor.executeSynchronous() for imageDozor in edPluginControlDozor.dataOutput.imageDozor: for xsDataImageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators: if xsDataImageQualityIndicators.image.path.value == imageDozor.image.path.value: xsDataImageQualityIndicators.dozor_score = imageDozor.mainScore xsDataImageQualityIndicators.dozorSpotFile = imageDozor.spotFile if imageDozor.spotFile is not None: if os.path.exists(imageDozor.spotFile.path.value): numpyArray = numpy.loadtxt(imageDozor.spotFile.path.value, skiprows=3) xsDataImageQualityIndicators.dozorSpotList = XSDataString(base64.b64encode(numpyArray.tostring())) xsDataImageQualityIndicators.addDozorSpotListShape(XSDataInteger(numpyArray.shape[0])) if len(numpyArray.shape) > 1: xsDataImageQualityIndicators.addDozorSpotListShape(XSDataInteger(numpyArray.shape[1])) xsDataImageQualityIndicators.dozorSpotsIntAver = imageDozor.spotsIntAver xsDataImageQualityIndicators.dozorSpotsResolution = imageDozor.spotsResolution xsDataImageQualityIndicators.dozorVisibleResolution = imageDozor.visibleResolution if self.xsDataResultControlImageQualityIndicators.inputDozor is None: if edPluginControlDozor.dataOutput.inputDozor is not None: self.xsDataResultControlImageQualityIndicators.inputDozor = XSDataDozorInput().parseString( edPluginControlDozor.dataOutput.inputDozor.marshal()) if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value: xsDataISPyBImageQualityIndicators = \ XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal()) xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(xsDataISPyBImageQualityIndicators) # print xsDataInputStoreListOfImageQualityIndicators.marshal() if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value: self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName) self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators self.edPluginISPyB.execute() # if bDoIndexing: # Find the 5 most intensive images (TIS): listImage = [] # Check that we have dozor_score from all images: has_dozor_score = True for imageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators: if imageQualityIndicators.dozor_score is None: has_dozor_score = False if has_dozor_score: listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators, key=lambda imageQualityIndicators: imageQualityIndicators.dozor_score.value) else: listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators, key=lambda imageQualityIndicators: imageQualityIndicators.totalIntegratedSignal.value) for xsDataResultControlImageQualityIndicator in listSorted[-5:]: if xsDataResultControlImageQualityIndicator.dozor_score.value > 1: xsDataInputReadImageHeader = XSDataInputReadImageHeader() xsDataInputReadImageHeader.image = XSDataFile(xsDataResultControlImageQualityIndicator.image.path) self.edPluginReadImageHeader = self.loadPlugin(self.strPluginReadImageHeaderName) self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader self.edPluginReadImageHeader.executeSynchronous() xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput if xsDataResultReadImageHeader is not None: edPluginLabelitIndexing = self.loadPlugin(self.strIndexingLabelitPluginName) xsDataInputLabelitIndexing = XSDataInputLabelitIndexing() xsDataInputLabelitIndexing.image.append(XSDataImage(xsDataResultControlImageQualityIndicator.image.path)) edPluginLabelitIndexing.setDataInput(xsDataInputLabelitIndexing) self.listPluginLabelit.append([edPluginLabelitIndexing, xsDataResultControlImageQualityIndicator]) edPluginLabelitIndexing.execute() for tupleLabelit in self.listPluginLabelit: edPluginLabelitIndexing = tupleLabelit[0] xsDataResultControlImageQualityIndicator = tupleLabelit[1] edPluginLabelitIndexing.synchronize() if not edPluginLabelitIndexing.isFailure() and edPluginLabelitIndexing.dataOutput is not None: xsDataResultLabelitIndexing = edPluginLabelitIndexing.getDataOutput() xsDataIndexingResult = EDHandlerXSDataPhenixv1_1.generateXSDataIndexingResult(xsDataResultLabelitIndexing) selectedSolution = xsDataIndexingResult.selectedSolution if selectedSolution is not None: xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution
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) self.__xsDataResultReadImageHeader = XSDataResultReadImageHeader() self.__xsDataResultReadImageHeader.setSubWedge(xsDataSubWedge)
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)
def process(self, _edPlugin=None): """ Executes the execution plugins """ EDPluginControl.process(self, _edPlugin) self.DEBUG("EDPluginControlImageQualityIndicatorsv1_4.process") EDUtilsParallel.initializeNbThread() # Check batch size if self.dataInput.batchSize is None: batchSize = 1 else: batchSize = self.dataInput.batchSize.value self.screen("Batch size: {0}".format(batchSize)) # Check if we should do distlSignalStrength: bDoDistlSignalStrength = True if self.dataInput.doDistlSignalStrength is not None: if not self.dataInput.doDistlSignalStrength.value: bDoDistlSignalStrength = False # Check if we should do indexing: bDoIndexing = False if self.dataInput.doIndexing is not None: if self.dataInput.doIndexing.value: bDoIndexing = True # Loop through all the incoming reference images listXSDataImage = self.dataInput.image xsDataInputMXWaitFile = XSDataInputMXWaitFile() self.xsDataResultControlImageQualityIndicators = XSDataResultControlImageQualityIndicators() listPluginDistl = [] listPluginDozor = [] listBatch = [] indexBatch = 0 listH5FilePath = [] ispybDataCollection = None for xsDataImage in listXSDataImage: strPathToImage = xsDataImage.path.value # If Eiger, just wait for the h5 file if "id30a3" in strPathToImage: h5MasterFilePath, h5DataFilePath, hdf5ImageNumber = self.getH5FilePath(strPathToImage, batchSize) # print(h5FilePath) # print(hdf5ImageNumber) if not h5DataFilePath in listH5FilePath: self.screen("ID30a3 Eiger data, waiting for master and data files...") listH5FilePath.append(h5DataFilePath) self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName) xsDataInputMXWaitFile.file = XSDataFile(XSDataString(h5DataFilePath)) xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize)) xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut)) self.screen("Waiting for file {0}".format(h5DataFilePath)) self.DEBUG("Wait file timeOut set to %f" % self.fMXWaitFileTimeOut) self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile) self.edPluginMXWaitFile.executeSynchronous() # hdf5FilePath = strPathToImage.replace(".cbf", ".h5") ispybDataCollection = None time.sleep(1) indexLoop = 1 continueLoop = True while continueLoop: xsDataInputControlH5ToCBF = XSDataInputControlH5ToCBF() xsDataInputControlH5ToCBF.hdf5File = XSDataFile(XSDataString(strPathToImage)) imageNumber = EDUtilsImage.getImageNumber(strPathToImage) xsDataInputControlH5ToCBF.imageNumber = XSDataInteger(imageNumber) xsDataInputControlH5ToCBF.hdf5ImageNumber = XSDataInteger(hdf5ImageNumber) xsDataInputControlH5ToCBF.ispybDataCollection = ispybDataCollection edPluginControlH5ToCBF = self.loadPlugin(self.strPluginControlH5ToCBF, "ControlH5ToCBF_%04d_%02d" % (imageNumber, indexLoop)) edPluginControlH5ToCBF.dataInput = xsDataInputControlH5ToCBF edPluginControlH5ToCBF.executeSynchronous() cbfFile = edPluginControlH5ToCBF.dataOutput.outputCBFFile # print(cbfFile) # print(indexLoop) if cbfFile is not None: strPathToImage = cbfFile.path.value # print(cbfFile.path.value) if os.path.exists(strPathToImage): self.screen("Image has been converted to CBF file: {0}".format(strPathToImage)) continueLoop = False # print(continueLoop) if continueLoop: self.screen("Still waiting for converting to CBF file: {0}".format(strPathToImage)) indexLoop += 1 time.sleep(5) if indexLoop > 10: continueLoop = False ispybDataCollection = edPluginControlH5ToCBF.dataOutput.ispybDataCollection elif not os.path.exists(strPathToImage): self.screen("Waiting for file {0}".format(strPathToImage)) self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName) xsDataInputMXWaitFile.file = XSDataFile(XSDataString(strPathToImage)) xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize)) xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut)) self.DEBUG("Wait file timeOut set to %f" % self.fMXWaitFileTimeOut) self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile) self.edPluginMXWaitFile.executeSynchronous() if not os.path.exists(strPathToImage): strError = "Time-out while waiting for image %s" % strPathToImage self.error(strError) self.addErrorMessage(strError) self.setFailure() else: # Check if we should run distl.signalStrength xsDataImageNew = XSDataImage(XSDataString(strPathToImage)) edPluginPluginExecImageQualityIndicator = None if bDoDistlSignalStrength: if self.bUseThinClient: strPluginName = self.strPluginNameThinClient else: strPluginName = self.strPluginName edPluginPluginExecImageQualityIndicator = self.loadPlugin(strPluginName) self.listPluginExecImageQualityIndicator.append(edPluginPluginExecImageQualityIndicator) xsDataInputDistlSignalStrength = XSDataInputDistlSignalStrength() xsDataInputDistlSignalStrength.setReferenceImage(xsDataImageNew) edPluginPluginExecImageQualityIndicator.setDataInput(xsDataInputDistlSignalStrength) edPluginPluginExecImageQualityIndicator.execute() listPluginDistl.append((xsDataImageNew.copy(), edPluginPluginExecImageQualityIndicator)) listBatch.append(xsDataImageNew.copy()) if len(listBatch) == batchSize: edPluginControlDozor = self.loadPlugin(self.strPluginNameControlDozor) xsDataInputControlDozor = XSDataInputControlDozor() for image in listBatch: xsDataInputControlDozor.addImage(XSDataFile(image.path)) xsDataInputControlDozor.batchSize = XSDataInteger(batchSize) edPluginControlDozor.dataInput = xsDataInputControlDozor edPluginControlDozor.execute() listPluginDozor.append((edPluginControlDozor, listBatch)) listBatch = [] if len(listBatch) > 0: # Process the remaining images... edPluginControlDozor = self.loadPlugin(self.strPluginNameControlDozor) xsDataInputControlDozor = XSDataInputControlDozor() for image in listBatch: xsDataInputControlDozor.addImage(XSDataFile(image.path)) xsDataInputControlDozor.batchSize = XSDataInteger(batchSize) edPluginControlDozor.dataInput = xsDataInputControlDozor edPluginControlDozor.execute() listPluginDozor.append([edPluginControlDozor, listBatch]) listIndexing = [] # Synchronize all image quality indicator plugins and upload to ISPyB xsDataInputStoreListOfImageQualityIndicators = XSDataInputStoreListOfImageQualityIndicators() for (xsDataImage, edPluginPluginExecImageQualityIndicator) in listPluginDistl: xsDataImageQualityIndicators = XSDataImageQualityIndicators() xsDataImageQualityIndicators.image = xsDataImage.copy() if edPluginPluginExecImageQualityIndicator is not None: edPluginPluginExecImageQualityIndicator.synchronize() if edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators is not None: xsDataImageQualityIndicators = XSDataImageQualityIndicators.parseString(\ edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators.marshal()) self.xsDataResultControlImageQualityIndicators.addImageQualityIndicators(xsDataImageQualityIndicators) for (edPluginControlDozor, listBatch) in listPluginDozor: edPluginControlDozor.synchronize() for imageDozor in edPluginControlDozor.dataOutput.imageDozor: for xsDataImageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators: if xsDataImageQualityIndicators.image.path.value == imageDozor.image.path.value: xsDataImageQualityIndicators.dozor_score = imageDozor.mainScore xsDataImageQualityIndicators.dozorSpotFile = imageDozor.spotFile if imageDozor.spotFile is not None: if os.path.exists(imageDozor.spotFile.path.value): numpyArray = numpy.loadtxt(imageDozor.spotFile.path.value, skiprows=3) xsDataImageQualityIndicators.dozorSpotList = XSDataString(base64.b64encode(numpyArray.tostring())) xsDataImageQualityIndicators.addDozorSpotListShape(XSDataInteger(numpyArray.shape[0])) if len(numpyArray.shape) > 1: xsDataImageQualityIndicators.addDozorSpotListShape(XSDataInteger(numpyArray.shape[1])) xsDataImageQualityIndicators.dozorSpotsIntAver = imageDozor.spotsIntAver xsDataImageQualityIndicators.dozorSpotsResolution = imageDozor.spotsResolution if self.xsDataResultControlImageQualityIndicators.inputDozor is None: if edPluginControlDozor.dataOutput.inputDozor is not None: self.xsDataResultControlImageQualityIndicators.inputDozor = XSDataDozorInput().parseString( edPluginControlDozor.dataOutput.inputDozor.marshal()) if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value: xsDataISPyBImageQualityIndicators = \ XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal()) xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(xsDataISPyBImageQualityIndicators) # print xsDataInputStoreListOfImageQualityIndicators.marshal() if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value: self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName) self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators self.edPluginISPyB.execute() # if bDoIndexing: # Find the 5 most intensive images (TIS): listImage = [] # Check that we have dozor_score from all images: has_dozor_score = True for imageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators: if imageQualityIndicators.dozor_score is None: has_dozor_score = False if has_dozor_score: listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators, key=lambda imageQualityIndicators: imageQualityIndicators.dozor_score.value) else: listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators, key=lambda imageQualityIndicators: imageQualityIndicators.totalIntegratedSignal.value) for xsDataResultControlImageQualityIndicator in listSorted[-5:]: if xsDataResultControlImageQualityIndicator.goodBraggCandidates.value > 30: xsDataInputReadImageHeader = XSDataInputReadImageHeader() xsDataInputReadImageHeader.image = XSDataFile(xsDataResultControlImageQualityIndicator.image.path) self.edPluginReadImageHeader = self.loadPlugin(self.strPluginReadImageHeaderName) self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader self.edPluginReadImageHeader.executeSynchronous() xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput if xsDataResultReadImageHeader is not None: xsDataSubWedge = xsDataResultReadImageHeader.subWedge self.xsDataCollection = XSDataCollection() self.xsDataCollection.addSubWedge(xsDataSubWedge) xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.setDataCollection(self.xsDataCollection) xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(xsDataIndexingInput) edPluginMOSFLMIndexing = self.loadPlugin(self.strIndexingMOSFLMPluginName) self.listPluginMOSFLM.append([edPluginMOSFLMIndexing, xsDataResultControlImageQualityIndicator]) edPluginMOSFLMIndexing.setDataInput(xsDataMOSFLMIndexingInput) edPluginMOSFLMIndexing.execute() for tupleMOSFLM in self.listPluginMOSFLM: edPluginMOSFLMIndexing = tupleMOSFLM[0] xsDataResultControlImageQualityIndicator = tupleMOSFLM[1] edPluginMOSFLMIndexing.synchronize() if not edPluginMOSFLMIndexing.isFailure(): xsDataMOSFLMOutput = edPluginMOSFLMIndexing.dataOutput xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutput) selectedSolution = xsDataIndexingResult.selectedSolution if selectedSolution is not None: xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution